Skip to content

micycle1/jOpenVoronoi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JOpenVoronoi+

A fork of Rogach's port of the original C++ library openvoronoi.

Features

  • Incremental Voronoi Point & Line Site Diagrams
  • Voronoi Diagram Generators: Labryinth, L-Systems
  • Diagram Medial Axis
  • Nearest N cells to point

Fork Changes

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() on Edge, LineSite and Pointsite classes
  • Replace diagram's HashSets with ArrayLists for easier iteration
  • More error handling

Example code

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);
    });
});

Images

Voronoi

Voronoi from poisson disc points Voronoi from poisson disc points (bounded)
Voronoi from random points 3 line sites

Generators

Gosper Curve Moore Curve
Labryinth Medial Axis (green)

Nearest Faces

License

JOpenVoronoi is released under GPLv3, just like its parent openvoronoi project.

About

An extended and improved jOpenVoronoi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages

  • Java 100.0%