Index

 E3d_PolygonFlatten
 E3d_PolygonFlattenScaled
 E3d_PolygonTriangulate
 E3d_PolygonTestTriangulate


E3d_PolygonFlatten

Rotate a Polygon, so it's aligned with the X-Y plane

Syntax
 E3d2DPosition* E3d_PolygonFlatten(E3dPolygon* LPolygon, unsigned int LVertexNodeSize, E3dVertex* LVertices)
Arguments
 E3dPolygon*  LPolygon    Pointer to the Polygon
 E3dVertex*   LVertices   The Vertex array of the Mesh containing this Polygon
Description
Aligns the Polygon with the X-Y plane, making it a 2D Polygon.
This is useful for many Polygon operations, such as determining Edge intersections, triangulating etc.

Return value
Pointer to an array of 2DPositions, corresponding to each VertexNode of the Polygon, or NULL in case of an error.
This array must be freed by the caller when not used any more

See also
E3d_PolygonFlattenScaled()

E3d_PolygonFlattenScaled

Scale and rotate a Polygon, so it's aligned with the X-Y plane

Syntax
 E3d2DPosition* E3d_PolygonFlattenScaled(E3dPolygon* LPolygon, unsigned int LVertexNodeSize, E3dVertex* LVertices, E3dCoordinate LScale)
Arguments
 E3dPolygon*   LPolygon    Pointer to the Polygon
 E3dVertex*    LVertices   The Vertex array of the Mesh containing this Polygon
 E3dCoordinate LScale      Scaling factor
Description
Aligns the Polygon with the X-Y plane, making it a 2D Polygon.
Before being rotated, the Polygon will be uniformly scaled around its center by LScale.

Return value
Pointer to an array of 2DPositions, corresponding to each VertexNode of the Polygon, or NULL in case of an error.
This array must be freed by the caller when not used any more

See also
E3d_PolygonFlatten()

E3d_PolygonTriangulate

Triangulate a Polygon

Syntax
 int E3d_PolygonTriangulate(E3dPolygon* LPolygon, unsigned int LVertexNodeSize, E3dVertex* LVertices, EBool LDoConvex)
Arguments
 E3dVertex*   LVertices    The array of vertices this Polygon is indexing in its VertexNodes
 E3dPolygon*  LPolygon     Pointer to the E3dPolygon structure
 EBool        LDoConvex    Should we try to triangulate convex Polys or just concave ones
Description
Triangulates a Polygon and stores the resulting triangles in the Polygon structure. The Polygon's normal must be correct before calling this function.

Return value
The number of resulting triangles, or 0 if the triangulation was unsuccessful.

See also
E3d_TestTriangulatePolygon, E3d_PolygonTriangulateForRendering, E3d_PolygonUpdateNormal, E3dM_PolygonUpdateNormal

E3d_PolygonTestTriangulate

Test-triangulate a Polygon

Syntax
 int E3d_PolygonTestTriangulate(E3dPolygon* LPolygon, unsigned int LVertexNodeSize, E3dVertex* LVertices, EBool LDoConvex)
Arguments
 E3dVertex*   LVertices    The array of Vertices this Polygon is indexing in its VertexNodes
 E3dPolygon*  LPolygon     Pointer to the E3dPolygon structure
 EBool        LDoConvex    Should we try to triangulate convex Polys or just concave ones
Description
Triangulates a Polygon, but it doesn't store the resulting triangles in Polygon structure. This function can be useful to determine whether a Polygon can be triangulated (if not, it is usually considered "degenerate" and could be thrown out, ignored etc.)

Return value
The number of resulting triangles, or 0 if the triangulation was unsuccessful.

See also
E3d_PolygonTriangulate, E3d_PolygonTriangulateForRendering