Geom Software - C++ Programming and Geometry Libraries

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]

## Friends

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.
TriangleAroundVertexIterator to find out how to access all triangles incident to a certain vertex.

inline

## ◆ getArea25D()

Returns the 2.5D area of the triangle.

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

## ◆ getArea2D()

Returns the 2D area of the triangle.

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

## ◆ getBarycenter()

Returns
the barycenter of the triangle.

## ◆ getCorner()

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

## ◆ getDual()

Returns
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.
Note
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
Returns
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()

Returns
the interior 2D angle at the ith vertex

## ◆ getIntraTriangleIndex() [1/3]

 int GEOM_FADE25D::Triangle2::getIntraTriangleIndex ( const Point2 * p ) const
inline
Figure 4: Intra triangle index of a vertex pointer
Parameters
 p is a pointer to a vertex in *this
Returns
the intra-triangle-index 0,1 or 2 of p in *this

## ◆ getIntraTriangleIndex() [2/3]

 int GEOM_FADE25D::Triangle2::getIntraTriangleIndex ( const Triangle2 * pTriangle ) const
inline
Figure 5: pTriangle is the 0-th neighbor of *this
Parameters
 pTriangle is a neighbor triangle of *this.
Returns
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
inline
Returns
the index of the edge (p0,p1) in the triangle

## ◆ getNormalVector()

Returns
the normalized normal vector

## ◆ getOppositeTriangle()

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

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

Figure 3: Neighbors of a triangle
Parameters
 ith is the intra-triangle-index of the opposite corner of *this
Returns
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
Returns
if `q` is exactly on the i-th edge

## ◆ hasVertex() [1/2]

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

## ◆ hasVertex() [2/2]

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

## ◆ setOppTriangle()

 void GEOM_FADE25D::Triangle2::setOppTriangle ( const int ith, Triangle2 * pTriangle )
inline
Figure 6: Make pTriangle the 0-th neighbor of *this
Parameters
 ith is the index of the corner of *this which does not touch pTriangle pTriangle is a pointer to the triangle which shares two corners with *this

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