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
40 VtxColor(
unsigned char r_,
unsigned char g_,
unsigned char b_,
unsigned char a_):r(r_),g(g_),b(b_),a(a_)
63 #if GEOM_PSEUDO3D==GEOM_TRUE
70 Point2(
const double x_,
const double y_,
const double z_):
74 pAssociatedTriangle(NULL),
78 customIndex=getSeqNum();
86 Point2():coordX(-DBL_MAX),coordY(-DBL_MAX),coordZ(-DBL_MAX),pAssociatedTriangle(NULL),customIndex(-1)
89 customIndex=getSeqNum();
100 pAssociatedTriangle(NULL),
101 customIndex(p_.customIndex)
110 pAssociatedTriangle=NULL;
111 customIndex=other.customIndex;
129 std::cout<<coordX<<
" "<<coordY<<
" "<<coordZ<<std::endl;
142 Point2(
const double x_,
const double y_):
145 pAssociatedTriangle(NULL),
157 pAssociatedTriangle(NULL),
165 Point2(
const Point2& p_):
168 pAssociatedTriangle(NULL),
169 customIndex(p_.customIndex)
173 Point2 &operator=(
const Point2& other)
177 pAssociatedTriangle=NULL;
178 customIndex=other.customIndex;
186 std::cout<<coordX<<
" "<<coordY<<std::endl;
218 #if GEOM_PSEUDO3D==GEOM_TRUE
230 #if GEOM_PSEUDO3D==GEOM_TRUE
239 void xyz(
double& x_,
double& y_,
double& z_)
const
254 void xy(
double& x_,
double& y_)
const
261 #if GEOM_PSEUDO3D==GEOM_TRUE
282 double a(fabs(coordX));
283 double b(fabs(coordY));
284 return (std::max)(a,b);
301 if(coordX<p.coordX)
return true;
302 if(coordX>p.coordX)
return false;
303 if(coordY<p.coordY)
return true;
315 if(coordX>p.coordX)
return true;
316 if(coordX<p.coordX)
return false;
317 if(coordY>p.coordY)
return true;
329 return (coordX==p.coordX && coordY==p.coordY);
331 #if GEOM_PSEUDO3D==GEOM_TRUE
339 return(coordX==p.coordX && coordY==p.coordY && coordZ==p.coordZ);
350 if(coordX!=p.coordX || coordY!=p.coordY)
return true;
359 return pAssociatedTriangle;
363 #if GEOM_PSEUDO3D==GEOM_TRUE
374 void setCoords(
const double x_,
const double y_,
const double z_)
390 void set(
const double x_,
const double y_,
const double z_,
int customIndex_)
395 pAssociatedTriangle=NULL;
396 customIndex=customIndex_;
398 customIndex=getSeqNum();
410 void set(
const double x_,
const double y_,
int customIndex_)
414 pAssociatedTriangle=NULL;
415 customIndex=customIndex_;
417 customIndex=getSeqNum();
420 void change(
const double x_,
const double y_)
431 #if GEOM_PSEUDO3D==GEOM_TRUE
437 pAssociatedTriangle=NULL;
438 this->customIndex=pnt.customIndex;
441 void set(
const Point2& pnt)
445 pAssociatedTriangle=NULL;
446 this->customIndex=pnt.customIndex;
469 customIndex=customIndex_;
495 pAssociatedTriangle=pT;
502 #if GEOM_PSEUDO3D==GEOM_TRUE
503 double xdiff(x()-other.
x());
504 double ydiff(y()-other.
y());
505 double zdiff(z()-other.
z());
506 return Vector2(xdiff,ydiff,zdiff);
508 double xdiff(x()-other.
x());
509 double ydiff(y()-other.
y());
520 #if GEOM_PSEUDO3D==GEOM_TRUE
521 return Point2(x()+vec.
x(),y()+vec.
y(),z()+vec.
z());
523 return Point2(x()+vec.
x(),y()+vec.
y());
531 #if GEOM_PSEUDO3D==GEOM_TRUE
532 return Point2(x()-vec.
x(),y()-vec.
y(),z()-vec.
z());
534 return Point2(x()-vec.
x(),y()-vec.
y());
547 #if GEOM_PSEUDO3D==GEOM_TRUE
557 #if GEOM_PSEUDO3D==GEOM_TRUE
558 stream <<
"Point2 ("<<&pnt<<
",ci="<<pnt.customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y()<<
", "<<pnt.
z();
563 stream <<
"Point2 ("<<&pnt<<
","<<pnt.customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y();
573 #if GEOM_PSEUDO3D==GEOM_TRUE
574 stream >> pnt.coordX >> pnt.coordY >> pnt.coordZ;
576 stream >> pnt.coordX >> pnt.coordY;
592 double deltaX=p1.
x()-p0.
x();
593 double deltaY=p1.
y()-p0.
y();
594 return (deltaX*deltaX+deltaY*deltaY);
607 double deltaX=p1.
x()-x0;
608 double deltaY=p1.
y()-y0;
609 return (deltaX*deltaX+deltaY*deltaY);
612 #if GEOM_PSEUDO3D==GEOM_TRUE
621 double deltaX=p1.
x()-p0.
x();
622 double deltaY=p1.
y()-p0.
y();
623 double deltaZ=p1.
z()-p0.
z();
624 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
628 std::cerr<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
629 std::cerr<<
"p0="<<p0<<std::endl;
630 std::cerr<<
"p1="<<p1<<std::endl;
644 double deltaX=p1.
x()-x0;
645 double deltaY=p1.
y()-y0;
646 double deltaZ=p1.
z()-z0;
647 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
651 std::cerr<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
652 std::cerr<<
"x0="<<x0<<
", y0="<<y0<<
", z0="<<z0<<std::endl;
653 std::cerr<<
"p1="<<p1<<std::endl;
674 #if GEOM_PSEUDO3D==GEOM_TRUE
697 #if GEOM_PSEUDO3D==GEOM_TRUE
701 bool operator()(
const Point2& p0,
const Point2& p1)
const
703 if(p0.
x()<p1.
x())
return true;
704 if(p0.
x()>p1.
x())
return false;
705 if(p0.
y()<p1.
y())
return true;
706 if(p0.
y()>p1.
y())
return false;
707 if(p0.
z()<p1.
z())
return true;
std::ostream & operator<<(std::ostream &stream, const Bbox2 &pC)
Print the box.
Definition: Bbox2.h:492
double sqDistance25D(const Point2 &p0, const Point2 &p1)
Get the squared distance between two points.
Definition: Point2.h:619
std::istream & operator>>(std::istream &stream, Point2 &pnt)
Stream-to-Point.
Definition: Point2.h:571
double sqDistance2D(const Point2 &p0, const Point2 &p1)
Get the squared distance between two points in 2D.
Definition: Point2.h:590
Point2 center(const Point2 &p0, const Point2 &p1)
Compute the midpoint of p0 and p1.
Definition: Point2.h:672
Point2 centerWithShift(const Point2 &p0, const Point2 &p1)
Compute the midpoint of p0 and p1 and adapt it.
Point.
Definition: Point2.h:52
double getMaxAbs() const
Get max(abs(x),abs(y))
Definition: Point2.h:280
double z() const
Get the z-coordinate.
Definition: Point2.h:224
bool operator!=(const Point2 &p) const
Inequality operator.
Definition: Point2.h:348
void xy(double &x_, double &y_) const
Get the x- and y-coordinate.
Definition: Point2.h:254
bool operator==(const Point2 &p) const
Equality operator.
Definition: Point2.h:327
Point2 operator+(const Vector2 &vec) const
Add vector and point.
Definition: Point2.h:518
void setCoords(const double x_, const double y_, const double z_)
Set the coordinates.
Definition: Point2.h:374
void setIncidentTriangle(Triangle2 *pT)
Associate a triangle with the point.
Definition: Point2.h:493
int getCustomIndex() const
Get the custom index.
Definition: Point2.h:484
void setCustomIndex(int customIndex_)
Set a custom index.
Definition: Point2.h:467
double y() const
Get the y-coordinate.
Definition: Point2.h:213
bool operator>(const Point2 &p) const
Greater than operator.
Definition: Point2.h:313
Point2()
Default constructor.
Definition: Point2.h:86
void set(const double x_, const double y_, const double z_, int customIndex_)
Set the coordinates.
Definition: Point2.h:390
bool samePoint(const Point2 &p) const
Equality operator.
Definition: Point2.h:337
void setHeight(double z)
Set the z-coordinate.
Definition: Point2.h:267
double x() const
Get the x-coordinate.
Definition: Point2.h:204
Triangle2 * getIncidentTriangle() const
Get the associated triangle.
Definition: Point2.h:357
void xyz(double &x_, double &y_, double &z_) const
Get the x-, y- and z-coordinate.
Definition: Point2.h:239
void set(const Point2 &pnt)
Set the coordiantes.
Definition: Point2.h:432
Point2 operator-(const Vector2 &vec) const
Subtract vector from point.
Definition: Point2.h:529
bool operator<(const Point2 &p) const
Less than operator.
Definition: Point2.h:299
Point2(const Point2 &p_)
Copy constructor.
Definition: Point2.h:96
Vector2 operator-(const Point2 &other) const
Returns a vector from other to *this.
Definition: Point2.h:500
Point2(const double x_, const double y_, const double z_)
Constructor.
Definition: Point2.h:70
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:700