41 #if GEOM_PSEUDO3D==GEOM_TRUE
42 namespace GEOM_FADE25D {
43 #elif GEOM_PSEUDO3D==GEOM_FALSE
44 namespace GEOM_FADE2D {
46 #error GEOM_PSEUDO3D is not defined
57 VtxColor(
unsigned char r_,
unsigned char g_,
unsigned char b_,
unsigned char a_):r(r_),g(g_),b(b_),a(a_)
88 #if GEOM_PSEUDO3D==GEOM_TRUE
95 Point2(
const double x_,
const double y_,
const double z_):
99 pAssociatedTriangle(NULL),
103 customIndex=getSeqNum();
114 Point2():coordX(-DBL_MAX),coordY(-DBL_MAX),coordZ(-DBL_MAX),pAssociatedTriangle(NULL),customIndex(-1)
117 customIndex=getSeqNum();
130 pAssociatedTriangle(NULL),
145 pAssociatedTriangle=NULL;
159 GCOUT<<coordX<<
" "<<coordY<<
" "<<coordZ<<std::endl;
171 pAssociatedTriangle(NULL),
183 pAssociatedTriangle(NULL),
196 pAssociatedTriangle(NULL),
197 customIndex(p_.customIndex)
210 pAssociatedTriangle=NULL;
218 GCOUT<<coordX<<
" "<<coordY<<std::endl;
255 #if GEOM_PSEUDO3D==GEOM_TRUE
269 #if GEOM_PSEUDO3D==GEOM_TRUE
277 void xyz(
double& x_,
double& y_,
double& z_)
const
291 void xy(
double& x_,
double& y_)
const
298 #if GEOM_PSEUDO3D==GEOM_TRUE
306 void setHeight(
double z)
320 double a(fabs(coordX));
321 double b(fabs(coordY));
322 return (std::max)(a,b);
339 if(coordX<p.
coordX)
return true;
340 if(coordX>p.
coordX)
return false;
341 if(coordY<p.
coordY)
return true;
359 if(coordX>p.
coordX)
return true;
360 if(coordX<p.
coordX)
return false;
361 if(coordY>p.
coordY)
return true;
380 #if GEOM_PSEUDO3D==GEOM_TRUE
392 bool samePoint(
const Point2& p)
const
394 return(coordX==p.
coordX && coordY==p.
coordY && coordZ==p.coordZ);
423 return pAssociatedTriangle;
427 #if GEOM_PSEUDO3D==GEOM_TRUE
434 void setCoords(
const double x_,
const double y_,
const double z_)
445 void set(
const double x_,
const double y_,
const double z_,
int customIndex_)
450 pAssociatedTriangle=NULL;
451 customIndex=customIndex_;
453 customIndex=getSeqNum();
464 void set(
const double x_,
const double y_,
int customIndex_)
468 pAssociatedTriangle=NULL;
469 customIndex=customIndex_;
471 customIndex=getSeqNum();
479 void change(
const double x_,
const double y_)
490 #if GEOM_PSEUDO3D==GEOM_TRUE
491 void set(
const Point2& pnt)
493 pnt.xyz(coordX,coordY,coordZ);
494 pAssociatedTriangle=NULL;
495 this->customIndex=pnt.customIndex;
498 void set(
const Point2& pnt)
500 pnt.xy(coordX,coordY);
501 pAssociatedTriangle=NULL;
502 this->customIndex=pnt.customIndex;
525 customIndex=customIndex_;
553 pAssociatedTriangle=pT;
567 #if GEOM_PSEUDO3D==GEOM_TRUE
568 double xdiff(x()-other.
x());
569 double ydiff(y()-other.
y());
570 double zdiff(z()-other.z());
571 return Vector2(xdiff,ydiff,zdiff);
573 double xdiff(x()-other.
x());
574 double ydiff(y()-other.
y());
591 #if GEOM_PSEUDO3D==GEOM_TRUE
592 return Point2(x()+vec.
x(),y()+vec.
y(),z()+vec.z());
594 return Point2(x()+vec.
x(),y()+vec.
y());
607 #if GEOM_PSEUDO3D==GEOM_TRUE
608 return Point2(x()-vec.
x(),y()-vec.
y(),z()-vec.z());
610 return Point2(x()-vec.
x(),y()-vec.
y());
620 #if GEOM_PSEUDO3D==GEOM_TRUE
637 #if GEOM_PSEUDO3D==GEOM_TRUE
638 stream <<
"Point2 ("<<&pnt<<
",ci="<<pnt.
customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y()<<
", "<<pnt.z();
643 stream <<
"Point2 ("<<&pnt<<
","<<pnt.
customIndex<<
"): "<<pnt.
x()<<
", "<<pnt.
y();
660 #if GEOM_PSEUDO3D==GEOM_TRUE
684 double deltaX=p1.
x()-p0.
x();
685 double deltaY=p1.
y()-p0.
y();
686 return (deltaX*deltaX+deltaY*deltaY);
705 double deltaX=p1.
x()-x0;
706 double deltaY=p1.
y()-y0;
707 return (deltaX*deltaX+deltaY*deltaY);
710 #if GEOM_PSEUDO3D==GEOM_TRUE
720 double sqDistance25D(
const Point2& p0,
const Point2& p1)
722 double deltaX=p1.x()-p0.x();
723 double deltaY=p1.y()-p0.y();
724 double deltaZ=p1.z()-p0.z();
725 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
729 GCOUT<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
730 GCOUT<<
"p0="<<p0<<std::endl;
731 GCOUT<<
"p1="<<p1<<std::endl;
748 double sqDistance25D(
const double x0,
const double y0,
const double z0,
const Point2& p1)
750 double deltaX=p1.x()-x0;
751 double deltaY=p1.y()-y0;
752 double deltaZ=p1.z()-z0;
753 double result(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
757 GCOUT<<
"warning, sqDistance25D, nan value, no distance"<<std::endl;
758 GCOUT<<
"x0="<<x0<<
", y0="<<y0<<
", z0="<<z0<<std::endl;
759 GCOUT<<
"p1="<<p1<<std::endl;
784 #if GEOM_PSEUDO3D==GEOM_TRUE
810 Point2 centerWithShift(
const Point2& p0,
const Point2& p1);
812 #if GEOM_PSEUDO3D==GEOM_TRUE
814 struct CLASS_DECLSPEC Func_ltPointXYZ
816 bool operator()(
const Point2& p0,
const Point2& p1)
const
818 if(p0.x()<p1.x())
return true;
819 if(p0.x()>p1.x())
return false;
820 if(p0.y()<p1.y())
return true;
821 if(p0.y()>p1.y())
return false;
822 return p0.z()<p1.z();
826 struct CLASS_DECLSPEC Func_samePointXYZ
828 bool operator()(
const Point2& p0,
const Point2& p1)
const
830 return p0.x()==p1.x() && p0.y()==p1.y() && p0.z()==p1.z();
std::ostream & operator<<(std::ostream &stream, const Bbox2 &pC)
Prints the bounding box to a stream.
Definition: Bbox2.h:605
CINC2
Enum for the position of a point relative to a circle.
Definition: Point2.h:34
@ CINC2_UNKNOWN
Invalid value (undefined)
Definition: Point2.h:35
@ CINC2_ZERO
Point lies exactly on the circumference of the circle.
Definition: Point2.h:36
@ CINC2_OUTCIRCLE
Point lies outside the circle.
Definition: Point2.h:38
@ CINC2_INCIRCLE
Point lies inside the circle.
Definition: Point2.h:37
std::istream & operator>>(std::istream &stream, Point2 &pnt)
Read coordinates from an input stream into a Point2.
Definition: Point2.h:658
double sqDistance2D(const Point2 &p0, const Point2 &p1)
Get the squared 2D distance between two points.
Definition: Point2.h:682
Point2 center(const Point2 &p0, const Point2 &p1)
Compute the midpoint of points p0 and p1.
Definition: Point2.h:782
Represents a 2D point.
Definition: Point2.h:76
Point2(const Point2 &p_)
Copy constructor.
Definition: Point2.h:193
Point2()
Default constructor.
Definition: Point2.h:180
double coordY
y-coordinate
Definition: Point2.h:619
int customIndex
User-defined index.
Definition: Point2.h:624
void xy(double &x_, double &y_) const
Get the x- and y- coordinates of the Point2.
Definition: Point2.h:291
void setCustomIndex(int customIndex_)
Sets a custom index for the Point2.
Definition: Point2.h:523
double getMaxAbs() const
Get the larger of the absolute values of x and y.
Definition: Point2.h:318
int getCustomIndex() const
Retrieves the custom index of the Point2.
Definition: Point2.h:539
bool operator==(const Point2 &p) const
Compares if the current Point2 is equal to another one.
Definition: Point2.h:376
bool operator>(const Point2 &p) const
Compare if the current Point2 is greater than another one.
Definition: Point2.h:357
Vector2 operator-(const Point2 &other) const
Create a Vector2 by subtracing another Point2 from the current one.
Definition: Point2.h:565
bool operator<(const Point2 &p) const
Compare if the current Point2 is less than another one.
Definition: Point2.h:337
bool operator!=(const Point2 &p) const
Compares if the current Point2 is different from another one.
Definition: Point2.h:410
Point2 operator-(const Vector2 &vec) const
Subtract a Vector2 from the Point2.
Definition: Point2.h:605
double coordX
x-coordinate
Definition: Point2.h:618
double x() const
Get the x-coordinate of the Point2.
Definition: Point2.h:239
~Point2()
Destructor.
Definition: Point2.h:226
Point2 & operator=(const Point2 &other)
Assignment operator.
Definition: Point2.h:206
double y() const
Get the y-coordinate of the Point2.
Definition: Point2.h:250
Point2 operator+(const Vector2 &vec) const
Add a Vector2 to the Point2.
Definition: Point2.h:589
Point2(const double x_, const double y_)
Constructor.
Definition: Point2.h:168
Represents a triangle in a triangulation.
Definition: Triangle2.h:59
Vector.
Definition: Vector2.h:47
double y() const
Get the y-value.
double x() const
Get the x-value.
Structure to store vertex color (RGBA).
Definition: Point2.h:54
VtxColor(unsigned char r_, unsigned char g_, unsigned char b_, unsigned char a_)
Constructor.
Definition: Point2.h:57