Voronoi on Mesh#

https://github.com/user-attachments/assets/b24933ff-f6fc-4c06-b679-c777be5e5e2a

Dependencies#

This node requires SciPy library to work.

Functionality#

This node creates Voronoi diagram on a given mesh, from specified set of initial points (sites). More specifically, it subdivides the mesh into regions of such Voronoi diagram. It is possible to subdivide:

  • either surface of the mesh, generating a series of flat meshes,

  • or the volume of the mesh, generating a series of closed-body meshes. In this mode, it is required that the mesh represents a closed volume.

Addition#

The number of resulting objects can differ from the number of sites you set, both smaller and larger. Example of smaller number:

Example of bigger number:

Inputs#

This node has the following inputs:

  • Vertices. Vertices of the mesh to generate Voronoi diagram on. This input is mandatory.

  • Polygons. Faces of the mesh to generate Voronoi diagram on. This input is mandatory.

    https://github.com/user-attachments/assets/09b2accd-7f8b-46e9-aa3a-254f1e1518d7
  • Matrices of Meshes. Matrices of input objects.

    Used in complex multi-object scenarios. If you have several input objects and set postprocess property “Join Mode” to “Split (disconnect)” then you mess up the corresponding matrices for the resulting objects

  • Voronoi Sites. The points to generate Voronoi diagram for. Usually you want for this points to lie either inside the mesh or on it’s surface, but this is not necessary. This input is mandatory. If list of Voronoi sites is Zero length then source object will not processed and transfer it params to output sockets.

    https://github.com/nortikin/sverchok/assets/14288520/4353aec1-e4f5-4cb4-a9ec-f3e8c6435c0b
  • Matrices of meshes. Matrices of input meshes if meshes placed not in the zero. For example: if you using “Get Objects Data” with “Apply matrices” parameter off then real coords can be calculated with “Get Objects Data” Matrices output

    https://github.com/user-attachments/assets/1bf85e83-12c2-4469-8d35-526be6e5b0c8
  • Voronoi Sites. Points of Voronoi. If using Source Join Mode as “Merge” then sites merged only what in input “Voronoi Sites”. For example: if objects are 3 and sites are 2 then sites will not recalculate for object number 3.

    https://github.com/user-attachments/assets/862468b6-bd4d-4503-8436-a3013e0bbb77

    If mode is split then every unconnected object will get sites of original mesh:

    https://github.com/user-attachments/assets/f153ae9c-a0c2-4d2a-a4d3-dacb43c74844
  • Mask of sites. List of True/False or indexes. What Sites will be show in result.

    https://github.com/nortikin/sverchok/assets/14288520/61bd23e3-3a8e-47e2-b18f-1c7272b71679
  • invert Invert list Mask of Sites.

    https://github.com/nortikin/sverchok/assets/14288520/b8360826-c678-4b47-b783-3e05a71f1275
  • Spacing. Percent of space to leave between generated fragment meshes. Zero means do not leave any space, i.e. regions will fully cover initial mesh. The default value is 0. This input can consume either a single value per object, or a list of values per object - one value per site. In the later case, each value will be used for corresponding cell.

    https://user-images.githubusercontent.com/14288520/202571726-e7ecbf0a-72ad-48bd-b3c5-cd800b86b524.gif

The list of values per object - one value per site:

Parameters#

This node has the following parameters:

  • Voronoi Mode. The available options are:

    • Volume. Split closed-volume mesh into smaller closed-volume mesh regions.

    • Surface. Split the surface of a mesh into smaller flat meshes.

    The default value is Volume.

    https://github.com/user-attachments/assets/21441877-6bc1-485c-9780-6cb8f5b52d55
  • Correct normals. This parameter is available only when Mode parameter is set to Volume. If checked, then the node will make sure that all normals of generated meshes point outside. Otherwise, this is not guaranteed. Checked by default.

  • Pre processing. This define preprocessing original objects, sites, matrices and masks.

    • Split. Separate unconnected meshes independently before process. Sites, matrices and masks keep the same for every separated element.

    • Keep. Do nothing. All original meshes stay unchanged before process

    • Merge. Merge original meshes, sites, masks. Spacing gets first.

      https://github.com/user-attachments/assets/2619e606-f96d-4ef8-8f7f-324b6a8f5b8d https://github.com/user-attachments/assets/11a1b295-83b4-4a9a-a62f-9760a93ae680 https://github.com/user-attachments/assets/9961c060-f60d-4e7d-a40e-730e6861fa4a https://github.com/user-attachments/assets/a0a2de0a-ded9-408e-9609-24373e5c51f5
  • Post processing. This defines nesting structure of result meshes. The available options are:

    • Split (disconnect). Separate the result meshes into individual unconnected meshes. Every unconnected part get matrix of original meshes. Be careful when evaluating the outcome. Some settings may produce similar results but with different structure. For example, the “Split (disconnect)”” operation with “Outer Polygons” in “Volume” Mode gives one object, although it seems that the objects are two, and “Split (disconnect)” in “Surface Mode” gives as a result 2 objects. This is because “Split (disconnect)” with “Outer Polygons” in “Volume Mode” is the same object as external Polygons.

      https://github.com/user-attachments/assets/53368187-096a-42e1-963c-22394cff7635
    • Split (sites). Separate the result meshes into meshes of original sites (can keep several unconnected objects). Every part get matrix of original meshes.

    • Keep. Keep parts of preprocessed meshes. Also keep matrices of original objects unchanged.

    • Merge. Join all results meshes into a single mesh.

      https://github.com/user-attachments/assets/ad754124-d6e2-4371-95d4-cfd9a14c7bb5 https://github.com/user-attachments/assets/58e43bce-4428-4210-b0a9-3234d7b1a7ff
  • Accuracy. This parameter is available in the N panel only. This defines the precision of mesh calculation (number of digits after decimal point). The default value is 6.

