25 #if GEOM_PSEUDO3D==GEOM_TRUE
26 namespace GEOM_FADE25D {
27 #elif GEOM_PSEUDO3D==GEOM_FALSE
28 namespace GEOM_FADE2D {
30 #error GEOM_PSEUDO3D is not defined
64 aVertexPointer[0]=NULL;
65 aVertexPointer[1]=NULL;
66 aVertexPointer[2]=NULL;
67 aOppTriangles[0]=NULL;
68 aOppTriangles[1]=NULL;
69 aOppTriangles[2]=NULL;
83 Point2* getCorner(
const int idx)
const;
96 std::pair<Point2,bool> getDual(
bool bForceExact=
false)
const;
136 #if GEOM_PSEUDO3D==GEOM_TRUE
162 #if GEOM_PSEUDO3D==GEOM_TRUE
187 #if GEOM_PSEUDO3D==GEOM_TRUE
209 Triangle2* getOppositeTriangle(
const int idx)
const;
224 int getIntraTriangleIndex(
const Point2* pCorner)
const;
238 int getIntraTriangleIndex(
const Triangle2* pNeig)
const;
254 int getIntraTriangleIndex(
const Point2* p0,
const Point2* p1)
const;
271 double getSquaredEdgeLength(
int idx)
const;
273 #if GEOM_PSEUDO3D==GEOM_TRUE
289 void setOppTriangle(
const int idx,
Triangle2* pTriangle);
299 void clearProperties();
311 void setVertexPointer(
const int idx,
Point2* pVtx);
385 void getCommonOffset(
double& x,
double& y)
const;
398 friend inline void registerTriangles(
Triangle2* fromTriangle,
int ith,
Triangle2* toTriangle,
int jth);
402 double computeArea(
double l0,
double l1,
double l2)
const;
404 bool getCC_inexact(
double avgOffX,
double avgOffY,
Point2& cc)
const;
406 Point2* aVertexPointer[3];
414 inline bool checkRange(
int ith)
416 return (ith==0 || ith==1 || ith==2);
422 assert(checkRange(ith));
423 return aOppTriangles[ith];
426 inline void Triangle2::setOppTriangle(
const int ith,
Triangle2* pNeig)
428 assert(checkRange(ith));
429 aOppTriangles[ith]=pNeig;
439 if( (aVertexPointer[ici1]==p0 && aVertexPointer[ici2]==p1) ||
440 (aVertexPointer[ici1]==p1 && aVertexPointer[ici2]==p0) )
return i;
443 GCOUT<<
"BUG: Triangle2::getIntraTriangleIndex failed for"<<std::endl;
444 GCOUT<<*p0<<std::endl;
445 GCOUT<<*p1<<std::endl;
446 GCOUT<<*
this<<std::endl;
456 if(aVertexPointer[i]==pVtx)
463 return ( (aVertexPointer[1]==pVtx) + 2*(aVertexPointer[2]==pVtx));
473 if(aOppTriangles[i]==pTriangle)
480 return ( (aOppTriangles[1]==pTriangle) + 2*(aOppTriangles[2]==pTriangle));
487 assert(checkRange(ith));
488 return aVertexPointer[ith];
493 p0=aVertexPointer[0];
494 p1=aVertexPointer[1];
495 p2=aVertexPointer[2];
500 aVertexPointer[ith]=pp;
505 assert((pI!=NULL && pJ!=NULL && pK!=NULL));
506 aVertexPointer[0]=pI;
507 aVertexPointer[1]=pJ;
508 aVertexPointer[2]=pK;
509 pI->setIncidentTriangle(
this);
510 pJ->setIncidentTriangle(
this);
511 pK->setIncidentTriangle(
this);
512 aOppTriangles[0]=NULL;
513 aOppTriangles[1]=NULL;
514 aOppTriangles[2]=NULL;
517 inline void Triangle2::clearProperties()
521 aVertexPointer[i]=NULL;
522 aOppTriangles[i]=NULL;
526 inline void Triangle2::setPropertiesAndOppT(
527 Point2* pI, Point2* pJ, Point2* pK,
528 Triangle2* pNeig0,Triangle2* pNeig1,Triangle2* pNeig2
531 assert((pI!=NULL && pJ!=NULL && pK!=NULL));
532 aVertexPointer[0]=pI;
533 aVertexPointer[1]=pJ;
534 aVertexPointer[2]=pK;
535 pI->setIncidentTriangle(
this);
536 pJ->setIncidentTriangle(
this);
537 pK->setIncidentTriangle(
this);
538 aOppTriangles[0]=pNeig0;
539 aOppTriangles[1]=pNeig1;
540 aOppTriangles[2]=pNeig2;
544 inline void registerTriangles(Triangle2* pFromT,
int ith,Triangle2* pToT,
int jth)
546 assert(checkRange(ith));
547 assert(checkRange(jth));
549 pFromT->aOppTriangles[ith]=pToT;
550 pToT->aOppTriangles[jth]=pFromT;
CircumcenterQuality
Enumeration for the quality of the circumcenter computation.
Definition: Triangle2.h:35
@ CCQ_EXACT
Computation with multiple-precision arithmetic, the result is exact (apart from tiny quantization err...
Definition: Triangle2.h:38
@ CCQ_INEXACT
Double precision computation, the result is accurate enough.
Definition: Triangle2.h:37
@ CCQ_OUT_OF_BOUNDS
Computation with multiple-precision arithmetic, but the result is not representable with double preci...
Definition: Triangle2.h:39
@ CCQ_INIT
Init value.
Definition: Triangle2.h:36
Represents a 2.5D point.
Definition: Point2.h:76
Represents a triangle in a triangulation.
Definition: Triangle2.h:59
Triangle2()
Default constructor.
Definition: Triangle2.h:62
Point2 * getCorner(const int idx) const
Retrieves the specified corner of the triangle.
Definition: Triangle2.h:485
CLASS_DECLSPEC friend std::ostream & operator<<(std::ostream &stream, const Triangle2 &c)
Output operator for Triangle2.
bool hasOnEdge(int idx, const Point2 &q) const
Check if an edge includes the specified point.
Point2 getCircumcenter(CircumcenterQuality &ccq, bool bForceExact=false) const
Get the circumcenter of the triangle.
int getMinIndex() const
Get the index of the smallest edge.
Triangle2 * getOppositeTriangle(const int idx) const
Get the neighbor triangle at the specified index.
Definition: Triangle2.h:420
void setVertexPointer(const int idx, Point2 *pVtx)
Set a corner.
Definition: Triangle2.h:498
double getSquaredEdgeLength25D(int idx) const
Get the squared 2.5D length of the specified edge.
Vector2 getNormalVector() const
Get the normal vector of the triangle.
double getInteriorAngle2D(int idx) const
Get interior 2D angle.
int getIntraTriangleIndex(const Point2 *pCorner) const
Get the index of the specified corner.
Definition: Triangle2.h:451
int getMaxIndex() const
Get the index of the largest edge.
bool hasVertex(const Point2 &q) const
Check if the specified point coincides with a corner of the triangle.
double getArea25D() const
Get the 2.5D area of the triangle.
double getInteriorAngle25D(int idx) const
Get the interior 2.5D angle.
void getCorners(Point2 *&p0, Point2 *&p1, Point2 *&p2) const
Retrieves all three triangle corners.
Definition: Triangle2.h:491
bool hasOn(const Point2 &q) const
Check if the triangle includes the specified point.
double getSquaredEdgeLength2D(int idx) const
Get the squared 2D length of the specified edge.
Point2 getBarycenter() const
Get the barycenter of the triangle.
double getArea2D() const
Get the 2D area of the triangle.
double getMaxSqEdgeLen2D() const
Get the maximum squared 2D edge length.
bool hasVertex(const Point2 *pVtx) const
Check if the specified vertex is a corner of the triangle.
void setProperties(Point2 *pI, Point2 *pJ, Point2 *pK)
Set all corners.
Definition: Triangle2.h:503
Vector.
Definition: Vector2.h:47