Geom Software - C++ Programming and Geometry Libraries
Fade2.5D Documentation pages v1.74
GEOM_FADE25D::Triangle2 Class Reference

Triangle. More...

#include <Triangle2.h>

Public Member Functions

 Triangle2 ()
 Constructor. More...
Point2getCorner (const int ith) const
 Get the i-th corner of the triangle. More...
std::pair< Point2, bool > getDual () const
 Get the dual Voronoi vertex. More...
Point2 getBarycenter () const
 Get the barycenter of a triangle. More...
Vector2 getNormalVector () const
 Get the normal vector of a triangle. More...
double getInteriorAngle2D (int ith) const
 Get interior 2D angle. More...
double getInteriorAngle25D (int ith) const
 Get interior 2.5D angle. More...
double getArea2D () const
 Get 2D Area. More...
double getArea25D () const
 Get 2.5D Area. More...
Triangle2getOppositeTriangle (const int ith) const
 Get the i-th neighbor triangle. More...
int getIntraTriangleIndex (const Point2 *p) const
 Get the index of p in the triangle. More...
int getIntraTriangleIndex (const Triangle2 *pTriangle) const
 Get the neighbor index of pTriangle. More...
int getIntraTriangleIndex (const Point2 *p0, const Point2 *p1) const
 Get the index of (p0,p1) More...
double getSquaredEdgeLength2D (int ith) const
 Method for internal use. More...
double getSquaredEdgeLength25D (int ith) const
 Squared edge length. 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 clearProperties ()
 Clear all corners and neighbor pointers.
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.
bool hasVertex (Point2 *pVtx) const
 Has vertex. More...
bool hasVertex (const Point2 &vtx) const
 Has vertex. More...
bool hasOnEdge (int i, const Point2 &q) const
 Has point on edge. More...
int getMaxIndex () const
 Get the index of the largest edge.
int getMinIndex () const
 Get the index of the smallest edge.
double getMaxSqEdgeLen2D () const
 Get the maximum squared 2D edge length.

Protected Member Functions

double computeArea (double l0, double l1, double l2) const
bool isAccurateCC (int maxIdx, const Point2 &cc) const
bool getCC_strategy1 (double avgOffX, double avgOffY, Point2 &cc) const
void getCC_strategy2 (int maxIdx, double avgOffX, double avgOffY, Point2 &cc) const
void getCommonOffset (double &x, double &y) const

Protected Attributes

Point2aVertexPointer [3]
Triangle2aOppTriangles [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.

Figure 1: 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.

Constructor & Destructor Documentation

◆ Triangle2()

GEOM_FADE25D::Triangle2::Triangle2 ( )

Member Function Documentation

◆ getArea25D()

double GEOM_FADE25D::Triangle2::getArea25D ( ) const

Returns the 2.5D area of the triangle.

Note: The getArea() method is deprecated and replaced by getArea2D() and getArea25D()

◆ getArea2D()

double GEOM_FADE25D::Triangle2::getArea2D ( ) const

Returns the 2D area of the triangle.

Note: The getArea() method is deprecated and replaced by getArea2D() and getArea25D()

◆ getBarycenter()

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

◆ getCorner()

Point2 * GEOM_FADE25D::Triangle2::getCorner ( const int  ith) const
a pointer to the i-th corner point of the triangle.
Figure 2: Intra triangle indices are ordered counterclockwise
ithis the intra-triangle-index, ith={0,1,2}.

◆ getDual()

std::pair<Point2,bool> GEOM_FADE25D::Triangle2::getDual ( ) const
a std::pair<Point2,bool>, where the first component is the dual Voronoi vertex of the triangle and the second component is a boolean value which is true if the vertex is accurate. The z-coordinate of the returned point is always 0. Use Fade_2D::getHeight(..) to determine the height value.
The true dual Voronoi vertex of an almost collinear Delaunay triangle can be outside the bounds of floating point arithmetic. In such cases this method returns a point with very large coordinates but still inside the range of double precision floating point arithmetic, and it will inform the user by setting the boolean return value to false.
Such cases can easily be avoided by insertion of four dummy vertices around the triangulation, e.g., at coordinates ten times larger than the domain of the data points. This will automatically restrict the Voronoi diagram of the data points to this range.

◆ getInteriorAngle25D()

double GEOM_FADE25D::Triangle2::getInteriorAngle25D ( int  ith) const
the interior 2.5D angle at the ith vertex

◆ getInteriorAngle2D()

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

Note: The getInteriorAngle() method is deprecated and replaced by getInteriorAngle2D() and getInteriorAngle25D()

the interior 2D angle at the ith vertex

◆ getIntraTriangleIndex() [1/3]

int GEOM_FADE25D::Triangle2::getIntraTriangleIndex ( const Point2 p) const
Figure 4: 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_FADE25D::Triangle2::getIntraTriangleIndex ( const Triangle2 pTriangle) const
Figure 5: 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.

◆ getIntraTriangleIndex() [3/3]

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

◆ getNormalVector()

Vector2 GEOM_FADE25D::Triangle2::getNormalVector ( ) const
the normalized normal vector

◆ getOppositeTriangle()

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

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

Figure 3: 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.

◆ getSquaredEdgeLength25D()

double GEOM_FADE25D::Triangle2::getSquaredEdgeLength25D ( int  ith) const

Returns the squared length of the ith edge.

◆ getSquaredEdgeLength2D()

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

Internal useSquared edge length

Returns the squared length of the ith edge. This method ignores the z-coordinate.

◆ hasOnEdge()

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

◆ hasVertex() [1/2]

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

◆ hasVertex() [2/2]

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

◆ setOppTriangle()

void GEOM_FADE25D::Triangle2::setOppTriangle ( const int  ith,
Triangle2 pTriangle 
Figure 6: 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: