DOTS Geometry
 
Loading...
Searching...
No Matches
Voronoi2D Class Reference

Static Public Member Functions

static JobHandle CalculateVoronoi (NativeArray< float2 > points, ref NativeArray< NativePolygon2D > polygons, ref NativeArray< int > polygonSites, out JobAllocations allocations, Allocator allocator=Allocator.TempJob, float addedMargin=1.0f, float epsilon0=10e-8f, float epsilon1=10e-6f, JobHandle dependsOn=default)
 Calculates and returns the polygons that form a Voronoi Diagram by forming the dual graph of the delaunay triangulation. A job is scheduled to calculate the bounding rectangle.
 
static JobHandle CalculateVoronoi (Rect bounds, NativeArray< float2 > points, ref NativeArray< NativePolygon2D > polygons, ref NativeArray< int > polygonSites, out JobAllocations allocations, Allocator allocator=Allocator.TempJob, float epsilon0=10e-8f, float epsilon1=10e-6f, JobHandle dependsOn=default)
 Calculates and returns the polygons that form a Voronoi Diagram by forming the dual graph of the delaunay triangulation.
 
static JobHandle CalculateVoronoiLookupTable (int2 dimension, NativeArray< float2 > points, ref NativeArray< int > table, out JobAllocations allocations, Allocator allocator=Allocator.TempJob, float addedMargin=1.0f, JobHandle dependsOn=default)
 Calculates a Voronoi Lookup Table (VoLT) with a certain dimension. A job is scheduled to calculate the bounding rectangle.
 
static JobHandle CalculateVoronoiLookupTable (int2 dimension, Rect bounds, NativeArray< float2 > points, ref NativeArray< int > table, out JobAllocations allocations, Allocator allocator=Allocator.TempJob, JobHandle dependsOn=default)
 Calculates a Voronoi Lookup Table (VoLT) with a certain dimension within the given bounds.
 
static int CalculateVoronoiLookupTableIndex (int2 dimension, Rect bounds, float2 position)
 Returns the index of a Voronoi Lookup Table (VoLT) a given position falls into. If the position is out of the bounds, the index returned is invalid (there are no bound checks)
 

Member Function Documentation

◆ CalculateVoronoi() [1/2]

static JobHandle CalculateVoronoi ( NativeArray< float2 > points,
ref NativeArray< NativePolygon2D > polygons,
ref NativeArray< int > polygonSites,
out JobAllocations allocations,
Allocator allocator = Allocator::TempJob,
float addedMargin = 1::0f,
float epsilon0 = 10e-8f,
float epsilon1 = 10e-6f,
JobHandle dependsOn = default )
static

Calculates and returns the polygons that form a Voronoi Diagram by forming the dual graph of the delaunay triangulation. A job is scheduled to calculate the bounding rectangle.

Parameters
pointsThe sites of the voronoi diagram
polygonsAn array that is filled with the resulting polygons. Its length should be equal to the number of points
polygonSitesAn array that is filled with integers for each polygon. Each integer corresponds to the site the polygon belongs to
allocations
allocator
addedMarginAdditional margin space for the boundary
epsilon0The error rate for forming the dual graph
epsilon1The error rate for boundary intersections
dependsOn
Returns

◆ CalculateVoronoi() [2/2]

static JobHandle CalculateVoronoi ( Rect bounds,
NativeArray< float2 > points,
ref NativeArray< NativePolygon2D > polygons,
ref NativeArray< int > polygonSites,
out JobAllocations allocations,
Allocator allocator = Allocator::TempJob,
float epsilon0 = 10e-8f,
float epsilon1 = 10e-6f,
JobHandle dependsOn = default )
static

Calculates and returns the polygons that form a Voronoi Diagram by forming the dual graph of the delaunay triangulation.

Parameters
boundsThe enclosing boundary of the points
pointsThe sites of the voronoi diagram
polygonsAn array that is filled with the resulting polygons. Its length should be equal to the number of points
polygonSitesAn array that is filled with integers for each polygon. Each integer corresponds to the site the polygon belongs to
allocations
allocator
epsilon0The error rate for forming the dual graph
epsilon1The error rate for boundary intersections
dependsOn
Returns

◆ CalculateVoronoiLookupTable() [1/2]

static JobHandle CalculateVoronoiLookupTable ( int2 dimension,
NativeArray< float2 > points,
ref NativeArray< int > table,
out JobAllocations allocations,
Allocator allocator = Allocator::TempJob,
float addedMargin = 1::0f,
JobHandle dependsOn = default )
static

Calculates a Voronoi Lookup Table (VoLT) with a certain dimension. A job is scheduled to calculate the bounding rectangle.

Parameters
dimensionThe dimension in X and Y (similar to a texture resolution)
pointsThe sites of the voronoi diagram
tableThe table is returned after the scheduled Job is completed
allocations
allocator
addedMarginAdditional margin space for the boundary
dependsOn
Returns

◆ CalculateVoronoiLookupTable() [2/2]

static JobHandle CalculateVoronoiLookupTable ( int2 dimension,
Rect bounds,
NativeArray< float2 > points,
ref NativeArray< int > table,
out JobAllocations allocations,
Allocator allocator = Allocator::TempJob,
JobHandle dependsOn = default )
static

Calculates a Voronoi Lookup Table (VoLT) with a certain dimension within the given bounds.

Parameters
dimensionThe dimension in X and Y (similar to a texture resolution)
boundsThe enclosing boundary of the points
pointsThe sites of the voronoi diagram
tableThe table is returned after the scheduled Job is completed
allocations
allocator
dependsOn
Returns

◆ CalculateVoronoiLookupTableIndex()

static int CalculateVoronoiLookupTableIndex ( int2 dimension,
Rect bounds,
float2 position )
static

Returns the index of a Voronoi Lookup Table (VoLT) a given position falls into. If the position is out of the bounds, the index returned is invalid (there are no bound checks)

Parameters
dimension
bounds
position
Returns