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
67 aVertexPointer[0]=NULL;
68 aVertexPointer[1]=NULL;
69 aVertexPointer[2]=NULL;
70 aOppTriangles[0]=NULL;
71 aOppTriangles[1]=NULL;
72 aOppTriangles[2]=NULL;
90 Point2* getCorner(
const int ith)
const;
125 std::pair<Point2,bool> getDual(
bool bForceExact=
false)
const;
165 #if GEOM_PSEUDO3D==GEOM_TRUE
170 Vector2 getNormalVector()
const;
190 #if GEOM_PSEUDO3D==GEOM_TRUE
195 double getInteriorAngle25D(
int ith)
const;
217 #if GEOM_PSEUDO3D==GEOM_TRUE
225 double getArea25D()
const;
242 Triangle2* getOppositeTriangle(
const int ith)
const;
256 int getIntraTriangleIndex(
const Point2* p)
const;
269 int getIntraTriangleIndex(
const Triangle2* pTriangle)
const;
276 int getIntraTriangleIndex(
const Point2* p0,
const Point2* p1)
const;
297 double getSquaredEdgeLength(
int ith)
const;
299 #if GEOM_PSEUDO3D==GEOM_TRUE
304 double getSquaredEdgeLength25D(
int ith)
const;
320 void setOppTriangle(
const int ith,
Triangle2* pTriangle);
327 void clearProperties();
335 void setVertexPointer(
const int ith,
Point2* pp);
367 void getCommonOffset(
double& x,
double& y)
const;
373 friend inline void registerTriangles(
Triangle2* fromTriangle,
int ith,
Triangle2* toTriangle,
int jth);
376 double computeArea(
double l0,
double l1,
double l2)
const;
377 bool getCC_inexact(
double avgOffX,
double avgOffY,
Point2& cc)
const;
380 Point2* aVertexPointer[3];
386 inline bool checkRange(
int ith)
388 return (ith==0 || ith==1 || ith==2);
392 inline Triangle2* Triangle2::getOppositeTriangle(
const int ith)
const
394 assert(checkRange(ith));
395 return aOppTriangles[ith];
398 inline void Triangle2::setOppTriangle(
const int ith,
Triangle2* pNeig)
400 assert(checkRange(ith));
401 aOppTriangles[ith]=pNeig;
405 inline int Triangle2::getIntraTriangleIndex(
const Point2* p0,
const Point2* p1)
const
412 if( aVertexPointer[ici1]==p0 && aVertexPointer[ici2]==p1)
return i;
413 if( aVertexPointer[ici1]==p1 && aVertexPointer[ici2]==p0)
return i;
416 std::cout<<
"BUG: Triangle2::getIntraTriangleIndex failed for"<<std::endl;
417 std::cout<<*p0<<std::endl;
418 std::cout<<*p1<<std::endl;
419 std::cout<<*
this<<std::endl;
424 inline int Triangle2::getIntraTriangleIndex(
const Point2* pVtx)
const
430 if(aVertexPointer[i]==pVtx)
437 return ( (aVertexPointer[1]==pVtx) + 2*(aVertexPointer[2]==pVtx));
441 inline int Triangle2::getIntraTriangleIndex(
const Triangle2* pTriangle)
const
447 if(aOppTriangles[i]==pTriangle)
454 return ( (aOppTriangles[1]==pTriangle) + 2*(aOppTriangles[2]==pTriangle));
459 inline Point2* Triangle2::getCorner(
const int ith)
const
461 assert(checkRange(ith));
462 return aVertexPointer[ith];
467 p0=aVertexPointer[0];
468 p1=aVertexPointer[1];
469 p2=aVertexPointer[2];
472 inline void Triangle2::setVertexPointer(
const int ith,
Point2* pp)
474 aVertexPointer[ith]=pp;
479 assert((pI!=NULL && pJ!=NULL && pK!=NULL));
480 aVertexPointer[0]=pI;
481 aVertexPointer[1]=pJ;
482 aVertexPointer[2]=pK;
486 aOppTriangles[0]=NULL;
487 aOppTriangles[1]=NULL;
488 aOppTriangles[2]=NULL;
491 inline void Triangle2::clearProperties()
495 aVertexPointer[i]=NULL;
496 aOppTriangles[i]=NULL;
500 inline void Triangle2::setPropertiesAndOppT(
505 assert((pI!=NULL && pJ!=NULL && pK!=NULL));
506 aVertexPointer[0]=pI;
507 aVertexPointer[1]=pJ;
508 aVertexPointer[2]=pK;
512 aOppTriangles[0]=pNeig0;
513 aOppTriangles[1]=pNeig1;
514 aOppTriangles[2]=pNeig2;
520 assert(checkRange(ith));
521 assert(checkRange(jth));
523 pFromT->aOppTriangles[ith]=pToT;
524 pToT->aOppTriangles[jth]=pFromT;
std::ostream & operator<<(std::ostream &stream, const Bbox2 &pC)
Print the box.
Definition: Bbox2.h:492
CircumcenterQuality
CircumcenterQuality.
Definition: Triangle2.h:36
@ CCQ_INEXACT
Double precision computation, the result is accurate enough.
Definition: Triangle2.h:38
@ CCQ_OUT_OF_BOUNDS
Computation with multiple-precision arithmetic, but the result is not representable with double preci...
Definition: Triangle2.h:40
@ CCQ_INIT
Init value.
Definition: Triangle2.h:37
@ CCQ_EXACT
Computation with multiple-precision arithmetic, the result is exact (apart from tiny quantization err...
Definition: Triangle2.h:39
Point.
Definition: Point2.h:43
void setIncidentTriangle(Triangle2 *pT)
Associate a triangle with the point.
Definition: Point2.h:484
Triangle.
Definition: Triangle2.h:60
Point2 getCircumcenter(CircumcenterQuality &ccq, bool bForceExact=false) const
Get the circumcenter of the triangle.
double getSquaredEdgeLength2D(int ith) const
**
bool hasVertex(const Point2 *pVtx) const
Has vertex.
bool hasVertex(const Point2 &vtx) const
Has vertex.
double getInteriorAngle2D(int ith) const
Get interior 2D angle.
double getArea2D() const
Get 2D Area.
int getMinIndex() const
Get the index of the smallest edge.
Triangle2()
Constructor.
Definition: Triangle2.h:65
int getMaxIndex() const
Get the index of the largest edge.
Point2 getBarycenter() const
Get the barycenter of a triangle.
bool hasOnEdge(int i, const Point2 &q) const
Has point on edge.
double getMaxSqEdgeLen2D() const
Get the maximum squared 2D edge length.
Vector.
Definition: Vector2.h:42