A class for mainpulating simple polygons. More...

#include "murl_util_polygon_manipulator.h"

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 UInt32GetTriangulationIndices () 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 UInt32GetPartitionIndices (UInt32 partition) const
 Get the resulting indices from a partition at given index. More...
 

Static Public Member Functions

static PolygonManipulatorAcquire ()
 Acquire a manipulator. More...
 
static Bool Release (PolygonManipulator *&manipulator)
 Release a previously acquired manipulator. More...
 

Detailed Description

A class for mainpulating simple polygons.

Simple polygons can be convex or nonconvex, but cannot have self-intersections or holes.

Member Function Documentation

◆ Acquire()

static PolygonManipulator* Murl::Util::PolygonManipulator::Acquire ( )
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().

Returns
The manipulator instance.

◆ Release()

static Bool Murl::Util::PolygonManipulator::Release ( PolygonManipulator *&  manipulator)
static

Release a previously acquired manipulator.

Parameters
manipulatorA reference to a pointer of the manipulator to be released.
Returns
true if successful.

◆ ClearVertices()

Bool Murl::Util::PolygonManipulator::ClearVertices ( ) const

Clear the manipulator's input vertices.

Returns
true if successful.

◆ AddVertices()

Bool Murl::Util::PolygonManipulator::AddVertices ( const Float vertices,
UInt32  numVertices,
UInt32  byteStride 
) const

Add input vertices to the manipulator.

Parameters
verticesA const pointer to the input vertices.
numVerticesThe number of vertices to add.
byteStrideThe 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).
Returns
true if successful.

◆ Triangulate()

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.

Returns
true if successful.

◆ GetNumberOfTriangulationIndices()

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.

Returns
The total number of triangle indices.

◆ GetTriangulationIndices()

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.

Returns
The triangle indices.

◆ Partition()

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.

Returns
true if successful.

◆ GetNumberOfPartitions()

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.

Returns
The total number of convex partitions.

◆ GetNumberOfPartitionIndices()

UInt32 Murl::Util::PolygonManipulator::GetNumberOfPartitionIndices ( UInt32  partition) const

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.

Parameters
partitionThe index of the partition, from 0 to GetNumberOfPartitions()-1.
Returns
The total number of polygon indices.

◆ GetPartitionIndices()

const UInt32* Murl::Util::PolygonManipulator::GetPartitionIndices ( UInt32  partition) const

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.

Parameters
partitionThe index of the partition, from 0 to GetNumberOfPartitions()-1.
Returns
The polygon indices.

The documentation for this class was generated from the following file:
  • murl_util_polygon_manipulator.h


Copyright © 2011-2024 Spraylight GmbH.