xmsgrid  1.0
xms::TrTriangulatorPoints Class Reference

Class to triangulate simple points. More...

Inheritance diagram for xms::TrTriangulatorPoints:
xms::TrTriangulator

Public Member Functions

 TrTriangulatorPoints (const VecPt3d &a_pts, VecInt &a_tris, VecInt2d *a_trisAdjToPts=nullptr)
 Triangulate Pt3ds returning triangles in a single 1D vector. More...
 
virtual void SetObserver (BSHP< Observer > a_)
 Set the observer to use for feedback while processing. More...
 
virtual int GetID () const override
 Return the current point index (0-based). More...
 
virtual Pt3d GetLocation () const override
 Get location of current point. More...
 
virtual int GetNPoints () const override
 Return the number of points to be triangulated. More...
 
virtual void IncrementPoint () override
 Increment the current point index by 1.
 
virtual void PrepareToReceiveTriangles () override
 Called just before triangles are created.
 
virtual void FinalizeTriangulation () override
 Called after all triangles have been received.
 
virtual void ReceiveTriangle (int a_id1, int a_id2, int a_id3) override
 Receive a triangle consisting of the 3 points. More...
 
- Public Member Functions inherited from xms::TrTriangulator
 TrTriangulator ()
 Constructor.
 
virtual ~TrTriangulator ()
 Destructor.
 
bool Triangulate ()
 Triangulate the points into a tin. More...
 

Private Member Functions

void UpdateAreaTolerance ()
 calculates the area tolerance
 

Private Attributes

const VecPt3dm_pts
 The points.
 
int m_idx
 Current point index.
 
VecIntm_tris
 The triangles as 0-based indices into m_pts.
 
VecInt2dm_trisAdjToPts
 Triangles adjacent to points.
 
double m_areaTol
 tolerance for area to be greater than 0.0
 
BSHP< Observerm_observer
 Observer.
 

Detailed Description

Class to triangulate simple points.

Definition at line 25 of file TrTriangulatorPoints.h.

Constructor & Destructor Documentation

◆ TrTriangulatorPoints()

xms::TrTriangulatorPoints::TrTriangulatorPoints ( const VecPt3d a_pts,
VecInt a_tris,
VecInt2d a_trisAdjToPts = nullptr 
)

Triangulate Pt3ds returning triangles in a single 1D vector.

Parameters
a_ptsThe points to triangulate.
a_tris0-based indices into a_pts defining the triangles. Every three elements defines a triangle. Size of num triangles * 3.
a_trisAdjToPts0-based triangles adjacent to points. Size of a_pts. Optional - include if you want this info.

The point and edge order is shown in the following figure:

///          2
///         / \
///        /   \
///      2/     \1     Point and edge numbering and order
///      /       \
///     /         \
///    0-----0-----1
/// 
For example, the 0th point goes with the 0th edge and that edge
consists of points 0 and 1.
/// 10-        3-----------4
///   |       / \         / \
///   |      /   \   2   /   \
///   |     /     \     /     \
///   |    /   0   \   /   1   \
///   |   /         \ /         \
///  0-  0-----------1-----------2
///
///      |-----|-----|-----|-----|
///      0     5    10    15    20
///
/// a_tris          =  3,0,1,  1,2,4,  1,4,3
/// a_trisAdjToPts  = [0][0,1,2][1][0,2][1,2]
/// 

Definition at line 87 of file TrTriangulatorPoints.cpp.

References UpdateAreaTolerance().

Member Function Documentation

◆ GetID()

int xms::TrTriangulatorPoints::GetID ( ) const
overridevirtual

Return the current point index (0-based).

Returns
The current point index.

Definition at line 117 of file TrTriangulatorPoints.cpp.

References m_idx.

◆ GetLocation()

Pt3d xms::TrTriangulatorPoints::GetLocation ( ) const
overridevirtual

Get location of current point.

Returns
Location of current point.

Definition at line 125 of file TrTriangulatorPoints.cpp.

References m_idx, and m_pts.

◆ GetNPoints()

int xms::TrTriangulatorPoints::GetNPoints ( ) const
overridevirtual

Return the number of points to be triangulated.

Returns
Number of points to be triangulated.

Definition at line 133 of file TrTriangulatorPoints.cpp.

References m_pts.

◆ ReceiveTriangle()

void xms::TrTriangulatorPoints::ReceiveTriangle ( int  a_id1,
int  a_id2,
int  a_id3 
)
overridevirtual

Receive a triangle consisting of the 3 points.

Parameters
[in]a_id1First point of triangle.
[in]a_id2Second point of triangle.
[in]a_id3Third point of triangle.

Definition at line 171 of file TrTriangulatorPoints.cpp.

References xms::gmColinearWithTol(), m_areaTol, m_pts, m_tris, m_trisAdjToPts, and xms::trArea().

◆ SetObserver()

void xms::TrTriangulatorPoints::SetObserver ( BSHP< Observer a_)
virtual

Set the observer to use for feedback while processing.

Parameters
a_The observer.

Definition at line 109 of file TrTriangulatorPoints.cpp.

References m_observer.


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