Outputs#

This node has the following outputs:

  • Vertices. Vertices of generated mesh.

  • Outer Vertices.

  • Inner Vertices.

  • Border Vertices.

  • Outer Indexes Vertices.

  • Inner Indexes Vertices.

  • Border Indexes Vertices.

  • Edges. Edges of generated mesh.

  • Outer Edges.

  • Inner Edges.

  • Border Edges.

  • Outer Indexes Edges.

  • Inner Indexes Edges.

  • Border Indexes Edges.

  • Polygons. Faces of generated mesh.

  • Outer Inner Mask Polygons.

  • Outer Polygons.

  • Inner Polygons.

  • Border Polygons.

  • Outer Indexes Polygons.

  • Inner Indexes Polygons.

  • Border Indexes Polygons.

    Additionally for voronoi on volume if you connect socket “Outer polygon” then you can see this result:

  • Used Sites idx. Indices of sources sites for further using (after apply Mask of sites). (from sverchok 1.3-alpha-master)

  • Used Sites Verts. Values of used sites. Keep of source struct of input socket “Voronoi sites” lists (after apply Mask of sites). (from sverchok 1.3-alpha-master)

    https://github.com/nortikin/sverchok/assets/14288520/91ccb203-e0bb-49a0-a626-e403ee30be3c
  • Matrices. Matrices or results meshes by join mode.

  • Voronoi Sites Matrices. These Matrices is used in multi-objects sources. If you have several meshes and split results on individual meshes with “Split (disconnect)” or “Split (sites)” then this socket out matrices for every results objects as Translate matrix to Voronoi Site position from source object origin.

    https://github.com/user-attachments/assets/556f2815-1780-417c-9aee-a436342becb3

    To get real world position of objects you have to use both matrices:

    https://github.com/user-attachments/assets/bfe6c0fc-6177-4fe7-a2bd-156d159fb588

    Using only “Matrices” socket will get next result:

    https://github.com/user-attachments/assets/5ef90016-1da3-4378-9502-f1be4f516ca1

    Examples of using matrices sockets in split mode.

    Additionally: if results join mode is not split then “Voronoi Sites Matrices” has no sence so this socket will has only identity Matrices in Keep or Merge mode.

    https://github.com/user-attachments/assets/4fe0caa7-195c-4ccc-b17c-27024cde0e34

Addition info#

From version of sverchok 1.3.0-alpha sites can be any configurations: Line, Plane, Circle, Sphere

https://github.com/nortikin/sverchok/assets/14288520/20df452e-be1e-47b2-acda-f2b7a1a8553e
https://github.com/nortikin/sverchok/assets/14288520/22ab225c-a8b5-4596-bee1-85a6412c8bb1
https://github.com/nortikin/sverchok/assets/14288520/8fa05903-0244-441a-87a3-aa42415e6b30
https://github.com/nortikin/sverchok/assets/14288520/27e4c0a4-e56d-4f4f-9db5-04a92c0c7180

Example of usage#

https://user-images.githubusercontent.com/14288520/202578440-c713aac3-c787-456a-b796-190204bf297a.png

Inspired by https://www.youtube.com/watch?v=Ip6JI6Qiiwg

https://github.com/nortikin/sverchok/assets/14288520/5d01e61f-9743-4a07-a2c8-2866a7191e73 https://github.com/nortikin/sverchok/assets/14288520/c4153ae0-ca18-4f29-968c-ede4d2197008

Like the previous example but node “Particle System” replaced by node “Spiral”:

https://github.com/nortikin/sverchok/assets/14288520/b5704476-fbc4-4c0a-a116-d7a1738567fe https://github.com/nortikin/sverchok/assets/14288520/2ad77100-6630-4a27-aa36-a88a7b2d7f5b https://github.com/nortikin/sverchok/assets/14288520/4e963254-251d-441d-808f-f30c9af55d62

blend file: nortikin/sverchok


Show external surface as frame:

https://github.com/user-attachments/assets/569e0afe-619b-450b-8c9f-df1583b894a9

See also example#