Fade2D Documentation pages v2.16.7
Delaunay Features
GEOM_FADE2D::Triangle2 Class Reference

Represents a triangle in a triangulation. More...

#include <Triangle2.h>

Public Member Functions

 Triangle2 ()
 Default constructor.
 
double getArea2D () const
 Get the 2D area of the triangle. More...
 
Point2 getBarycenter () const
 Get the barycenter of the triangle. More...
 
Point2 getCircumcenter (CircumcenterQuality &ccq, bool bForceExact=false) const
 Get the circumcenter of the triangle. More...
 
Point2getCorner (const int idx) const
 Retrieves the specified corner of the triangle. More...
 
void getCorners (Point2 *&p0, Point2 *&p1, Point2 *&p2) const
 Retrieves all three triangle corners. More...
 
double getInteriorAngle2D (int idx) const
 Get interior 2D angle. More...
 
int getIntraTriangleIndex (const Point2 *p0, const Point2 *p1) const
 Get the index of the specified edge. More...
 
int getIntraTriangleIndex (const Point2 *pCorner) const
 Get the index of the specified corner. More...
 
int getIntraTriangleIndex (const Triangle2 *pNeig) const
 Get the index of the specified neighbor triangle. More...
 
int getMaxIndex () const
 Get the index of the largest edge. More...
 
double getMaxSqEdgeLen2D () const
 Get the maximum squared 2D edge length. More...
 
int getMinIndex () const
 Get the index of the smallest edge. More...
 
Triangle2getOppositeTriangle (const int idx) const
 Get the neighbor triangle at the specified index. More...
 
double getSquaredEdgeLength2D (int idx) const
 Get the squared 2D length of the specified edge. More...
 
bool hasOn (const Point2 &q) const
 Check if the triangle includes the specified point. More...
 
bool hasOnEdge (int idx, const Point2 &q) const
 Check if an edge includes the specified point. More...
 
bool hasVertex (const Point2 &q) const
 Check if the specified point coincides with a corner of the triangle. More...
 
bool hasVertex (const Point2 *pVtx) const
 Check if the specified vertex is a corner of the triangle. More...
 
void setProperties (Point2 *pI, Point2 *pJ, Point2 *pK)
 Set all corners. More...
 
void setVertexPointer (const int idx, Point2 *pVtx)
 Set a corner. More...
 

Friends

CLASS_DECLSPEC friend std::ostream & operator<< (std::ostream &stream, const Triangle2 &c)
 Output operator for Triangle2. More...
 
void registerTriangles (Triangle2 *fromTriangle, int ith, Triangle2 *toTriangle, int jth)
 

Detailed Description

Triangle2 represents a triangle in a Fade_2D triangulation.

Details:

  • A Triangle2 contains three pointers to its corners, each represented by a Point2. The corners are counterclockwise ordered and can be retrieved using the intra-triangle indices 0, 1 and 2.
  • A Triangle2 contains three pointers to its neighbor-triangles which are also retrieved through the intra-triangle indices. The i-th neighbor triangle is the one opposite to the i-th corner.
Triangle2: The corners are counterclockwise; the i-th neighbor triangle is the one opposite to the i-th corner of a triangle
See also
A C++ example about accessing and drawing elements of a triangulation

Member Function Documentation

◆ getArea2D()

double GEOM_FADE2D::Triangle2::getArea2D ( ) const

Computes the 2D area of the current triangle.

Returns
The area of the current triangle in 2D.
Note
This method ignores the z-coordinate.

◆ getBarycenter()

Point2 GEOM_FADE2D::Triangle2::getBarycenter ( ) const

Computes and returns the barycenter the this triangle.

Returns
The barycenter of the current triangle.

◆ getCircumcenter()

Point2 GEOM_FADE2D::Triangle2::getCircumcenter ( CircumcenterQuality ccq,
bool  bForceExact = false 
) const

Returns the circumcenter (the center of the circumcircle) of the current triangle.

Parameters
[out]ccqIndicates the quality of the computed circumcenter and is one of CCQ_INEXACT, CCQ_EXACT, and CCQ_OUT_OF_BOUNDS.
[in]bForceExactIf true, forces exact computation with multiple-precision arithmetic.
Returns
The circumcenter of the Triangle2.
Attention
The circumcenter of a nearly collinear triangle has extremely large coordinates. While multiple-precision arithmetic is used for such cases, the result might still exceed the precision limits of double-precision arithmetic. In such scenarios, a finite point is returned, and ccq is set to CCQ_OUT_OF_BOUNDS. To avoid these cases, insert four dummy vertices around the triangulation at coordinates 10 times larger than the domain of the data points. This restricts the Voronoi cells to a manageable range.

◆ getCorner()

Point2 * GEOM_FADE2D::Triangle2::getCorner ( const int  idx) const
inline

Retrieves a Point2* corresponding to the triangle corner specified by the intra-triangle index idx.

The counterclockwise ordering of intra-triangle indices for the corners of a triangle
Parameters
idxThe intra-triangle index of the corner (0, 1, or 2).
Returns
A pointer to the corner at index idx of the triangle.

◆ getCorners()

void GEOM_FADE2D::Triangle2::getCorners ( Point2 *&  p0,
Point2 *&  p1,
Point2 *&  p2 
) const
inline

Retrieves the three corners of the Triangle2.

Parameters
[out]p0,p1,p2Pointers to the three corners

◆ getInteriorAngle2D()

