Back to class index

Class Polygon

Summary

Represents a two-dimensional closed surface in 3D space.

Description

A polygon is defined by N endpoints, or corner vertices. To be a valid polygon, there must be at least 3 vertices (a triangle).

Well-formed polygons are always planar, i.e. all the vertices lie on the same plane. It is possible to store non-planar Polygons in this structure, but their representation is ambiguous, and for all practical purposes, should be avoided.

Member Reference

PolygonRepresents a two-dimensional closed surface in 3D space.
pStores the vertices of this polygon.
ctorThe default constructor creates a null polygon.
NumEdges()[const]Returns the number of edges in this polygon.
NumVertices()[const]Returns the number of vertices in this polygon.
VertexArrayPtr() (+1 overload)Returns a pointer to an array of vertices of this polygon.
AnyPointFast()[const]Quickly returns an arbitrary point inside this AABB. Used in GJK intersection test.
Vertex(vertexIndex)[const]Returns a vertex of this polygon.
Edge(edgeIndex)[const]Returns a line segment between two adjacent vertices of this polygon.
Edge2D(edgeIndex)[const]Returns a line segment between two adjacent vertices of this polygon, in the local space of this polygon.
EdgeNormal(edgeIndex)[const]Returns the normal vector of the given edge.
EdgePlane(edgeIndex)[const]Returns the normal plane of the given edge.
ExtremePoint(direction)[const] (+1 overload)Computes an extreme point of this Polygon in the given direction.
ProjectToAxis(...)[const]Projects this Polygon onto the given 1D axis direction vector.
DiagonalExists(i,j)[const]Tests if the given diagonal exists.
Diagonal(i,j)[const]Returns the diagonal that joins the two given vertices.
IsConvex()[const]Tests if this polygon is convex.
IsPlanar(epsilonSq)[const]Tests if this polygon is planar.
IsSimple()[const]Tests if this polygon is simple.
IsNull()[const]Tests if this polygon is null.
IsFinite()[const]Tests if this polygon is finite.
IsDegenerate(epsilon)[const]Tests if this polygon is degenerate.
BasisU()[const]Generates the U vector of the local space of this polygon.
BasisV()[const]Generates the V vector of the local space of this polygon.
MapTo2D(i)[const] (+1 overload)Returns the given vertex of this polygon mapped to a local 2D space on this polygon.
MapFrom2D(point)[const]Given a 2D point in the local space, returns the corresponding 3D point in the global (world) space.
NormalCCW()[const]Computes the normal of this polygon.
NormalCW()[const]Computes the normal of this polygon in clockwise direction.
PlaneCCW()[const]Computes the plane this polygon is contained in.
PlaneCW()[const]Computes the plane this polygon is contained in, with a normal vector that points in the clockwise direction.
Translate(offset)Translates this Polygon in world space.
Transform(transform) (+3 overloads)Applies a transformation to this Polygon.
Contains(...)[const] (+3 overloads)Tests if the given object, expressed in global (world) space, is fully contained inside this polygon.
Contains2D(...)[const]Tests if the given object, expressed in the local space of this polygon, is fully contained inside this polyhedron.
Intersects(line)[const] (+11 overloads)Tests whether this polygon and the given object intersect.
ConvexIntersects(aabb)[const] (+2 overloads)Tests whether this convex polygon and the given object intersect.
ClosestPoint(...)[const] (+2 overloads)Computes the closest point on this polygon to the given object.
Distance(point)[const]Returns the distance between this polygon and the given point.
Area()[const]Returns the surface area of this polygon.
Perimeter()[const]Returns the total edge length of this polygon.
Centroid()[const]Returns the center of mass of this polygon.
CenterPoint()[const]Identical to CenterPoint(), but provided to enable common signature with Triangle, AABB and OBB to allow them to be used in template classes.
PointOnEdge(normalizedDistance)[const]Computes a point on the perimeter of this polygon.
RandomPointOnEdge(rng)[const]Computes a random point on the perimeter of this polygon.
FastRandomPointInside(rng)[const]
ToPolyhedron()[const]Converts this Polygon to a Polyhedron representation.
Triangulate()[const]Triangulates this Polygon using the ear-clipping method.
MinimalEnclosingAABB()[const]Returns the smallest AABB that encloses this polygon.
ToString()[const]
SerializeToString()[const]
Equals(other)[const]
BitEquals(other)[const]
NumFaces()[static]
FromString(str,outEndStr)[static] (+1 overload)
Back to class index