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
190 #if GEOM_PSEUDO3D==GEOM_TRUE
217 #if GEOM_PSEUDO3D==GEOM_TRUE
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
320 void setOppTriangle(
const int ith,
Triangle2* pTriangle);
327 void clearProperties();
335 void setVertexPointer(
const int ith,
Point2* pp);
382 void getCommonOffset(
double& x,
double& y)
const;
386 friend std::ostream &operator<<(std::ostream &stream,
const Triangle2& c);
388 friend inline void registerTriangles(
Triangle2* fromTriangle,
int ith,
Triangle2* toTriangle,
int jth);
391 double computeArea(
double l0,
double l1,
double l2)
const;
392 bool getCC_inexact(
double avgOffX,
double avgOffY,
Point2& cc)
const;
395 Point2* aVertexPointer[3];
401 inline bool checkRange(
int ith)
403 return (ith==0 || ith==1 || ith==2);
409 assert(checkRange(ith));
410 return aOppTriangles[ith];
415 assert(checkRange(ith));
416 aOppTriangles[ith]=pNeig;
427 if( aVertexPointer[ici1]==p0 && aVertexPointer[ici2]==p1)
return i;
428 if( aVertexPointer[ici1]==p1 && aVertexPointer[ici2]==p0)
return i;
431 std::cout<<
"BUG: Triangle2::getIntraTriangleIndex failed for"<<std::endl;
432 std::cout<<*p0<<std::endl;
433 std::cout<<*p1<<std::endl;
434 std::cout<<*
this<<std::endl;
445 if(aVertexPointer[i]==pVtx)
452 return ( (aVertexPointer[1]==pVtx) + 2*(aVertexPointer[2]==pVtx));
462 if(aOppTriangles[i]==pTriangle)
469 return ( (aOppTriangles[1]==pTriangle) + 2*(aOppTriangles[2]==pTriangle));
474 inline Point2* Triangle2::getCorner(
const int ith)
const
476 assert(checkRange(ith));
477 return aVertexPointer[ith];
482 p0=aVertexPointer[0];
483 p1=aVertexPointer[1];
484 p2=aVertexPointer[2];
489 aVertexPointer[ith]=pp;
494 assert((pI!=NULL && pJ!=NULL && pK!=NULL));
495 aVertexPointer[0]=pI;
496 aVertexPointer[1]=pJ;
497 aVertexPointer[2]=pK;
501 aOppTriangles[0]=NULL;
502 aOppTriangles[1]=NULL;
503 aOppTriangles[2]=NULL;
510 aVertexPointer[i]=NULL;
511 aOppTriangles[i]=NULL;
520 assert((pI!=NULL && pJ!=NULL && pK!=NULL));
521 aVertexPointer[0]=pI;
522 aVertexPointer[1]=pJ;
523 aVertexPointer[2]=pK;
527 aOppTriangles[0]=pNeig0;
528 aOppTriangles[1]=pNeig1;
529 aOppTriangles[2]=pNeig2;
535 assert(checkRange(ith));
536 assert(checkRange(jth));
538 pFromT->aOppTriangles[ith]=pToT;
539 pToT->aOppTriangles[jth]=pFromT;
CircumcenterQuality
CircumcenterQuality.
Definition: Triangle2.h:36
@ CCQ_EXACT
Computation with multiple-precision arithmetic, the result is exact (apart from tiny quantization err...
Definition: Triangle2.h:39
@ 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
Point.
Definition: Point2.h:53
void setIncidentTriangle(Triangle2 *pT)
Associate a triangle with the point.
Definition: Point2.h:487
Triangle.
Definition: Triangle2.h:60
Triangle2()
Constructor.
Definition: Triangle2.h:65
Point2 getCircumcenter(CircumcenterQuality &ccq, bool bForceExact=false) const
Get the circumcenter of the triangle.
int getMinIndex() const
Get the index of the smallest edge.
void setPropertiesAndOppT(Point2 *pI, Point2 *pJ, Point2 *pK, Triangle2 *pNeig0, Triangle2 *pNeig1, Triangle2 *pNeig2)
Set all corners and neighbor triangles.
Definition: Triangle2.h:515
Vector2 getNormalVector() const
Get the normal vector of a triangle.
double getSquaredEdgeLength25D(int ith) const
Squared edge length.
int getIntraTriangleIndex(const Point2 *p) const
Get the index of p in the triangle.
Definition: Triangle2.h:439
int getMaxIndex() const
Get the index of the largest edge.
void setOppTriangle(const int ith, Triangle2 *pTriangle)
Set the i-th neighbor triangle.
Definition: Triangle2.h:413
double getArea25D() const
Get 2.5D Area.
void getCorners(Point2 *&p0, Point2 *&p1, Point2 *&p2) const
Get the 3 triangle corners.
Definition: Triangle2.h:480
void setVertexPointer(const int ith, Point2 *pp)
Set the i-th corner.
Definition: Triangle2.h:487
bool hasOnEdge(int i, const Point2 &q) const
Has point on edge.
bool hasOn(const Point2 &q) const
Has on (triangle)
Triangle2 * getOppositeTriangle(const int ith) const
Get the i-th neighbor triangle.
Definition: Triangle2.h:407
bool hasVertex(const Point2 &vtx) const
Has vertex.
double getInteriorAngle25D(int ith) const
Get interior 2.5D angle.
Point2 getBarycenter() const
Get the barycenter of a triangle.
double getArea2D() const
Get 2D Area.
void clearProperties()
Clear all corners and neighbor pointers.
Definition: Triangle2.h:506
double getInteriorAngle2D(int ith) const
Get interior 2D angle.
double getMaxSqEdgeLen2D() const
Get the maximum squared 2D edge length.
double getSquaredEdgeLength2D(int ith) const
**
bool hasVertex(const Point2 *pVtx) const
Has vertex.
void setProperties(Point2 *pI, Point2 *pJ, Point2 *pK)
Set all corners.
Definition: Triangle2.h:492
Vector.
Definition: Vector2.h:42