Support Forum G3D Web Page |
Public Member Functions | |
ConvexPolygon () | |
ConvexPolygon (const Vector3 &v0, const Vector3 &v1, const Vector3 &v2) | |
ConvexPolygon (const Array< Vector3 > &__vertex) | |
virtual | ~ConvexPolygon () |
void | cut (const Plane &plane, ConvexPolygon &above, ConvexPolygon &below, DirectedEdge &newEdge) |
Cuts the polygon at the plane. More... | |
void | cut (const Plane &plane, ConvexPolygon &above, ConvexPolygon &below) |
float | getArea () const |
O(n) in the number of edges More... | |
ConvexPolygon | inverse () const |
Returns the same polygon with inverse winding. More... | |
bool | isEmpty () const |
O(n) in the number of edges. More... | |
Vector3 | normal () const |
int | numVertices () const |
Zero vertices indicates an empty polygon (zero area). More... | |
void | removeDuplicateVertices () |
When a cut plane grazes a vertex in the polygon, two near-identical vertices may be created. More... | |
void | setNumVertices (int n) |
void | setVertex (int i, const Vector3 &v) |
const Vector3 & | vertex (int i) const |
Counter clockwise winding order. More... | |
Friends | |
class | ConvexPolyhedron |
|
inline |
|
inlinevirtual |
void G3D::ConvexPolygon::cut | ( | const Plane & | plane, |
ConvexPolygon & | above, | ||
ConvexPolygon & | below, | ||
DirectedEdge & | newEdge | ||
) |
Cuts the polygon at the plane.
If the polygon is entirely above or below the plane, one of the returned polygons will be empty.
above | The part of the polygon above (on the side the normal points to or in the plane) the plane |
below | The part of the polygon below the plane. |
newEdge | If a new edge was introduced, this is that edge (on the above portion; the below portion is the opposite winding. |
void G3D::ConvexPolygon::cut | ( | const Plane & | plane, |
ConvexPolygon & | above, | ||
ConvexPolygon & | below | ||
) |
float G3D::ConvexPolygon::getArea | ( | ) | const |
O(n) in the number of edges
ConvexPolygon G3D::ConvexPolygon::inverse | ( | ) | const |
Returns the same polygon with inverse winding.
bool G3D::ConvexPolygon::isEmpty | ( | ) | const |
O(n) in the number of edges.
|
inline |
|
inline |
Zero vertices indicates an empty polygon (zero area).
void G3D::ConvexPolygon::removeDuplicateVertices | ( | ) |
When a cut plane grazes a vertex in the polygon, two near-identical vertices may be created.
The closeness of these two points can cause a number of problems, such as ConvexPolygon::normal() returning an infinite vector. It should be noted, however, that not all applications are sensitive to near-identical vertices.
removeDuplicateVertices() detects and eliminates redundant vertices.
|
inline |
|
inline |
|
inline |
Counter clockwise winding order.
|
friend |