Show / Hide Table of Contents

Class Voronator

Computes a voronoi diagram in a 2d plane, optionally clipped to a rectangle.

Inheritance
object
Voronator
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Sylves
Assembly: Sylves.dll
Syntax
public class Voronator

Constructors

Voronator(IList<Vector2>)

Declaration
public Voronator(IList<Vector2> points)
Parameters
Type Name Description
IList<Vector2> points

Voronator(IList<Vector2>, Vector2, Vector2)

Declaration
public Voronator(IList<Vector2> points, Vector2 clipMin, Vector2 clipMax)
Parameters
Type Name Description
IList<Vector2> points
Vector2 clipMin
Vector2 clipMax

Properties

ClipMax

Declaration
public Vector2 ClipMax { get; }
Property Value
Type Description
Vector2

ClipMin

Declaration
public Vector2 ClipMin { get; }
Property Value
Type Description
Vector2

Delaunator

Declaration
public Delaunator Delaunator { get; }
Property Value
Type Description
Delaunator

Inedges

Declaration
public int[] Inedges { get; }
Property Value
Type Description
int[]

TriangleVertices

Declaration
public List<Vector2> TriangleVertices { get; }
Property Value
Type Description
List<Vector2>

Methods

ClippedNeighbors(int)

Returns the Voronoi cells that border the given cell. This uses clipping.

Declaration
public IEnumerable<int> ClippedNeighbors(int i)
Parameters
Type Name Description
int i
Returns
Type Description
IEnumerable<int>

Find(Vector2, int)

Finds the voronoi cell that contains the given point, or equivalently, finds the point that is nearest the given point. This ignores clipping, so it always succeeds.

Declaration
public int Find(Vector2 u, int i = 0)
Parameters
Type Name Description
Vector2 u

The point to search for.

int i

Optional, the voronoi cell to start the search at. Useful if you know the returned cell will be nearby.

Returns
Type Description
int

GetCentroid(List<Vector2>)

Declaration
public static Vector2 GetCentroid(List<Vector2> points)
Parameters
Type Name Description
List<Vector2> points
Returns
Type Description
Vector2

GetClippedPolygon(int)

Returns the vertices of the voronoi cell i after clipping to the clipping rectangle. Returns null if the polygon is fully outside the clipping rectangle.

Declaration
public List<Vector2> GetClippedPolygon(int i)
Parameters
Type Name Description
int i
Returns
Type Description
List<Vector2>

GetClippedRelaxedPoints()

Returns the centroid of each voronoi cell. This is suitable for use with Lloyd relaxation. Unbounded cells are clipped down, which tends to move them inwards.

Declaration
public List<Vector2> GetClippedRelaxedPoints()
Returns
Type Description
List<Vector2>

GetPolygon(int)

Returns the vertices of the voronoi cell, without any clipping. This means that unbounded cells will be missing the edges that extend to infinity, and may have less than 3 vertices.

Declaration
public List<Vector2> GetPolygon(int i)
Parameters
Type Name Description
int i
Returns
Type Description
List<Vector2>

GetPolygon(int, List<Vector2>, out Vector2, out Vector2)

Supplies the vertices of the voronoi cell, without any clipping. This means that unbounded cells will be missing the edges that extend to infinity, and may have less than 3 vertices.

Declaration
public bool GetPolygon(int i, List<Vector2> vertices, out Vector2 ray1, out Vector2 ray2)
Parameters
Type Name Description
int i

The voronoi cell

List<Vector2> vertices

Filled with the vertices of the polygon.

Vector2 ray1

For unbounded cells, the direction of the ray extending from vertex 0. Otherwise, empty.

Vector2 ray2

For unbounded cells, the direction of the ray extending from vertex 0. Otherwise, empty.

Returns
Type Description
bool

True if successful

GetPolygonStatus(int)

Declaration
public Voronator.PolygonStatus GetPolygonStatus(int i)
Parameters
Type Name Description
int i
Returns
Type Description
Voronator.PolygonStatus

GetRelaxedPoints()

Returns the centroid of each voronoi cell. This is suitable for use with Lloyd relaxation. Unbounded cells return their original point.

Declaration
public List<Vector2> GetRelaxedPoints()
Returns
Type Description
List<Vector2>

Neighbors(int)

Returns the Voronoi cells that border the given cell. This ignores clipping. This may give surprising results in degenerate cases that more than 3 cells meet at a point.

Declaration
public IEnumerable<int> Neighbors(int i)
Parameters
Type Name Description
int i
Returns
Type Description
IEnumerable<int>
In this article
Back to top Generated by DocFX