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
56 #if GEOM_PSEUDO3D==GEOM_TRUE
63 Point2(
const double x_,
const double y_,
const double z_):
67 pAssociatedTriangle(NULL),
71 customIndex=getSeqNum();
79 Point2():coordX(-DBL_MAX),coordY(-DBL_MAX),coordZ(-DBL_MAX),pAssociatedTriangle(NULL),customIndex(-1)
82 customIndex=getSeqNum();
93 pAssociatedTriangle(NULL),
94 customIndex(p_.customIndex)
103 pAssociatedTriangle=NULL;
104 customIndex=other.customIndex;
122 std::cout<<coordX<<
" "<<coordY<<
" "<<coordZ<<std::endl;
138 pAssociatedTriangle(NULL),
150 pAssociatedTriangle(NULL),
161 pAssociatedTriangle(NULL),
162 customIndex(p_.customIndex)
170 pAssociatedTriangle=NULL;
171 customIndex=other.customIndex;
179 std::cout<<coordX<<
" "<<coordY<<std::endl;
211 #if GEOM_PSEUDO3D==GEOM_TRUE
223 #if GEOM_PSEUDO3D==GEOM_TRUE
232 void xyz(
double& x_,
double& y_,
double& z_)
const
247 void xy(
double& x_,
double& y_)
const
254 #if GEOM_PSEUDO3D==GEOM_TRUE
260 void setHeight(
double z)
275 double a(fabs(coordX));
276 double b(fabs(coordY));
277 return (std::max)(a,b);
294 if(coordX<p.coordX)
return true;
295 if(coordX>p.coordX)
return false;
296 if(coordY<p.coordY)
return true;
308 if(coordX>p.coordX)
return true;
309 if(coordX<p.coordX)
return false;
310 if(coordY>p.coordY)
return true;
322 return (coordX==p.coordX && coordY==p.coordY);
324 #if GEOM_PSEUDO3D==GEOM_TRUE
330 bool samePoint(
const Point2& p)
const
332 return(coordX==p.coordX && coordY==p.coordY && coordZ==p.coordZ);
343 if(coordX!=p.coordX || coordY!=p.coordY)
return true;
352 return pAssociatedTriangle;
356 #if GEOM_PSEUDO3D==GEOM_TRUE
367 void setCoords(
const double x_,
const double y_,
const double z_)
383 void set(
const double x_,
const double y_,
const double z_,
int customIndex_)
388 pAssociatedTriangle=NULL;
389 customIndex=customIndex_;
391 customIndex=getSeqNum();
403 void set(
const double x_,
const double y_,
int customIndex_)
407 pAssociatedTriangle=NULL;
408 customIndex=customIndex_;
410 customIndex=getSeqNum();
413 void change(
const double x_,
const double y_)
424 #if GEOM_PSEUDO3D==GEOM_TRUE
425 void set(
const Point2& pnt)
430 pAssociatedTriangle=NULL;
431 this->customIndex=pnt.customIndex;
438 pAssociatedTriangle=NULL;
439 this->customIndex=pnt.customIndex;
462 customIndex=customIndex_;
488 pAssociatedTriangle=pT;
495 #if GEOM_PSEUDO3D==GEOM_TRUE
496 double xdiff(x()-other.
x());
497 double ydiff(y()-other.
y());
498 double zdiff(z()-other.z());
499 return Vector2(xdiff,ydiff,zdiff);
501 double xdiff(x()-other.
x());
502 double ydiff(y()-other.
y());
513 #if GEOM_PSEUDO3D==GEOM_TRUE
514 return Point2(x()+vec.
x(),y()+vec.
y(),z()+vec.z());
516 return Point2(x()+vec.
x(),y()+vec.
y());
524 #if GEOM_PSEUDO3D==GEOM_TRUE
525 return Point2(x()-vec.
x(),y()-vec.
y(),z()-vec.z());
527 return Point2(x()-vec.
x(),y()-vec.
y());
540 #if GEOM_PSEUDO3D==GEOM_TRUE
550 #if GEOM_PSEUDO3D==GEOM_TRUE
551 stream <<
"Point2 ("<<&pnt<<
",ci="<<pnt.customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y()<<
", "<<pnt.z();
556 stream <<
"Point2 ("<<&pnt<<
","<<pnt.customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y();
566 #if GEOM_PSEUDO3D==GEOM_TRUE
567 stream >> pnt.coordX >> pnt.coordY >> pnt.coordZ;
569 stream >> pnt.coordX >> pnt.coordY;
585 double deltaX=p1.
x()-p0.
x();
586 double deltaY=p1.
y()-p0.
y();
587 return (deltaX*deltaX+deltaY*deltaY);
600 double deltaX=p1.
x()-x0;
601 double deltaY=p1.
y()-y0;
602 return (deltaX*deltaX+deltaY*deltaY);
605 #if GEOM_PSEUDO3D==GEOM_TRUE
612 double sqDistance25D(
const Point2& p0,
const Point2& p1)
614 double deltaX=p1.x()-p0.x();
615 double deltaY=p1.y()-p0.y();
616 double deltaZ=p1.z()-p0.z();
617 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
621 std::cerr<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
622 std::cerr<<
"p0="<<p0<<std::endl;
623 std::cerr<<
"p1="<<p1<<std::endl;
635 double sqDistance25D(
const double x0,
const double y0,
const double z0,
const Point2& p1)
637 double deltaX=p1.x()-x0;
638 double deltaY=p1.y()-y0;
639 double deltaZ=p1.z()-z0;
640 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
644 std::cerr<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
645 std::cerr<<
"x0="<<x0<<
", y0="<<y0<<
", z0="<<z0<<std::endl;
646 std::cerr<<
"p1="<<p1<<std::endl;
667 #if GEOM_PSEUDO3D==GEOM_TRUE
690 #if GEOM_PSEUDO3D==GEOM_TRUE
692 struct CLASS_DECLSPEC Func_ltPointXYZ
694 bool operator()(
const Point2& p0,
const Point2& p1)
const
696 if(p0.
x()<p1.
x())
return true;
697 if(p0.
x()>p1.
x())
return false;
698 if(p0.
y()<p1.
y())
return true;
699 if(p0.
y()>p1.
y())
return false;
700 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:564
double sqDistance2D(const Point2 &p0, const Point2 &p1)
Get the squared distance between two points in 2D.
Definition: Point2.h:583
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:665
Point.
Definition: Point2.h:45
void set(const Point2 &pnt)
Set the coordiantes.
Definition: Point2.h:434
Point2(const Point2 &p_)
Copy constructor.
Definition: Point2.h:158
Point2()
Default constructor.
Definition: Point2.h:147
void xy(double &x_, double &y_) const
Get the x- and y-coordinate.
Definition: Point2.h:247
void setCustomIndex(int customIndex_)
Set a custom index.
Definition: Point2.h:460
void set(const double x_, const double y_, int customIndex_)
Set the coordinates and customIndex.
Definition: Point2.h:403
double getMaxAbs() const
Get max(abs(x),abs(y))
Definition: Point2.h:273
int getCustomIndex() const
Get the custom index.
Definition: Point2.h:477
bool operator==(const Point2 &p) const
Equality operator.
Definition: Point2.h:320
bool operator>(const Point2 &p) const
Greater than operator.
Definition: Point2.h:306
Vector2 operator-(const Point2 &other) const
Returns a vector from other to *this.
Definition: Point2.h:493
void setIncidentTriangle(Triangle2 *pT)
Associate a triangle with the point.
Definition: Point2.h:486
bool operator<(const Point2 &p) const
Less than operator.
Definition: Point2.h:292
bool operator!=(const Point2 &p) const
Inequality operator.
Definition: Point2.h:341
Point2 operator-(const Vector2 &vec) const
Subtract vector from point.
Definition: Point2.h:522
Triangle2 * getIncidentTriangle() const
Get the associated triangle.
Definition: Point2.h:350
double x() const
Get the x-coordinate.
Definition: Point2.h:197
double y() const
Get the y-coordinate.
Definition: Point2.h:206
Point2 operator+(const Vector2 &vec) const
Add vector and point.
Definition: Point2.h:511
Point2(const double x_, const double y_)
Constructor.
Definition: Point2.h:135
Triangle.
Definition: Triangle2.h:60
Vector.
Definition: Vector2.h:42
double y() const
Get the y-value.
double x() const
Get the x-value.