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

Triangle. More...

#include <Triangle2.h>

Public Member Functions

 Triangle2 ()
void clearProperties ()
 Clear all corners and neighbor pointers.
double getArea2D () const
 Get 2D Area. More...
Point2 getBarycenter () const
 Get the barycenter of a triangle. More...
Point2 getCircumcenter (CircumcenterQuality &ccq, bool bForceExact=false) const
 Get the circumcenter of the triangle. More...
void getCorners (Point2 *&p0, Point2 *&p1, Point2 *&p2) const
 Get the 3 triangle corners.
std::pair< Point2, bool > getDual (bool bForceExact=false) const
double getInteriorAngle2D (int ith) const
 Get interior 2D angle. More...
int getIntraTriangleIndex (const Point2 *p) const
 Get the index of p in the triangle. More...
int getIntraTriangleIndex (const Point2 *p0, const Point2 *p1) const
 Get the index of (p0,p1) More...
int getIntraTriangleIndex (const Triangle2 *pTriangle) const
 Get the neighbor index of pTriangle. More...
int getMaxIndex () const
 Get the index of the largest edge.
double getMaxSqEdgeLen2D () const
 Get the maximum squared 2D edge length.
int getMinIndex () const
 Get the index of the smallest edge.
Triangle2getOppositeTriangle (const int ith) const
 Get the i-th neighbor triangle. More...
double getSquaredEdgeLength2D (int ith) const
 ‍** More...
bool hasOn (const Point2 &q) const
 Has on (triangle) More...
bool hasOnEdge (int i, const Point2 &q) const
 Has point on edge. More...
bool hasVertex (const Point2 &vtx) const
 Has vertex. More...
bool hasVertex (const Point2 *pVtx) const
 Has vertex. More...
void setOppTriangle (const int ith, Triangle2 *pTriangle)
 Set the i-th neighbor triangle. More...
void setProperties (Point2 *pI, Point2 *pJ, Point2 *pK)
 Set all corners.
void setPropertiesAndOppT (Point2 *pI, Point2 *pJ, Point2 *pK, Triangle2 *pNeig0, Triangle2 *pNeig1, Triangle2 *pNeig2)
 Set all corners and neighbor triangles.
void setVertexPointer (const int ith, Point2 *pp)
 Set the i-th corner.

Protected Member Functions

double computeArea (double l0, double l1, double l2) const
bool getCC_inexact (double avgOffX, double avgOffY, Point2 &cc) const

Protected Attributes

Triangle2aOppTriangles [3]
Point2aVertexPointer [3]


std::ostream & operator<< (std::ostream &stream, const Triangle2 &c)
void registerTriangles (Triangle2 *fromTriangle, int ith, Triangle2 *toTriangle, int jth)

Detailed Description

Triangle2 is a triangle in the Fade_2D triangulation. It holds three Point2 pointers to its corners. The corners are numbered in counterclockwise order. We refer to these indices as intra-triangle-indices.

Each triangle has three neighbors which can be accessed through intra-triangle-indices: The i-th neighbor triangle of a certain triangle T is the one which shares an edge with T such that this edge does not include the i-th corner of T.

Indices and neighborships, tb is the 0-th neighbor of ta and ta is the 2nd neighbor of tb.
See also
TriangleAroundVertexIterator to find out how to access all triangles incident to a certain vertex.

Member Function Documentation

◆ getArea2D()

double GEOM_FADE2D::Triangle2::getArea2D ( ) const

Returns the 2D area of the triangle.

Note: The getArea() method is deprecated and replaced by getArea2D() to keep the names consistent.

◆ getBarycenter()

Point2 GEOM_FADE2D::Triangle2::getBarycenter ( ) const
the barycenter of the triangle.

◆ getCircumcenter()

Point2 GEOM_FADE2D::Triangle2::getCircumcenter ( CircumcenterQuality ccq,
bool  bForceExact = false 
) const
[out]ccqreturns the quality of the computed point and is one of CCQ_INEXACT, CCQ_EXACT and CCQ_OUT_OF_BOUNDS.
[in]bForceExactforces exact computation with multiple-precision arithmetic. When bForceExact=false, then the faster double-precision arithmetic is used for good shaped triangles.
the circumcenter of the triangle
Attention: The circumcenter of a nearly collinear triangle can have extremely large coordinates. Fade computes the circumcenter with multiple-precision artihmetic in this case but the result might nevertheless not be exact because it too large for double-precision coordinates. In such cases a finite point is returned and ccq returns CCQ_OUT_OF_BOUNDS. You can avoid such extreme numeric cases easily: Just insert four dummy vertices around the triangulation at coordinates 10 times larger than the domain of the data points because this restricts the Voronoi cells of the data points to this range.

◆ getInteriorAngle2D()

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

Note: The getArea() method is deprecated and replaced by getInteriorAngle2D() to keep the names consistent.

the interior 2D angle at the ith vertex

◆ getIntraTriangleIndex() [1/3]

int GEOM_FADE2D::Triangle2::getIntraTriangleIndex ( const Point2 p) const
Intra triangle index of a vertex pointer
pis a pointer to a vertex in *this
the intra-triangle-index 0,1 or 2 of p in *this

◆ getIntraTriangleIndex() [2/3]

int GEOM_FADE2D::Triangle2::getIntraTriangleIndex ( const Point2 p0,
const Point2 p1 
) const
the index of the edge (p0,p1) in the triangle

◆ getIntraTriangleIndex() [3/3]

int GEOM_FADE2D::Triangle2::getIntraTriangleIndex ( const Triangle2 pTriangle) const
pTriangle is the 0-th neighbor of *this
pTriangleis a neighbor triangle of *this.
the intra-triangle-index of the vertex in *this which is opposite (i.e., does not touch the neighbor) pTriangle.

◆ getOppositeTriangle()

Triangle2 * GEOM_FADE2D::Triangle2::getOppositeTriangle ( const int  ith) const

Returns the i-th neighbor triangle, i.e. the one opposite to the i-th corner.

Neighbors of a triangle
ithis the intra-triangle-index of the opposite corner of *this
the i-th neighbor triangle, i.e. the one opposite to the i-th vertex or NULL if no neighbor triangle exists which is the case at the convex hull edges of the triangulation.

◆ getSquaredEdgeLength2D()

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

Method for internal use

Squared edge length

Returns the squared length of the ith edge.

◆ hasOn()

bool GEOM_FADE2D::Triangle2::hasOn ( const Point2 q) const
if q is on the triangle

◆ hasOnEdge()

bool GEOM_FADE2D::Triangle2::hasOnEdge ( int  i,
const Point2 q 
) const
if q is exactly on the i-th edge

◆ hasVertex() [1/2]

bool GEOM_FADE2D::Triangle2::hasVertex ( const Point2 vtx) const
if vtx is a corner of the triangle

◆ hasVertex() [2/2]

bool GEOM_FADE2D::Triangle2::hasVertex ( const Point2 pVtx) const
if pVtx is a corner of the triangle

◆ setOppTriangle()

void GEOM_FADE2D::Triangle2::setOppTriangle ( const int  ith,
Triangle2 pTriangle 
Make pTriangle the 0-th neighbor of *this
ithis the index of the corner of *this which does not touch pTriangle
pTriangleis a pointer to the triangle which shares two corners with *this

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