Lloyd on Sphere¶
Dependencies¶
This node requires SciPy library to work.
Functionality¶
This node uses Lloyd algorithm to redistribute a set of points on a sphereical surface uniformly. If provided vertices are not lying on a sphere, they will be projected to the sphere first.
Optionally, weighted Lloyd algorithm can be used, to put points more dense in places to which higher weight is assigned.
Inputs¶
This node has the following inputs:
Sites. The points to be redistributed. This input is mandatory.
Center. The center of the sphere. The default value is
(0, 0, 0)
(global origin).Radius. Radius of the sphere. The default value is 1.0.
Iterations. Number of Lloyd’s algorithm iterations. The default value is 3.
Weights. Scalar Field object used to assign different weights for different places in 3D space. More points will be put in places which have bigger weight. This input is optional. If not connected, uniform Lloyd algorithm will be used.
Outputs¶
This node has the following output:
Sites. Redistributed points on the sphere.
Example of Usage¶
Let’s start with boxes distributed randomly on a sphere:
Generator-> Box
Generator-> Random Vector
Viz-> Viewer Draw
Note that the distribution is very unregular. Now we apply “Lloyd on Sphere” node:
Generator-> Box
Generator-> Random Vector
Viz-> Viewer Draw
Density of distribution can be controlled with a scalar field - in this example, by absolute value of Z coordinate:
Generator-> Box
Generator-> Random Vector
Fields-> Coordinate Scalar Field
Fields-> Scalar Field Math
Viz-> Viewer Draw