Aether.Physics2D
1.7
|
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< Vertices > | Holes [get, set] |
You can add holes to this collection. It will get respected by some of the triangulation algoithms, but otherwise not used. More... | |
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
void ForceCounterClockWise | ( | ) |
Forces the vertices to be counter clock wise order.
AABB GetAABB | ( | ) |
Returns an AABB that fully contains this polygon.
float GetArea | ( | ) |
Gets the area.
Vector2 GetCentroid | ( | ) |
Gets the centroid.
float GetSignedArea | ( | ) |
Gets the signed area. If the area is less than 0, it indicates that the polygon is clockwise winded.
bool IsConvex | ( | ) |
Determines whether the polygon is convex. O(n^2) running time.
Assumptions:
true
if it is convex; otherwise, false
. 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.
bool IsSimple | ( | ) |
Checks if the vertices forms an simple polygon by checking for edge crossings.
int NextIndex | ( | int | index | ) |
Gets the next index. Used for iterating all the edges with wrap-around.
index | The current index |
Vector2 NextVertex | ( | int | index | ) |
Gets the next vertex. Used for iterating all the edges with wrap-around.
index | The current index |
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
point | The point to be tested. |
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
int PreviousIndex | ( | int | index | ) |
Gets the previous index. Used for iterating all the edges with wrap-around.
index | The current index |
Vector2 PreviousVertex | ( | int | index | ) |
Gets the previous vertex. Used for iterating all the edges with wrap-around.
index | The current index |
void ProjectToAxis | ( | ref Vector2 | axis, |
out float | min, | ||
out float | max | ||
) |
Projects to axis.
axis | The axis. |
min | The min. |
max | The max. |
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.
value | The amount to rotate by in radians. |
void Scale | ( | ref Vector2 | value | ) |
Scales the vertices with the specified vector.
value | The Value. |
void Scale | ( | Vector2 | value | ) |
Scales the vertices with the specified vector.
value | The Value. |
void Translate | ( | ref Vector2 | value | ) |
Translates the vertices with the specified vector.
value | The vector. |
void Translate | ( | Vector2 | value | ) |
Translates the vertices with the specified vector.
value | The value. |
|
getset |
You can add holes to this collection. It will get respected by some of the triangulation algoithms, but otherwise not used.