![]() |
Murl Engine API
Version 2024.1
|
A class for mainpulating simple polygons. More...
#include <murl_util_polygon_manipulator.h>
A class for mainpulating simple polygons.
Simple polygons can be convex or nonconvex, but cannot have self-intersections or holes.
Public Member Functions | |
Bool | ClearVertices () const |
Clear the manipulator's input vertices. More... | |
Bool | AddVertices (const Float *vertices, UInt32 numVertices, UInt32 byteStride) const |
Add input vertices to the manipulator. More... | |
Bool | Triangulate () const |
Triangulate the polygon with given input vertices. More... | |
UInt32 | GetNumberOfTriangulationIndices () const |
Get the number of resulting indices from a present triangulation. More... | |
const UInt32 * | GetTriangulationIndices () const |
Get the resulting indices from a present triangulation. More... | |
Bool | Partition () const |
Partition the polygon with given input vertices into a number of convex sub-polygons. More... | |
UInt32 | GetNumberOfPartitions () const |
Get the number of resulting convex partitions. More... | |
UInt32 | GetNumberOfPartitionIndices (UInt32 partition) const |
Get the number of resulting indices from a partition at given index. More... | |
const UInt32 * | GetPartitionIndices (UInt32 partition) const |
Get the resulting indices from a partition at given index. More... | |
Static Public Member Functions | |
static PolygonManipulator * | Acquire () |
Acquire a manipulator. More... | |
static Bool | Release (PolygonManipulator *&manipulator) |
Release a previously acquired manipulator. More... | |
|
static |
Acquire a manipulator.
Each call to Acquire() must have a corresponding call to Release(), when the manipulator is not needed anymore. When a manipulator is acquired, its internal list of vertices is cleared and ready to be filled up by calling AddVertices().
|
static |
Release a previously acquired manipulator.
manipulator | A reference to a pointer of the manipulator to be released. |
Bool Murl::Util::PolygonManipulator::ClearVertices | ( | ) | const |
Clear the manipulator's input vertices.
Bool Murl::Util::PolygonManipulator::AddVertices | ( | const Float * | vertices, |
UInt32 | numVertices, | ||
UInt32 | byteStride | ||
) | const |
Add input vertices to the manipulator.
vertices | A const pointer to the input vertices. |
numVertices | The number of vertices to add. |
byteStride | The number of bytes to skip in the 'vertices' array to access subsequent vertex entries. Must be at least 8 (at least two 32bit floats per vertex). |
Bool Murl::Util::PolygonManipulator::Triangulate | ( | ) | const |
Triangulate the polygon with given input vertices.
This method returns false when it is impossible to create a valid triangulation from the given set of input vertices.
UInt32 Murl::Util::PolygonManipulator::GetNumberOfTriangulationIndices | ( | ) | const |
Get the number of resulting indices from a present triangulation.
After Triangulate() was successfully called, thie method returns the total number of indices (i.e. 3 times the number of triangles) for the generated triangulation. If Triangulate() failed (or was never called), this method returns 0.
const UInt32* Murl::Util::PolygonManipulator::GetTriangulationIndices | ( | ) | const |
Get the resulting indices from a present triangulation.
After Triangulate() was successfully called, thie method returns an array of 32bit unsigned integer values representing subsequent triplets of indices into the initially submitted array of vertices, one for each resulting triangle. If Triangulate() failed (or was never called), this method returns a null pointer.
Bool Murl::Util::PolygonManipulator::Partition | ( | ) | const |
Partition the polygon with given input vertices into a number of convex sub-polygons.
This method returns false when it is impossible to partition the polygon.
UInt32 Murl::Util::PolygonManipulator::GetNumberOfPartitions | ( | ) | const |
Get the number of resulting convex partitions.
After Partition() was successfully called, thie method returns the total number of convex sub-polygons the input polygon was split to. If Partition() failed (or was never called), this method returns 0.
Get the number of resulting indices from a partition at given index.
After Partition() was successfully called, thie method returns the total number of indices for the generated convex partition at a given index. If Partition() failed (or was never called) or the partition index is out of range, this method returns 0.
partition | The index of the partition, from 0 to GetNumberOfPartitions()-1. |
Get the resulting indices from a partition at given index.
After Partition() was successfully called, thie method returns an array of 32bit unsigned integer values representing the outline of the generated convex partition at a given index. If Partition() failed (or was never called) or the partition index is out of range, this method returns a null pointer.
partition | The index of the partition, from 0 to GetNumberOfPartitions()-1. |