double GEOM_FADE2D::Triangle2::getInteriorAngle2D ( int  idx) const

Returns the interior 2D angle at the vertex specified by the intra-triangle index idx.

Returns
The interior 2D angle at the vertex at the intra-triangle index idx

◆ getIntraTriangleIndex() [1/3]

int GEOM_FADE2D::Triangle2::getIntraTriangleIndex ( const Point2 p0,
const Point2 p1 
) const
inline

Retrieves the intra-triangle index of the edge defined by (p0,p1) in the current triangle.

Example: The edge defined by the vertex pair (p0, p1) corresponds to the intra-triangle index 0.
Parameters
p0,p1Two corners specifying an edge of the current triangle. The order of p0 and p1 does not matter.
Returns
The intra-triangle index of the edge (p0, p1) in the current triangle. This index corresponds to the intra-triangle index of the vertex opposite to this edge.

◆ getIntraTriangleIndex() [2/3]

int GEOM_FADE2D::Triangle2::getIntraTriangleIndex ( const Point2 pCorner) const
inline

Retrieves the index of the triangle corner pCorner.

The intra-triangle index of pCorner is 1.
Parameters
pCornerA pointer to a corner in the current triangle.
Returns
The intra-triangle index (0,1 or 2) of pCorner in the current triangle.

◆ getIntraTriangleIndex() [3/3]

int GEOM_FADE2D::Triangle2::getIntraTriangleIndex ( const Triangle2 pNeig) const
inline

Retrieves the intra-triangle index of the neighbor triangle pNeig.

The intra-triangle index of pNeig in the current triangle is 0.
Parameters
pNeigA neighbor triangle of the current triangle.
Returns
The intra-triangle index of the triangle pNeig in the current triangle. This index corresponds to the intra-triangle index of the vertex opposite to pNeig in the current triangle.

◆ getMaxIndex()

int GEOM_FADE2D::Triangle2::getMaxIndex ( ) const

Returns the index of edge with the largest 2D length.

Returns
The index of the edge with the largest 2D length.

◆ getMaxSqEdgeLen2D()

double GEOM_FADE2D::Triangle2::getMaxSqEdgeLen2D ( ) const

Computes and returns the largest squared 2D edge length among the triangle's edges.

Returns
the largest squared 2D edge length.

◆ getMinIndex()

int GEOM_FADE2D::Triangle2::getMinIndex ( ) const

Returns the intra-triangle index of the edge with the smallest 2D length.

Returns
The intra-triangle index of the edge with the smallest 2D length.

◆ getOppositeTriangle()

Triangle2 * GEOM_FADE2D::Triangle2::getOppositeTriangle ( const int  idx) const
inline

Retrieves the neighbor triangle opposite to the corner at the specified intra-triangle index idx.

Neighbor triangles: The i-th neighbor triangle is the one opposite to the i-th corner of a triangle
Parameters
idxThe intra-triangle index specifying the opposite corner (0, 1 or 2)
Returns
The neighbor triangle at index idx, if any; NULL otherwise.

◆ getSquaredEdgeLength2D()

double GEOM_FADE2D::Triangle2::getSquaredEdgeLength2D ( int  idx) const

Computes the squared 2D length of the edge at index idx.

Parameters
idxThe index of the edge for which the squared length is computed.
Returns
The squared 2D length of the edge at index idx.

◆ hasOn()

bool GEOM_FADE2D::Triangle2::hasOn ( const Point2 q) const

Checks if the specified point q is on the current triangle.

Parameters
qThe point to test.
Returns
true if q lies on the current triangle, false otherwise.

◆ hasOnEdge()

bool GEOM_FADE2D::Triangle2::hasOnEdge ( int  idx,
const Point2 q 
) const

Checks if the specified point q lies exactly on the edge at index idx of the current triangle.

Returns
true if the point q lies exactly on the edge at index idx, false otherwise.

◆ hasVertex() [1/2]

bool GEOM_FADE2D::Triangle2::hasVertex ( const Point2 q) const

Checks if the specified point q coincides with any corner of the current triangle.

Parameters
qThe Point2 object to search for.
Returns
true if q coincides with a corner of the current Triangle2, false otherwise.

◆ hasVertex() [2/2]

bool GEOM_FADE2D::Triangle2::hasVertex ( const Point2 pVtx) const

Checks if the specified vertex pVtx is a corner of the current triangle.

Parameters
pVtxA pointer to a Point2 object to search for
Returns
true if pVtx is a corner of the current Triangle2, false otherwise.

◆ setProperties()

void GEOM_FADE2D::Triangle2::setProperties ( Point2 pI,
Point2 pJ,
Point2 pK 
)
inline

Sets the three corner points. This method is mostly for internal use.

Parameters
pI,pJ,pKThe corners to be assigned.

◆ setVertexPointer()

void GEOM_FADE2D::Triangle2::setVertexPointer ( const int  idx,
Point2 pVtx 
)
inline

Sets the corner at the intra-triangle index idx. This method is mostly for internal use.

Parameters
idxThe intra-triangle index (0, 1, or 2).
pVtxA pointer to a Point2 object

Friends And Related Function Documentation

◆ operator<<

CLASS_DECLSPEC friend std::ostream& operator<< ( std::ostream &  stream,
const Triangle2 c 
)
friend

Prints a Triangle2 object to an output stream.

Parameters
streamThe output stream to which the Triangle2 object is written.
cThe Triangle2 object to be written to the stream.
Returns
A reference to the output stream after writing the Triangle2 object.

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