A fork of Rogach's port of the original C++ library openvoronoi.
- Incremental Voronoi Point & Line Site Diagrams
- Voronoi Diagram Generators: Labryinth, L-Systems
- Diagram Medial Axis
- Nearest N cells to point
This fork has the following changes:
Click to expand!
- Converts source code to Java 11
- Introduces cell-point methods:
nearestFace()
nearestFaces()
- Removes the tests maven sub-module and brings the main library up to the top level (so it's easily hostable as an artifact via JitPack)
- Splits the library into appropriate sub-packages
- Converts source comments into proper Javadoc comments (only the most important comments converted so far...)
- Removes the constraint that point sites had to be placed within a unit-circle centered on (0,0) — now points can have any coordinate! (this could have side-effects...)
- Introduces LindenmayerCurve, RandomLabyrinth and RandomPolygon diagram generators (from the original's tests) into the main library under the generate sub-package
- Introduces
buildIntoVoronoiDiagram()
for PlanarGraphs - Adds Javadoc comments to important arguments on generator classes
- Removes SVG output functionality
- Removes the debugging
step
argument (that was left in the code) from the main point/site insert methods - Implements
position()
onEdge
,LineSite
andPointsite
classes - Replace diagram's
HashSets
withArrayLists
for easier iteration - More error handling
import org.rogach.jopenvoronoi.*;
VoronoiDiagram voronoi = new VoronoiDiagram();
for (int i = 0; i < 100; i++) {
voronoi.insert_point_site(Math.random(), Math.random());
}
HalfEdgeDiagram diagram = voronoi.getDiagram();
voronoi.getFaces().forEach(face -> {
Point pos = face.site.position();
diagram.face_edges(face).forEach(edge -> {
vertex(edge.source.position.x, edge.source.position.y);
vertex(edge.target.position.x, edge.target.position.y);
});
});
Voronoi from poisson disc points | Voronoi from poisson disc points (bounded) |
Voronoi from random points | 3 line sites |
Gosper Curve | Moore Curve |
Labryinth | Medial Axis (green) |
JOpenVoronoi is released under GPLv3, just like its parent openvoronoi project.