Aether.Physics2D  1.7
Vertices Class Reference
Inheritance diagram for Vertices:
Collaboration diagram for Vertices:

Public Member Functions

 Vertices (int capacity)
 
 Vertices (IEnumerable< Vector2 > vertices)
 
int NextIndex (int index)
 Gets the next index. Used for iterating all the edges with wrap-around. More...
 
Vector2 NextVertex (int index)
 Gets the next vertex. Used for iterating all the edges with wrap-around. More...
 
int PreviousIndex (int index)
 Gets the previous index. Used for iterating all the edges with wrap-around. More...
 
Vector2 PreviousVertex (int index)
 Gets the previous vertex. Used for iterating all the edges with wrap-around. More...
 
float GetSignedArea ()
 Gets the signed area. If the area is less than 0, it indicates that the polygon is clockwise winded. More...
 
float GetArea ()
 Gets the area. More...
 
Vector2 GetCentroid ()
 Gets the centroid. More...
 
AABB GetAABB ()
 Returns an AABB that fully contains this polygon. More...
 
void Translate (Vector2 value)
 Translates the vertices with the specified vector. More...
 
void Translate (ref Vector2 value)
 Translates the vertices with the specified vector. More...
 
void Scale (Vector2 value)
 Scales the vertices with the specified vector. More...
 
void Scale (ref Vector2 value)
 Scales the vertices with the specified vector. More...
 
void Rotate (float value)
 Rotate the vertices with the defined value in radians. More...
 
bool IsConvex ()
 Determines whether the polygon is convex. O(n^2) running time. More...
 
bool IsCounterClockWise ()
 Indicates if the vertices are in counter clockwise order. Warning: If the area of the polygon is 0, it is unable to determine the winding. More...
 
void ForceCounterClockWise ()
 Forces the vertices to be counter clock wise order. More...
 
bool IsSimple ()
 Checks if the vertices forms an simple polygon by checking for edge crossings. More...
 
PolygonError CheckPolygon ()
 Checks if the polygon is valid for use in the engine. More...
 
void ProjectToAxis (ref Vector2 axis, out float min, out float max)
 Projects to axis. More...
 
int PointInPolygon (ref Vector2 point)
 Winding number test for a point in a polygon. More...
 
bool PointInPolygonAngle (ref Vector2 point)
 Compute the sum of the angles made between the test point and each pair of points making up the polygon. If this sum is 2pi then the point is an interior point, if 0 then the point is an exterior point. ref: http://ozviz.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/ - Solution 2 More...
 
override string ToString ()
 

Properties

List< VerticesHoles [get, set]
 You can add holes to this collection. It will get respected by some of the triangulation algoithms, but otherwise not used. More...
 

Member Function Documentation

◆ CheckPolygon()

PolygonError CheckPolygon ( )

Checks if the polygon is valid for use in the engine.

Performs a full check, for simplicity, convexity, orientation, minimum angle, and volume.

From Eric Jordan's convex decomposition library

Returns
PolygonError.NoError if there were no error.

◆ ForceCounterClockWise()

void ForceCounterClockWise ( )

Forces the vertices to be counter clock wise order.

◆ GetAABB()

AABB GetAABB ( )

Returns an AABB that fully contains this polygon.

◆ GetArea()

float GetArea ( )

Gets the area.

Returns

◆ GetCentroid()

Vector2 GetCentroid ( )

Gets the centroid.

Returns

◆ GetSignedArea()

float GetSignedArea ( )

Gets the signed area. If the area is less than 0, it indicates that the polygon is clockwise winded.

Returns
The signed area

◆ IsConvex()

bool IsConvex ( )

Determines whether the polygon is convex. O(n^2) running time.

Assumptions:

  • The polygon is in counter clockwise order
  • The polygon has no overlapping edges
Returns
true if it is convex; otherwise, false.

◆ IsCounterClockWise()

bool IsCounterClockWise ( )

Indicates if the vertices are in counter clockwise order. Warning: If the area of the polygon is 0, it is unable to determine the winding.

◆ IsSimple()

bool IsSimple ( )

Checks if the vertices forms an simple polygon by checking for edge crossings.

◆ NextIndex()

int NextIndex ( int  index)

Gets the next index. Used for iterating all the edges with wrap-around.

Parameters
indexThe current index

◆ NextVertex()

Vector2 NextVertex ( int  index)

Gets the next vertex. Used for iterating all the edges with wrap-around.

Parameters
indexThe current index

◆ PointInPolygon()

int PointInPolygon ( ref Vector2  point)

Winding number test for a point in a polygon.

See more info about the algorithm here: http://softsurfer.com/Archive/algorithm_0103/algorithm_0103.htm

Parameters
pointThe point to be tested.
Returns
-1 if the winding number is zero and the point is outside the polygon, 1 if the point is inside the polygon, and 0 if the point is on the polygons edge.

◆ PointInPolygonAngle()

bool PointInPolygonAngle ( ref Vector2  point)

Compute the sum of the angles made between the test point and each pair of points making up the polygon. If this sum is 2pi then the point is an interior point, if 0 then the point is an exterior point. ref: http://ozviz.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/ - Solution 2

◆ PreviousIndex()

int PreviousIndex ( int  index)

Gets the previous index. Used for iterating all the edges with wrap-around.

Parameters
indexThe current index

◆ PreviousVertex()

Vector2 PreviousVertex ( int  index)

Gets the previous vertex. Used for iterating all the edges with wrap-around.

Parameters
indexThe current index

◆ ProjectToAxis()

void ProjectToAxis ( ref Vector2  axis,
out float  min,
out float  max 
)

Projects to axis.

Parameters
axisThe axis.
minThe min.
maxThe max.

◆ Rotate()

void Rotate ( float  value)

Rotate the vertices with the defined value in radians.

Warning: Using this method on an active set of vertices of a Body, will cause problems with collisions. Use Body.Rotation instead.

Parameters
valueThe amount to rotate by in radians.

◆ Scale() [1/2]

void Scale ( ref Vector2  value)

Scales the vertices with the specified vector.

Parameters
valueThe Value.

◆ Scale() [2/2]

void Scale ( Vector2  value)

Scales the vertices with the specified vector.

Parameters
valueThe Value.

◆ Translate() [1/2]

void Translate ( ref Vector2  value)

Translates the vertices with the specified vector.

Parameters
valueThe vector.

◆ Translate() [2/2]

void Translate ( Vector2  value)

Translates the vertices with the specified vector.

Parameters
valueThe value.

Property Documentation

◆ Holes

List<Vertices> Holes
getset

You can add holes to this collection. It will get respected by some of the triangulation algoithms, but otherwise not used.


The documentation for this class was generated from the following file: