Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Graphics::Procedural::Triangulator Class Reference

A generator class that implements the Delaunay Triangulation algorithm. More...

#include <triangulator.h>

+ Inheritance diagram for Mezzanine::Graphics::Procedural::Triangulator:
+ Collaboration diagram for Mezzanine::Graphics::Procedural::Triangulator:

Public Types

typedef std::vector< DelaunaySegmentDelaunaySegmentContainer
 Convenience typedef for the storage of delaunay segments to be processed by this class.
 
typedef std::vector< LineSegment2DSegmentContainer
 Convenience typedef for the storage of segments to be processed by this class.
 
- Public Types inherited from Mezzanine::Graphics::Procedural::MeshGenerator< Triangulator >
enum  GeneratorOptions
 A convenience enum used to describe boolean options for a generator.
 

Public Member Functions

 Triangulator ()
 Class constructor.
 
virtual ~Triangulator ()
 Class destructor.
 
virtual void AddToTriangleBuffer (TriangleBuffer &Buffer) const
 Adds the vertices and indices as configured in this generator to a triangle buffer. More...
 
TriangulatorSetManualSuperTriangle (Triangle2D *Tri)
 Sets manual super triangle. More...
 
TriangulatorSetMultiShapeToTriangulate (const MultiShape *TriMultiShape)
 Sets multi shape to triangulate. More...
 
TriangulatorSetRemoveOutside (const Boole Remove)
 Sets if the outside of the shape must be removed. More...
 
TriangulatorSetSegmentListToTriangulate (SegmentContainer *Segments)
 Sets segment list to triangulate. More...
 
TriangulatorSetShapeToTriangulate (const Shape *TriShape)
 Sets shape to triangulate. More...
 
void Triangulate (IndexContainer &Indexes, Point2DContainer &Vertices) const
 Executes the Constrained Delaunay Triangulation algorithm.

Exceptions
AnINVALID_STATE_EXCEPTION will be thrown if either a Shape, MultiShape, or Segment List is not set when this is called.
More...
 
- Public Member Functions inherited from Mezzanine::Graphics::Procedural::MeshGenerator< Triangulator >
 MeshGenerator ()
 Class constructor.
 
virtual ~MeshGenerator ()
 Class destructor.
 
TriangleBuffer BuildTriangleBuffer () const
 Creates a TriangleBuffer with the the vertices and indices as configured in this generator. More...
 
MeshGenerateMesh (const String &MeshName, const String &MeshGroup, const String &MatName, const String &MatGroup) const
 Generates the mesh. More...
 
TriangulatorResetTransforms ()
 Resets all transforms (orientation, position and scale) that would have been applied to the mesh to their default values. More...
 
TriangulatorSetEnableNormals (Boole EnableNormals)
 Sets whether normals are enabled or not. More...
 
TriangulatorSetNumTexCoordSet (const UInt8 NumSets)
 Sets the number of texture coordintate sets. More...
 
TriangulatorSetOrientation (const Quaternion &Ori)
 Sets an orientation baked into the resulting mesh. More...
 
TriangulatorSetOrientation (const Real X, const Real Y, const Real Z, const Real W)
 Sets an orientation baked into the resulting mesh. More...
 
TriangulatorSetPosition (const Vector3 &Loc)
 Sets a translation baked into the resulting mesh. More...
 
TriangulatorSetPosition (const Real X, const Real Y, const Real Z)
 Sets a translation baked into the resulting mesh. More...
 
TriangulatorSetScale (const Vector3 &Scaling)
 Sets a scale baked into the resulting mesh. More...
 
TriangulatorSetScale (const Real Scaling)
 Sets a uniform scale baked into the resulting mesh. More...
 
TriangulatorSetScale (const Real X, const Real Y, const Real Z)
 Sets a scale baked into the resulting mesh. More...
 
TriangulatorSetSwitchUV (Boole SwitchUV)
 Sets whether to switch U and V texture coordinates. More...
 
TriangulatorSetTextureRectangle (const Real RectLeft, const Real RectRight, const Real RectTop, const Real RectBottom)
 Sets the texture rectangle. More...
 
TriangulatorSetUTile (const Real uTile)
 Sets the U Tile. More...
 
TriangulatorSetVTile (const Real vTile)
 Sets the V Tile. More...
 

Protected Member Functions

void _AddConstraints (DelaunayTriangleBuffer &TriBuf, const Point2DContainer &List, const IndexContainer &SegmentListIndices) const
 Forces specific segments to be present in the resulting triangulation. More...
 
void _RecursiveTriangulatePolygon (const DelaunaySegment &CuttingSeg, const IndexContainer &InputPoints, DelaunayTriangleBuffer &TriBuf, const Point2DContainer &List) const
 Recursively generates a Delaunay triangle from a container of points. More...
 
void Delaunay (Point2DContainer &List, DelaunayTriangleBuffer &TriBuf) const
 Performs a Delaunay Triangulation on a provided list of points in 2D space and populates a triangle buffer with the results. More...
 
- Protected Member Functions inherited from Mezzanine::Graphics::Procedural::MeshGenerator< Triangulator >
void AddPoint (TriangleBuffer &Buffer, const Vector3 &Loc, const Vector3 &Norm, const Vector2 &UV) const
 Adds a new point to a triangle buffer, using the format defined for that MeshGenerator. More...
 

Protected Attributes

Triangle2DManualSuperTriangle
 A pointer to an optional triangle that encompasses all points to be triangulated. More...
 
const MultiShapeMultiShapeToTriangulate
 A pointer to the MultiShape to be triangulated. More...
 
Boole RemoveOutside
 Stores whether or not the super triangle should be removed at the end of triangulation. More...
 
SegmentContainerSegmentListToTriangulate
 A pointer to a container of segments forming the shape to triangulate. More...
 
const ShapeShapeToTriangulate
 A pointer to the Shape to be triangulated. More...
 
- Protected Attributes inherited from Mezzanine::Graphics::Procedural::MeshGenerator< Triangulator >
UInt8 GeneratorOpts
 Storage for the boolean options to be used by this generator. More...
 
UInt8 NumTexCoordSet
 The number of texture coordinate sets to include. More...
 
Quaternion Orientation
 Orientation to apply the mesh. More...
 
Vector3 Position
 Position to apply to the mesh. More...
 
Vector3 Scale
 Scale to apply to the mesh. More...
 
Real UTile
 U tile for texture coords generation. More...
 
Vector2 UVOrigin
 Rectangle in which the texture coordinates will be placed. More...
 
Real VTile
 V tile for texture coords generation. More...
 

Detailed Description

A generator class that implements the Delaunay Triangulation algorithm.

This generator works with 2D geometry to generate triangles for 3D meshes.

Definition at line 252 of file triangulator.h.

Member Function Documentation

void Mezzanine::Graphics::Procedural::Triangulator::_AddConstraints ( DelaunayTriangleBuffer TriBuf,
const Point2DContainer List,
const IndexContainer SegmentListIndices 
) const
protected

Forces specific segments to be present in the resulting triangulation.

Parameters
TriBufThe triangule buffer storing the results of the triangulation.
ListThe container of Vector2's to perform the triangulation on.
SegmentListIndicesA container of indexes to segments that will be forced to exist in the resulting triangulation.

Definition at line 398 of file triangulator.cpp.

void Mezzanine::Graphics::Procedural::Triangulator::_RecursiveTriangulatePolygon ( const DelaunaySegment CuttingSeg,
const IndexContainer InputPoints,
DelaunayTriangleBuffer TriBuf,
const Point2DContainer List 
) const
protected

Recursively generates a Delaunay triangle from a container of points.

Parameters
CuttingSegThe segment used to generate the previous delaunay triangle that is a part of the provided available points.
InputPointsThe remaining available points to generate a triangle from.
TriBufThe triangule buffer storing the results of the triangulation.
ListThe container of Vector2's to perform the triangulation on.

Definition at line 540 of file triangulator.cpp.

void Mezzanine::Graphics::Procedural::Triangulator::AddToTriangleBuffer ( TriangleBuffer Buffer) const
virtual

Adds the vertices and indices as configured in this generator to a triangle buffer.

Parameters
BufferThe buffer to append this generators vertices and indices to.

Implements Mezzanine::Graphics::Procedural::MeshGenerator< Triangulator >.

Definition at line 594 of file triangulator.cpp.

void Mezzanine::Graphics::Procedural::Triangulator::Delaunay ( Point2DContainer List,
DelaunayTriangleBuffer TriBuf 
) const
protected

Performs a Delaunay Triangulation on a provided list of points in 2D space and populates a triangle buffer with the results.

Parameters
ListThe container of Vector2's to perform the triangulation on.
TriBufThe triangle buffer storing the results of the triangulation.

Definition at line 270 of file triangulator.cpp.

Triangulator & Mezzanine::Graphics::Procedural::Triangulator::SetManualSuperTriangle ( Triangle2D Tri)

Sets manual super triangle.

Note
If this is not set, the algorithm will make an educated guess. This is slower than providing one if the information is available.
Parameters
TriThe super triangle to manually set for triangulation.
Returns
Returns a reference to this.

Definition at line 741 of file triangulator.cpp.

Triangulator & Mezzanine::Graphics::Procedural::Triangulator::SetMultiShapeToTriangulate ( const MultiShape TriMultiShape)

Sets multi shape to triangulate.

Note
A Shape, MultiShape, or SegmentList must be available in order to triangulate and only one will be processed. If one gets set, the other two will be NULL'd out.
Parameters
TriMultiShapeThe multi-shape that will be triangulated.
Returns
Returns a reference to this.

Definition at line 725 of file triangulator.cpp.

Triangulator & Mezzanine::Graphics::Procedural::Triangulator::SetRemoveOutside ( const Boole  Remove)

Sets if the outside of the shape must be removed.

Parameters
RemoveOutsideWhether or not the outside of the shape should be removed during triangulation.
Returns
Returns a reference to this.

Definition at line 747 of file triangulator.cpp.

Triangulator & Mezzanine::Graphics::Procedural::Triangulator::SetSegmentListToTriangulate ( SegmentContainer Segments)

Sets segment list to triangulate.

Note
A Shape, MultiShape, or SegmentList must be available in order to triangulate and only one will be processed. If one gets set, the other two will be NULL'd out.
Parameters
SegmentsA pointer to the container of line segments that will be triangulated.
Returns
Returns a reference to this.

Definition at line 733 of file triangulator.cpp.

Triangulator & Mezzanine::Graphics::Procedural::Triangulator::SetShapeToTriangulate ( const Shape TriShape)

Sets shape to triangulate.

Note
A Shape, MultiShape, or SegmentList must be available in order to triangulate and only one will be processed. If one gets set, the other two will be NULL'd out.
Parameters
TriShapeThe shape that will be triangulated.
Returns
Returns a reference to this.

Definition at line 717 of file triangulator.cpp.

void Mezzanine::Graphics::Procedural::Triangulator::Triangulate ( IndexContainer Indexes,
Point2DContainer Vertices 
) const

Executes the Constrained Delaunay Triangulation algorithm.

Exceptions
AnINVALID_STATE_EXCEPTION will be thrown if either a Shape, MultiShape, or Segment List is not set when this is called.

Parameters
IndexesA vector of indexes where is outputed the resulting triangle indexes.
VerticesA vector of vertices where is outputed the resulting triangle vertices.

Definition at line 616 of file triangulator.cpp.

Member Data Documentation

Triangle2D* Mezzanine::Graphics::Procedural::Triangulator::ManualSuperTriangle
protected

A pointer to an optional triangle that encompasses all points to be triangulated.

Note
If this is not set, the algorithm will make an educated guess. This is slower than providing one if the information is available.

Definition at line 275 of file triangulator.h.

const MultiShape* Mezzanine::Graphics::Procedural::Triangulator::MultiShapeToTriangulate
protected

A pointer to the MultiShape to be triangulated.

Note
If this is valid, then the Shape and SegmentList pointers will be NULL. Only one can be triangulated.

Definition at line 267 of file triangulator.h.

Boole Mezzanine::Graphics::Procedural::Triangulator::RemoveOutside
protected

Stores whether or not the super triangle should be removed at the end of triangulation.

Definition at line 278 of file triangulator.h.

SegmentContainer* Mezzanine::Graphics::Procedural::Triangulator::SegmentListToTriangulate
protected

A pointer to a container of segments forming the shape to triangulate.

Note
If this is valid, then the Shape and MultiShape pointers will be NULL. Only one can be triangulated.

Definition at line 271 of file triangulator.h.

const Shape* Mezzanine::Graphics::Procedural::Triangulator::ShapeToTriangulate
protected

A pointer to the Shape to be triangulated.

Note
If this is valid, then the MultiShape and SegmentList pointers will be NULL. Only one can be triangulated.

Definition at line 263 of file triangulator.h.


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