A 2D polygon, that can be used within Unitys Job System. Supports holes, and is the basis for many advanced geometry algorithms.
More...
|
void | AddHole (List< Vector2 > points) |
| Appends a hole to the polygon. The order of the points added should be counter-clockwise (the algorithms sort it out later)
|
|
void | AddHole (NativeArray< float2 > points) |
| Appends a hole to the polygon. The order of the points added should be counter-clockwise (the algorithms sort it out later)
|
|
void | AddHole (NativeList< float2 > points) |
| Appends a hole to the polygon. The order of the points added should be counter-clockwise (the algorithms sort it out later)
|
|
void | AddHole (Vector2[] points) |
| Appends a hole to the polygon. The order of the points added should be counter-clockwise (the algorithms sort it out later)
|
|
float | Area () |
| Calculates the area of the polygon.
|
|
bool | AreHolesValid () |
| Returns false if the separators in the polygon contain negative length holes.
|
|
void | Clear () |
| Clears all vertices and holes in the polygon.
|
|
void | DeserializeBinary (byte[] data) |
|
void | Dispose () |
|
JobHandle | Dispose (JobHandle jobHandle) |
|
Rect | GetBoundingRect () |
|
Vector2 | GetCenter () |
| Returns the average position of all the points of the polygon. This is not the real centroid of the polygon, but the more useful variant in most cases.
|
|
UnsafeList< float2 > | GetPoints () |
|
float | GetWindingNumber (Vector2 point) |
| Calculates the winding number of the point (i.e. how often is the boundary going around in circles around the point). An even number means the point is outside the polygon, while an odd number means it is inside.
|
|
void | InsertPoint (int idx, float2 point) |
| Insert a point at any index in the polygon (method will handle holes/subsurfaces etc.)
|
|
bool | IsConvex () |
|
bool | IsPointInside (Vector2 point) |
|
bool | IsSimple () |
|
void | LoadFromBinary (string filePath) |
|
| NativePolygon2D (Allocator allocator, float2[] points) |
|
| NativePolygon2D (Allocator allocator, float2[] points, int[] separators) |
|
| NativePolygon2D (Allocator allocator, int nrOfPoints) |
|
| NativePolygon2D (Allocator allocator, List< float2 > points) |
|
unsafe | NativePolygon2D (Allocator allocator, List< Vector2 > points) |
|
| NativePolygon2D (Allocator allocator, NativeArray< float2 > points) |
|
| NativePolygon2D (Allocator allocator, NativeList< float2 > points) |
|
unsafe | NativePolygon2D (Allocator allocator, NativeList< float2 > points, NativeList< int > separators) |
|
| NativePolygon2D (Allocator allocator, UnsafeList< float2 > points, UnsafeList< int > separators) |
|
unsafe | NativePolygon2D (Allocator allocator, Vector2[] points) |
|
unsafe | NativePolygon2D (Allocator allocator, Vector2[] points, int[] separators) |
|
int | NumberOfHoles () |
|
void | OnAfterDeserialize () |
|
void | OnBeforeSerialize () |
|
void | RemoveHole (int subsurfaceIdx) |
| Removes the hole with the specified subsurface (the index of the hole)
|
|
void | RemovePoint (int idx, out int removedSubsurface) |
| Removes a point at any index in the polygon (method will handle holes/subsurfaces etc.)
|
|
void | SaveAsBinary (string filePath) |
|
byte[] | SerializeBinary () |
|
|
static unsafe DCEL | ConvertToDCEL (NativePolygon2D polygon, int faceID, Allocator allocator=Allocator.TempJob) |
| Converts a polygon to a doubly-connected edge list (DCEL)
|
|
static float | Distance (NativePolygon2D polygon, Vector2 point, out int closestIndex, out int closestSubsurface, bool signed=false) |
|
static NativePolygon2D | Flip (Allocator allocator, NativePolygon2D polygon) |
| Flips the polygon - i.e. it reverses the vertex order so it faces the other way.
|
|
static NativePolygon2D | MakeSimple (Allocator allocator, NativePolygon2D polygon2D) |
| Removes all holes but keeps the appearance by adding bridge edges from the border of the polygon to the previous holes.
|
|
static NativePolygon2D | RemoveColinearVertices (Allocator allocator, NativePolygon2D polygon, float epsilon=0.01f) |
| Removes colinear vertices of the polygon (Runtime = O(n)) and returns a copy.
|
|
static void | SwitchHolesByAngle (int idx, List< float2 > tempPoints) |
|
A 2D polygon, that can be used within Unitys Job System. Supports holes, and is the basis for many advanced geometry algorithms.