Represents a triangle in a triangulation.
More...
#include <Triangle2.h>
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
◆ 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()
Returns the circumcenter (the center of the circumcircle) of the current triangle.
- Parameters
-
[out] | ccq | Indicates the quality of the computed circumcenter and is one of CCQ_INEXACT, CCQ_EXACT, and CCQ_OUT_OF_BOUNDS. |
[in] | bForceExact | If 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
-
idx | The 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,p2 | Pointers 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,p1 | Two 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
-
pCorner | A 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
-
pNeig | A 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
-
idx | The 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
-
idx | The 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
-
- 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
-
q | The 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
-
pVtx | A pointer to a Point2 object to search for |
- Returns
true
if pVtx
is a corner of the current Triangle2, false
otherwise.
◆ setProperties()
Sets the three corner points. This method is mostly for internal use.
- Parameters
-
pI,pJ,pK | The 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
-
idx | The intra-triangle index (0, 1, or 2). |
pVtx | A pointer to a Point2 object |
◆ operator<<
CLASS_DECLSPEC friend std::ostream& operator<< |
( |
std::ostream & |
stream, |
|
|
const Triangle2 & |
c |
|
) |
| |
|
friend |
Prints a Triangle2 object to an output stream.
- Parameters
-
stream | The output stream to which the Triangle2 object is written. |
c | The 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: