Package org.jbox2d.particle
Class VoronoiDiagram
java.lang.Object
org.jbox2d.particle.VoronoiDiagram
A field representing the nearest generator from each point.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGenerator(Vec2 center, int tag) Add a generator.voidgenerate(float radius) Generate the Voronoi diagram.voidList all nodes that contain at least one necessary generator.
-
Constructor Details
-
VoronoiDiagram
public VoronoiDiagram(int generatorCapacity)
-
-
Method Details
-
getNodes
List all nodes that contain at least one necessary generator.- Parameters:
callback- A callback function object called for each node.
-
addGenerator
Add a generator.- Parameters:
center- The position of the generator.tag- A tag used to identify the generator in callback functions.
-
generate
public void generate(float radius) Generate the Voronoi diagram. It is rasterized with a given interval in the same range as the necessary generators exist.- Parameters:
radius- The interval of the diagram.
-