Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active January 18, 2018 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/c98289d349bf3118c08a305d8cdb5ff6 to your computer and use it in GitHub Desktop.
Save zeffii/c98289d349bf3118c08a305d8cdb5ff6 to your computer and use it in GitHub Desktop.

Contour 2D

Functionality

image

This node creates one or many contours at specified distance.

  • It is feeded by sets of vertices and edges.
  • Every set of vertices needs to share the Z coordinate in order to create a valid contour.

Inputs

This node has the following inputs, all of them can accept one or many different values:

  • Distance - distance to vertex.
  • Nº Vertices - Number of vectices per vertex
  • Verts_in - origin vertices.
  • Edgs_in - edges (pairs of integers).

Parameters

Parameter Type Default Description
Mode Menu Constant Constant: Constant distances on each perimeter. Weighted: Different distances per vertex.
Remove Doubles Float 1.0 Remove doubled vertices under this distance.
Distance Float 1.0 Distance to vertex.
Nº Vertices Float 1.0 Number of vectices per vertex.
Verts_in Vector (0.0,0.0,0.0) Origin vectors.
Edges_in Int tuples [] Connexion between vectices
In the N-Panel
Mask Tolerance Float 1.0e-5 Tolerance on masking (for low Nº Vertices or small values)
Inters. Mode Menu Circular Circular: Intersecction based on circles (Slower). Poligonal: Intersecction based on poligons (Faster).
List Match Menu Long Cycle Long Repeat: After shortest list repeat last value. Long Cycle: After shortest list got to first last value.

Outputs

This node has the following outputs:

  • Vertices
  • Edges

Examples of usage

- When you input different distances: In constant mode independent contours will be created (one per distance) In Weighted mode will apply each distance to a vertex creating independent contours when there are more distances than vertices

image

  • When you input different objects independent contours will be created:

image

  • With the intersection mode on "Circular" the intersection points will be placed as if we were using perfect circles. This will change the edges angles, but the distance between the intersection point and the original points will be maintained. On "Poligonal" the edges angles are preserved but the distance to original vertex will depend on the number of vertices.

image

  • Integrated list match function can lead to different results:

image

  • Different ranges can be used to create a complex contour.

image

  • When using text meshes it can get very slow but also interesting

image

Notes

  • This implementation can get very slow when working with hundreds of inputs and different distances, handle it with patience.
  • If the node does not create a closed contour try increasing the vertices number or rising the mask tolerance slowly
  • This is the pull request where this node was added nortikin/sverchok#2001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment