xmsgrid
1.0
|
Class to triangulate simple points. More...
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 VecPt3d & | m_pts |
The points. | |
int | m_idx |
Current point index. | |
VecInt & | m_tris |
The triangles as 0-based indices into m_pts. | |
VecInt2d * | m_trisAdjToPts |
Triangles adjacent to points. | |
double | m_areaTol |
tolerance for area to be greater than 0.0 | |
BSHP< Observer > | m_observer |
Observer. | |
Class to triangulate simple points.
Definition at line 25 of file TrTriangulatorPoints.h.
xms::TrTriangulatorPoints::TrTriangulatorPoints | ( | const VecPt3d & | a_pts, |
VecInt & | a_tris, | ||
VecInt2d * | a_trisAdjToPts = nullptr |
||
) |
Triangulate Pt3ds returning triangles in a single 1D vector.
a_pts | The points to triangulate. |
a_tris | 0-based indices into a_pts defining the triangles. Every three elements defines a triangle. Size of num triangles * 3. |
a_trisAdjToPts | 0-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().
|
overridevirtual |
Return the current point index (0-based).
Definition at line 117 of file TrTriangulatorPoints.cpp.
References m_idx.
|
overridevirtual |
Get location of current point.
Definition at line 125 of file TrTriangulatorPoints.cpp.
|
overridevirtual |
Return the number of points to be triangulated.
Definition at line 133 of file TrTriangulatorPoints.cpp.
References m_pts.
|
overridevirtual |
Receive a triangle consisting of the 3 points.
[in] | a_id1 | First point of triangle. |
[in] | a_id2 | Second point of triangle. |
[in] | a_id3 | Third 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().
Set the observer to use for feedback while processing.
a_ | The observer. |
Definition at line 109 of file TrTriangulatorPoints.cpp.
References m_observer.