Package d3delaunayforprocessing
Class Voronoi
java.lang.Object
d3delaunayforprocessing.Voronoi
public class Voronoi
extends java.lang.Object
d3-delaunay-for-processing
To port the d3-delaunay library to Java using the delaunator-java library by
waveware4ai
This is the Voronoi class
- Since:
- 2022-12-22
-
Field Summary
Fields Modifier and Type Field Description double[]
circumcenters
The circumcenters of the Delaunay triangles as a double array [ cx0, cy0, cx1, cy1, ...Delaunay
delaunay
Reference Reference back to the corresponding delaunay instant.double[]
vectors
A double array [ vx0, vy0, wx0, wy0, ...double
xmax
double
xmin
double
ymax
double
ymin
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description double[]
_cell(int i)
double[]
_clip(int i)
double[]
_clipFinite(int i, double[] points)
double[]
_clipInfinite(int i, double[] points, double vx0, double vy0, double vxn, double vyn)
double[]
_clipSegment(double x0, double y0, double x1, double y1, int c0, int c1)
int
_edge(int i, int e0, int e1, java.util.List<java.lang.Double> P, int j)
int
_edgecode(double x, double y)
void
_init()
double[]
_project(double x0, double y0, double vx, double vy)
int
_regioncode(double x, double y)
double[][]
cellPolygon(int i)
Returns the convex, closed polygon [ [ x0, y0 ], [ x1, y1 ], ..., [ x0, y0 ] ] representing the cell for the specified point i.float[][]
cellPolygonFloat(int i)
Returns the convex, closed polygon [ [ x0, y0 ], [ x1, y1 ], ..., [ x0, y0 ] ] representing the cell for the specified point i.boolean
contains(int i, double x, double y)
Returns true if the cell with the specified index i contains the specified point (x, y).boolean
contains(int i, float x, float y)
Returns true if the cell with the specified index i contains the specified point (x, y).int[]
neighbors(int i)
Returns an int array of the indexes of the cells that share a common edge with the specified cell i.void
renderCell(int i, Polygon context)
-
Field Details
-
delaunay
Reference Reference back to the corresponding delaunay instant. -
circumcenters
public double[] circumcentersThe circumcenters of the Delaunay triangles as a double array [ cx0, cy0, cx1, cy1, ... ] -
vectors
public double[] vectorsA double array [ vx0, vy0, wx0, wy0, ... ] where each non-zero quadruple describes an open (infinite) cell on the outer hull, giving the directions of two open half-lines. -
xmin
public double xmin -
xmax
public double xmax -
ymin
public double ymin -
ymax
public double ymax
-
-
Constructor Details
-
Voronoi
Voronoi class constructor.- Parameters:
delaunay
- A Delaunay objectbounds
- the boundary for the Voronoi graph, [xmin, ymin, xmax, ymax]- See Also:
Delaunay
-
Voronoi
Voronoi class constructor, but with float.- Parameters:
delaunay
- A Delaunay objectbounds
- the boundary for the Voronoi graph, [xmin, ymin, xmax, ymax]- See Also:
Delaunay
-
-
Method Details
-
_init
public void _init() -
renderCell
-
cellPolygon
public double[][] cellPolygon(int i)Returns the convex, closed polygon [ [ x0, y0 ], [ x1, y1 ], ..., [ x0, y0 ] ] representing the cell for the specified point i.- Parameters:
i
- the index of the cell- Returns:
- the points in an array [[x0, y0],[x1, y1], ...]
-
cellPolygonFloat
public float[][] cellPolygonFloat(int i)Returns the convex, closed polygon [ [ x0, y0 ], [ x1, y1 ], ..., [ x0, y0 ] ] representing the cell for the specified point i. Return in float.- Parameters:
i
- the index of the cell- Returns:
- the points in an array [[x0, y0],[x1, y1], ...]
-
contains
public boolean contains(int i, double x, double y)Returns true if the cell with the specified index i contains the specified point (x, y).- Parameters:
i
- the index of the cellx
- x coordinate value of the pointy
- y coordinate value of the point- Returns:
- true or false
-
contains
public boolean contains(int i, float x, float y)Returns true if the cell with the specified index i contains the specified point (x, y).- Parameters:
i
- the index of the cellx
- x coordinate value of the pointy
- y coordinate value of the point- Returns:
- true or false
-
neighbors
public int[] neighbors(int i)Returns an int array of the indexes of the cells that share a common edge with the specified cell i.- Parameters:
i
- the index of the cell- Returns:
- an int array of the indexes of the cell's neighbors
-
_cell
public double[] _cell(int i) -
_clip
public double[] _clip(int i) -
_clipFinite
public double[] _clipFinite(int i, double[] points) -
_clipSegment
public double[] _clipSegment(double x0, double y0, double x1, double y1, int c0, int c1) -
_clipInfinite
public double[] _clipInfinite(int i, double[] points, double vx0, double vy0, double vxn, double vyn) -
_edge
public int _edge(int i, int e0, int e1, java.util.List<java.lang.Double> P, int j) -
_project
public double[] _project(double x0, double y0, double vx, double vy) -
_edgecode
public int _edgecode(double x, double y) -
_regioncode
public int _regioncode(double x, double y)
-