Back to class index
Polygon[Class Summary]
p
ctor
NumEdges()[const]
NumVertices()[const]
VertexArrayPtr() (+1 overload)
AnyPointFast()[const]
Vertex(vertexIndex)[const]
Edge(edgeIndex)[const]
Edge2D(edgeIndex)[const]
EdgeNormal(edgeIndex)[const]
EdgePlane(edgeIndex)[const]
ExtremePoint(direction)[const] (+1 overload)
ProjectToAxis(...)[const]
DiagonalExists(i,j)[const]
Diagonal(i,j)[const]
IsConvex()[const]
IsPlanar(epsilonSq)[const]
IsSimple()[const]
IsNull()[const]
IsFinite()[const]
IsDegenerate(epsilon)[const]
BasisU()[const]
BasisV()[const]
MapTo2D(i)[const] (+1 overload)
MapFrom2D(point)[const]
NormalCCW()[const]
NormalCW()[const]
PlaneCCW()[const]
PlaneCW()[const]
Translate(offset)
Transform(transform) (+3 overloads)
Contains(...)[const] (+3 overloads)
Contains2D(...)[const]
Intersects(line)[const] (+11 overloads)
ConvexIntersects(aabb)[const] (+2 overloads)
ClosestPoint(...)[const] (+2 overloads)
Distance(point)[const]
Area()[const]
Perimeter()[const]
Centroid()[const]
CenterPoint()[const]
PointOnEdge(normalizedDistance)[const]
RandomPointOnEdge(rng)[const]
FastRandomPointInside(rng)[const]
ToPolyhedron()[const]
Triangulate()[const]
MinimalEnclosingAABB()[const]
ToString()[const]
SerializeToString()[const]
Equals(other)[const]
BitEquals(other)[const]
NumFaces()[static]
FromString(str,outEndStr)[static] (+1 overload)

Polygon::MapTo2D

Syntax

float2 Polygon::MapTo2D(int i) const; [10 lines of code]

Returns the given vertex of this polygon mapped to a local 2D space on this polygon.

In the local space of the polygon, the z-coordinate is always zero, and the polygon lies in the XY-plane, with the first vertex of the polygon being in the origin, and the x-axis running in the direction given by BasisU() and the y-axis running in the direction given by BasisV().

Parameters

intiThe index of the vertices of this polygon to generate, in the range [0, NumVertices()-1].

See Also

NumVertices(), MapFrom2D(), Edge2D(), BasisU(), BasisV().

Syntax

float2 Polygon::MapTo2D(const float4 &point) const; [12 lines of code]

Maps the given global (world) space point to the local 2D space of this polygon.

Work in progress:

Todo: in float2 Polygon::MapTo2D(const float4 &point) const:
Return a float3 to be able to read the distance of the point from the plane of the polygon? (or add an overload for that)

Add MapTo2D(Line/LineSegment/Ray/Triangle/Polygon).