Rasterfarm-SDK
Loading...
Searching...
No Matches
TessellationSimple Class Reference

#include <polygon.h>

Inheritance diagram for TessellationSimple:
TessellationComplex

Public Member Functions

 TessellationSimple (Mesh::TriangleMesh *pMesh, Mesh::FaceIndex iFace, const Vertex2fArray &hullContour)
 
void tessellate ()
 
void greedyClipTrianglesConvex ()
 
void traverseStripTriangles ()
 
void traverseFanTrianglesConvex ()
 
Mesh::TriangleIndexArray findTriangles (Mesh::FaceIndex iFace)
 

Static Public Member Functions

static void tessellate (Mesh::TriangleMesh *pMesh, Mesh::FaceIndex iFace, const Vertex2fArray &contour)
 
static bool getOrientation (Circulator< Vertex2fArray > circulator)
 
static bool getOrientation (const Vertex2fArray &c, uint index)
 
static HeapArray< bool > getOrientation (const Vertex2fArray &contour)
 
static HeapArray< floatgetDeterminant (const Vertex2fArray &contour)
 
static HeapArray< floatgetAngle (const Vertex2fArray &contour)
 
static float getAngleSum (const Vertex2fArray &contour, uint index)
 
static HeapArray< floatgetAngleSum (const Vertex2fArray &contour)
 
static bool isSelfIntersecting (const Vertex2fArray &contour)
 
static bool isSelfTangent (const Vertex2fArray &contour)
 
static HeapArray< Vertex2fArraydecomposeSelfIntersecting (const Vertex2fArray &contour)
 

Public Attributes

const Mesh::FaceIndex iFace
 

Protected Attributes

Mesh::TriangleMesh *const pMesh
 
Vertex2fArray hull
 
Mesh::VertexIndexArray iHull
 

Detailed Description

Tessellates a simple polygon, meaning no-holes nor intersections.

Constructor & Destructor Documentation

◆ TessellationSimple()

TessellationSimple::TessellationSimple ( Mesh::TriangleMesh * pMesh,
Mesh::FaceIndex iFace,
const Vertex2fArray & hullContour )

Tessellates a single hull(Island). NOTE: Triangulation is the only currently supported form of tessellation.

Parameters
Pointerto a TriangleMesh, must not be null.
indexof the TriangleMesh::face to populate.
ACCW oriented non-intersecting contour.

Member Function Documentation

◆ decomposeSelfIntersecting()

static HeapArray< Vertex2fArray > TessellationSimple::decomposeSelfIntersecting ( const Vertex2fArray & contour)
static
Returns
A set of contours divided by the points of intersection;

◆ findTriangles()

Mesh::TriangleIndexArray TessellationSimple::findTriangles ( Mesh::FaceIndex iFace)

◆ getAngle()

static HeapArray< float > TessellationSimple::getAngle ( const Vertex2fArray & contour)
static

Will compute the angle for each vertex of the given Polygon formed by it's adjacent edges.

Returns
Floats mapping to the Polygon vertex angle by array-index.

◆ getAngleSum() [1/2]

static HeapArray< float > TessellationSimple::getAngleSum ( const Vertex2fArray & contour)
static

Will compute the sum of all angles formed-by adjacent contours for each vertex of the given Polygon.

Returns
Booleans mapping to the Polygon vertex orientation by array-index.

◆ getAngleSum() [2/2]

static float TessellationSimple::getAngleSum ( const Vertex2fArray & contour,
uint index )
static

Will compute the sum of all angles formed-by adjacent contours up-to and including the given index.

Returns
The sum of angles at contour[0 - index] in radians.

◆ getDeterminant()

static HeapArray< float > TessellationSimple::getDeterminant ( const Vertex2fArray & contour)
static

Will compute the determinant for each vertex of the given Polygon formed by it's adjacent edges. NOTE: all values for a convex contour with CCW orientation will be > 0.

Returns
Floats mapping to the Polygon vertex determinant by array-index.

◆ getOrientation() [1/3]

static bool TessellationSimple::getOrientation ( Circulator< Vertex2fArray > circulator)
static

Will compute the orientation for the vertex of the given index for the contour. NOTE: The contour's orientation

Returns
True if the orientation is pointing outside the contour and vertices are ordered with CW orientation. Conversly, True if pointing inside the contour and vertices are ordered with CCW orientation.

◆ getOrientation() [2/3]

static bool TessellationSimple::getOrientation ( const Vertex2fArray & c,
uint index )
static

Will compute the orientation for the vertex of the given index for the contour. NOTE: The contour's orientation

Returns
True if the orientation is pointing outside the contour and vertices are ordered with CW orientation. Conversly, True if pointing inside the contour and vertices are ordered with CCW orientation.

◆ getOrientation() [3/3]

static HeapArray< bool > TessellationSimple::getOrientation ( const Vertex2fArray & contour)
static

Will compute the orientation for each vertex of the given Polygon.

Returns
Booleans mapping to the Polygon vertex orientation by array-index.

◆ greedyClipTrianglesConvex()

void TessellationSimple::greedyClipTrianglesConvex ( )

Create triangle edges using an algorithm that clips triangles by order of adjacent-edge angles * adjacent-edge determinants. This algorithm has a worst-case runtime of O(n^2).

◆ isSelfIntersecting()

static bool TessellationSimple::isSelfIntersecting ( const Vertex2fArray & contour)
static

This method can be used to help validate a valid Polygon before object construction.

Parameters
Anarray of 2d vertices forming a contour of size > 3.
Returns
True if contour self intersects.

◆ isSelfTangent()

static bool TessellationSimple::isSelfTangent ( const Vertex2fArray & contour)
static

This method can be used to help validate a valid Polygon before object construction.

Parameters
Anarray of 2d vertices forming a contour of size > 3.
Returns
True if contour vertex intersects another segment within the contour.

◆ tessellate() [1/2]

void TessellationSimple::tessellate ( )

Given the non-intersecting hul, populate the given TriangleMesh with a corresponding Face and associated objects to form a tessellation.

◆ tessellate() [2/2]

static void TessellationSimple::tessellate ( Mesh::TriangleMesh * pMesh,
Mesh::FaceIndex iFace,
const Vertex2fArray & contour )
static

Given a Contour, populate the given TriangleMesh with the respective Mesh resources with a corresponding Face and associated objects to form a tessellation.

Parameters
Pointerto a TriangleMesh, must not be null.
indexof the TriangleMesh::face to populate.
ACCW oriented non-intersecting contour.

◆ traverseFanTrianglesConvex()

void TessellationSimple::traverseFanTrianglesConvex ( )

Triangulate the hull using an algorithm that creates a triangle-fan. by traversal of the contour. This algorithm has a worst-case runtime of O(n).

◆ traverseStripTriangles()

void TessellationSimple::traverseStripTriangles ( )

Triangulate the hull using an algorithm that creates a triangle-strip. by traversal of the contour. This algorithm has a worst-case runtime of O(n).

Member Data Documentation

◆ hull

Vertex2fArray TessellationSimple::hull
protected

The hull.

◆ iFace

const Mesh::FaceIndex TessellationSimple::iFace

◆ iHull

Mesh::VertexIndexArray TessellationSimple::iHull
protected

The vertex indices of the hull.

◆ pMesh

Mesh::TriangleMesh* const TessellationSimple::pMesh
protected

The documentation for this class was generated from the following file: