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
54 #if GEOM_PSEUDO3D==GEOM_TRUE
61 Point2(
const double x_,
const double y_,
const double z_):
65 pAssociatedTriangle(NULL),
69 customIndex=getSeqNum();
77 Point2():coordX(-DBL_MAX),coordY(-DBL_MAX),coordZ(-DBL_MAX),pAssociatedTriangle(NULL),customIndex(-1)
80 customIndex=getSeqNum();
91 pAssociatedTriangle(NULL),
92 customIndex(p_.customIndex)
101 pAssociatedTriangle=NULL;
102 customIndex=other.customIndex;
120 std::cout<<coordX<<
" "<<coordY<<
" "<<coordZ<<std::endl;
136 pAssociatedTriangle(NULL),
148 pAssociatedTriangle(NULL),
159 pAssociatedTriangle(NULL),
160 customIndex(p_.customIndex)
168 pAssociatedTriangle=NULL;
169 customIndex=other.customIndex;
177 std::cout<<coordX<<
" "<<coordY<<std::endl;
209 #if GEOM_PSEUDO3D==GEOM_TRUE
221 #if GEOM_PSEUDO3D==GEOM_TRUE
230 void xyz(
double& x_,
double& y_,
double& z_)
const
245 void xy(
double& x_,
double& y_)
const
252 #if GEOM_PSEUDO3D==GEOM_TRUE
258 void setHeight(
double z)
273 double a(fabs(coordX));
274 double b(fabs(coordY));
275 return (std::max)(a,b);
292 if(coordX<p.coordX)
return true;
293 if(coordX>p.coordX)
return false;
294 if(coordY<p.coordY)
return true;
306 if(coordX>p.coordX)
return true;
307 if(coordX<p.coordX)
return false;
308 if(coordY>p.coordY)
return true;
320 return (coordX==p.coordX && coordY==p.coordY);
322 #if GEOM_PSEUDO3D==GEOM_TRUE
328 bool samePoint(
const Point2& p)
const
330 return(coordX==p.coordX && coordY==p.coordY && coordZ==p.coordZ);
341 if(coordX!=p.coordX || coordY!=p.coordY)
return true;
350 return pAssociatedTriangle;
354 #if GEOM_PSEUDO3D==GEOM_TRUE
365 void setCoords(
const double x_,
const double y_,
const double z_)
381 void set(
const double x_,
const double y_,
const double z_,
int customIndex_)
386 pAssociatedTriangle=NULL;
387 customIndex=customIndex_;
389 customIndex=getSeqNum();
401 void set(
const double x_,
const double y_,
int customIndex_)
405 pAssociatedTriangle=NULL;
406 customIndex=customIndex_;
408 customIndex=getSeqNum();
411 void change(
const double x_,
const double y_)
422 #if GEOM_PSEUDO3D==GEOM_TRUE
423 void set(
const Point2& pnt)
428 pAssociatedTriangle=NULL;
429 this->customIndex=pnt.customIndex;
436 pAssociatedTriangle=NULL;
437 this->customIndex=pnt.customIndex;
460 customIndex=customIndex_;
486 pAssociatedTriangle=pT;
493 #if GEOM_PSEUDO3D==GEOM_TRUE
494 double xdiff(x()-other.
x());
495 double ydiff(y()-other.
y());
496 double zdiff(z()-other.z());
497 return Vector2(xdiff,ydiff,zdiff);
499 double xdiff(x()-other.
x());
500 double ydiff(y()-other.
y());
511 #if GEOM_PSEUDO3D==GEOM_TRUE
512 return Point2(x()+vec.
x(),y()+vec.
y(),z()+vec.z());
514 return Point2(x()+vec.
x(),y()+vec.
y());
522 #if GEOM_PSEUDO3D==GEOM_TRUE
523 return Point2(x()-vec.
x(),y()-vec.
y(),z()-vec.z());
525 return Point2(x()-vec.
x(),y()-vec.
y());
538 #if GEOM_PSEUDO3D==GEOM_TRUE
548 #if GEOM_PSEUDO3D==GEOM_TRUE
549 stream <<
"Point2 ("<<&pnt<<
","<<pnt.customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y()<<
", "<<pnt.z();
554 stream <<
"Point2 ("<<&pnt<<
","<<pnt.customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y();
564 #if GEOM_PSEUDO3D==GEOM_TRUE
565 stream >> pnt.coordX >> pnt.coordY >> pnt.coordZ;
567 stream >> pnt.coordX >> pnt.coordY;
583 double deltaX=p1.
x()-p0.
x();
584 double deltaY=p1.
y()-p0.
y();
585 return (deltaX*deltaX+deltaY*deltaY);
598 double deltaX=p1.
x()-x0;
599 double deltaY=p1.
y()-y0;
600 return (deltaX*deltaX+deltaY*deltaY);
603 #if GEOM_PSEUDO3D==GEOM_TRUE
610 double sqDistance25D(
const Point2& p0,
const Point2& p1)
612 double deltaX=p1.x()-p0.x();
613 double deltaY=p1.y()-p0.y();
614 double deltaZ=p1.z()-p0.z();
615 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
619 std::cerr<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
620 std::cerr<<
"p0="<<p0<<std::endl;
621 std::cerr<<
"p1="<<p1<<std::endl;
633 double sqDistance25D(
const double x0,
const double y0,
const double z0,
const Point2& p1)
635 double deltaX=p1.x()-x0;
636 double deltaY=p1.y()-y0;
637 double deltaZ=p1.z()-z0;
638 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
642 std::cerr<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
643 std::cerr<<
"x0="<<x0<<
", y0="<<y0<<
", z0="<<z0<<std::endl;
644 std::cerr<<
"p1="<<p1<<std::endl;
665 #if GEOM_PSEUDO3D==GEOM_TRUE
688 #if GEOM_PSEUDO3D==GEOM_TRUE
690 struct CLASS_DECLSPEC Func_ltPointXYZ
692 bool operator()(
const Point2& p0,
const Point2& p1)
const
694 if(p0.
x()<p1.
x())
return true;
695 if(p0.
x()>p1.
x())
return false;
696 if(p0.
y()<p1.
y())
return true;
697 if(p0.
y()>p1.
y())
return false;
698 if(p0.z()<p1.z())
return true;
std::ostream & operator<<(std::ostream &stream, const Bbox2 &pC)
Print the box.
Definition: Bbox2.h:492
std::istream & operator>>(std::istream &stream, Point2 &pnt)
Stream-to-Point.
Definition: Point2.h:562
double sqDistance2D(const Point2 &p0, const Point2 &p1)
Get the squared distance between two points in 2D.
Definition: Point2.h:581
Point2 centerWithShift(const Point2 &p0, const Point2 &p1)
Compute the midpoint of p0 and p1 and adapt it.
Point2 center(const Point2 &p0, const Point2 &p1)
Compute the midpoint of p0 and p1.
Definition: Point2.h:663
Point.
Definition: Point2.h:43
void set(const Point2 &pnt)
Set the coordiantes.
Definition: Point2.h:432
Point2(const Point2 &p_)
Copy constructor.
Definition: Point2.h:156
Point2()
Default constructor.
Definition: Point2.h:145
void xy(double &x_, double &y_) const
Get the x- and y-coordinate.
Definition: Point2.h:245
void setCustomIndex(int customIndex_)
Set a custom index.
Definition: Point2.h:458
void set(const double x_, const double y_, int customIndex_)
Set the coordinates and customIndex.
Definition: Point2.h:401
double getMaxAbs() const
Get max(abs(x),abs(y))
Definition: Point2.h:271
int getCustomIndex() const
Get the custom index.
Definition: Point2.h:475
bool operator==(const Point2 &p) const
Equality operator.
Definition: Point2.h:318
bool operator>(const Point2 &p) const
Greater than operator.
Definition: Point2.h:304
Vector2 operator-(const Point2 &other) const
Returns a vector from other to *this.
Definition: Point2.h:491
void setIncidentTriangle(Triangle2 *pT)
Associate a triangle with the point.
Definition: Point2.h:484
bool operator<(const Point2 &p) const
Less than operator.
Definition: Point2.h:290
bool operator!=(const Point2 &p) const
Inequality operator.
Definition: Point2.h:339
Point2 operator-(const Vector2 &vec) const
Subtract vector from point.
Definition: Point2.h:520
Triangle2 * getIncidentTriangle() const
Get the associated triangle.
Definition: Point2.h:348
double x() const
Get the x-coordinate.
Definition: Point2.h:195
double y() const
Get the y-coordinate.
Definition: Point2.h:204
Point2 operator+(const Vector2 &vec) const
Add vector and point.
Definition: Point2.h:509
Point2(const double x_, const double y_)
Constructor.
Definition: Point2.h:133
Triangle.
Definition: Triangle2.h:60
Vector.
Definition: Vector2.h:42
double y() const
Get the y-value.
double x() const
Get the x-value.