26 #if GEOM_PSEUDO3D==GEOM_TRUE
27 namespace GEOM_FADE25D {
28 #elif GEOM_PSEUDO3D==GEOM_FALSE
29 namespace GEOM_FADE2D {
31 #error GEOM_PSEUDO3D is not defined
41 VtxColor(
unsigned char r_,
unsigned char g_,
unsigned char b_,
unsigned char a_):r(r_),g(g_),b(b_),a(a_)
64 #if GEOM_PSEUDO3D==GEOM_TRUE
71 Point2(
const double x_,
const double y_,
const double z_):
75 pAssociatedTriangle(NULL),
79 customIndex=getSeqNum();
87 Point2():coordX(-DBL_MAX),coordY(-DBL_MAX),coordZ(-DBL_MAX),pAssociatedTriangle(NULL),customIndex(-1)
90 customIndex=getSeqNum();
101 pAssociatedTriangle(NULL),
102 customIndex(p_.customIndex)
111 pAssociatedTriangle=NULL;
112 customIndex=other.customIndex;
130 std::cout<<coordX<<
" "<<coordY<<
" "<<coordZ<<std::endl;
143 Point2(
const double x_,
const double y_):
146 pAssociatedTriangle(NULL),
158 pAssociatedTriangle(NULL),
166 Point2(
const Point2& p_):
169 pAssociatedTriangle(NULL),
170 customIndex(p_.customIndex)
174 Point2 &operator=(
const Point2& other)
178 pAssociatedTriangle=NULL;
179 customIndex=other.customIndex;
187 std::cout<<coordX<<
" "<<coordY<<std::endl;
215 #if GEOM_PSEUDO3D==GEOM_TRUE
227 #if GEOM_PSEUDO3D==GEOM_TRUE
236 void xyz(
double& x_,
double& y_,
double& z_)
const
251 void xy(
double& x_,
double& y_)
const
258 #if GEOM_PSEUDO3D==GEOM_TRUE
279 double a(fabs(coordX));
280 double b(fabs(coordY));
281 return (std::max)(a,b);
298 if(coordX<p.coordX)
return true;
299 if(coordX>p.coordX)
return false;
300 if(coordY<p.coordY)
return true;
312 if(coordX>p.coordX)
return true;
313 if(coordX<p.coordX)
return false;
314 if(coordY>p.coordY)
return true;
326 return (coordX==p.coordX && coordY==p.coordY);
328 #if GEOM_PSEUDO3D==GEOM_TRUE
336 return(coordX==p.coordX && coordY==p.coordY && coordZ==p.coordZ);
347 if(coordX!=p.coordX || coordY!=p.coordY)
return true;
356 return pAssociatedTriangle;
360 #if GEOM_PSEUDO3D==GEOM_TRUE
371 void setCoords(
const double x_,
const double y_,
const double z_)
387 void set(
const double x_,
const double y_,
const double z_,
int customIndex_)
392 pAssociatedTriangle=NULL;
393 customIndex=customIndex_;
395 customIndex=getSeqNum();
407 void set(
const double x_,
const double y_,
int customIndex_)
411 pAssociatedTriangle=NULL;
412 customIndex=customIndex_;
414 customIndex=getSeqNum();
417 void change(
const double x_,
const double y_)
428 #if GEOM_PSEUDO3D==GEOM_TRUE
431 pnt.
xyz(coordX,coordY,coordZ);
432 pAssociatedTriangle=NULL;
433 this->customIndex=pnt.customIndex;
436 void set(
const Point2& pnt)
438 pnt.
xy(coordX,coordY);
439 pAssociatedTriangle=NULL;
440 this->customIndex=pnt.customIndex;
463 customIndex=customIndex_;
489 pAssociatedTriangle=pT;
496 #if GEOM_PSEUDO3D==GEOM_TRUE
497 double xdiff(x()-other.
x());
498 double ydiff(y()-other.
y());
499 double zdiff(z()-other.
z());
500 return Vector2(xdiff,ydiff,zdiff);
502 double xdiff(x()-other.
x());
503 double ydiff(y()-other.
y());
514 #if GEOM_PSEUDO3D==GEOM_TRUE
515 return Point2(x()+vec.
x(),y()+vec.
y(),z()+vec.
z());
517 return Point2(x()+vec.
x(),y()+vec.
y());
525 #if GEOM_PSEUDO3D==GEOM_TRUE
526 return Point2(x()-vec.
x(),y()-vec.
y(),z()-vec.
z());
528 return Point2(x()-vec.
x(),y()-vec.
y());
533 friend std::ostream &operator<<(std::ostream &stream,
const Point2& pnt);
541 #if GEOM_PSEUDO3D==GEOM_TRUE
549 inline std::ostream &operator<<(std::ostream &stream,
const Point2& pnt)
551 #if GEOM_PSEUDO3D==GEOM_TRUE
552 stream <<
"Point2 ("<<&pnt<<
",ci="<<pnt.customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y()<<
", "<<pnt.
z();
557 stream <<
"Point2 ("<<&pnt<<
","<<pnt.customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y();
567 #if GEOM_PSEUDO3D==GEOM_TRUE
568 stream >> pnt.coordX >> pnt.coordY >> pnt.coordZ;
570 stream >> pnt.coordX >> pnt.coordY;
586 double deltaX=p1.
x()-p0.
x();
587 double deltaY=p1.
y()-p0.
y();
588 return (deltaX*deltaX+deltaY*deltaY);
601 double deltaX=p1.
x()-x0;
602 double deltaY=p1.
y()-y0;
603 return (deltaX*deltaX+deltaY*deltaY);
606 #if GEOM_PSEUDO3D==GEOM_TRUE
615 double deltaX=p1.
x()-p0.
x();
616 double deltaY=p1.
y()-p0.
y();
617 double deltaZ=p1.
z()-p0.
z();
618 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
622 std::cerr<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
623 std::cerr<<
"p0="<<p0<<std::endl;
624 std::cerr<<
"p1="<<p1<<std::endl;
638 double deltaX=p1.
x()-x0;
639 double deltaY=p1.
y()-y0;
640 double deltaZ=p1.
z()-z0;
641 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
645 std::cerr<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
646 std::cerr<<
"x0="<<x0<<
", y0="<<y0<<
", z0="<<z0<<std::endl;
647 std::cerr<<
"p1="<<p1<<std::endl;
668 #if GEOM_PSEUDO3D==GEOM_TRUE
691 #if GEOM_PSEUDO3D==GEOM_TRUE
695 bool operator()(
const Point2& p0,
const Point2& p1)
const
697 if(p0.
x()<p1.
x())
return true;
698 if(p0.
x()>p1.
x())
return false;
699 if(p0.
y()<p1.
y())
return true;
700 if(p0.
y()>p1.
y())
return false;
701 return p0.
z()<p1.
z();
707 bool operator()(
const Point2& p0,
const Point2& p1)
const
709 return p0.
x()==p1.
x() && p0.
y()==p1.
y() && p0.
z()==p1.
z();
double sqDistance25D(const Point2 &p0, const Point2 &p1)
Get the squared distance between two points.
Definition: Point2.h:613
std::istream & operator>>(std::istream &stream, Point2 &pnt)
Stream-to-Point.
Definition: Point2.h:565
double sqDistance2D(const Point2 &p0, const Point2 &p1)
Get the squared distance between two points in 2D.
Definition: Point2.h:584
Point2 center(const Point2 &p0, const Point2 &p1)
Compute the midpoint of p0 and p1.
Definition: Point2.h:666
Point2 centerWithShift(const Point2 &p0, const Point2 &p1)
Compute the midpoint of p0 and p1 and adapt it.
Point.
Definition: Point2.h:53
double getMaxAbs() const
Get max(abs(x),abs(y))
Definition: Point2.h:277
double z() const
Get the z-coordinate.
Definition: Point2.h:221
bool operator!=(const Point2 &p) const
Inequality operator.
Definition: Point2.h:345
void xy(double &x_, double &y_) const
Get the x- and y-coordinate.
Definition: Point2.h:251
bool operator==(const Point2 &p) const
Equality operator.
Definition: Point2.h:324
Point2 operator+(const Vector2 &vec) const
Add vector and point.
Definition: Point2.h:512
void setCoords(const double x_, const double y_, const double z_)
Set the coordinates.
Definition: Point2.h:371
void setIncidentTriangle(Triangle2 *pT)
Associate a triangle with the point.
Definition: Point2.h:487
int getCustomIndex() const
Get the custom index.
Definition: Point2.h:478
void setCustomIndex(int customIndex_)
Set a custom index.
Definition: Point2.h:461
double y() const
Get the y-coordinate.
Definition: Point2.h:210
bool operator>(const Point2 &p) const
Greater than operator.
Definition: Point2.h:310
Point2()
Default constructor.
Definition: Point2.h:87
void set(const double x_, const double y_, const double z_, int customIndex_)
Set the coordinates.
Definition: Point2.h:387
bool samePoint(const Point2 &p) const
Equality operator.
Definition: Point2.h:334
void setHeight(double z)
Set the z-coordinate.
Definition: Point2.h:264
double x() const
Get the x-coordinate.
Definition: Point2.h:201
Triangle2 * getIncidentTriangle() const
Get the associated triangle.
Definition: Point2.h:354
void xyz(double &x_, double &y_, double &z_) const
Get the x-, y- and z-coordinate.
Definition: Point2.h:236
void set(const Point2 &pnt)
Set the coordiantes.
Definition: Point2.h:429
Point2 operator-(const Vector2 &vec) const
Subtract vector from point.
Definition: Point2.h:523
bool operator<(const Point2 &p) const
Less than operator.
Definition: Point2.h:296
Point2(const Point2 &p_)
Copy constructor.
Definition: Point2.h:97
Vector2 operator-(const Point2 &other) const
Returns a vector from other to *this.
Definition: Point2.h:494
Point2(const double x_, const double y_, const double z_)
Constructor.
Definition: Point2.h:71
Triangle.
Definition: Triangle2.h:60
Vector.
Definition: Vector2.h:42
double x() const
Get the x-value.
double y() const
Get the y-value.
double z() const
Get the z-value.
Functor to sort points lexicographically.
Definition: Point2.h:694
Functor to compare two points in 3 dimensions.
Definition: Point2.h:706