33 #define INTERS_CONFONDU 2 36 #define INTERS_NULLE 0 39 #define EPSILON_3 0.001 // 10e-3 40 #define EPSILON_5 0.00001 // 10e-5 41 #define EPSILON_6 0.000001 // 10e-6 42 #define EPSILON_7 0.0000001 // 10e-7 43 #define EPSILON_13 0.0000000000001 // 10e-13 44 #define EPSILON_50 1.e-50 49 #define TYSEUILCONFONDUS EPSILON_3 // 1 mm 52 #define M_PI 3.1415926535897932384626433832795 57 #define M_2PI 6.283185307179586476925287766559 70 inline double ABS(
double a)
72 return (a >= 0.0 ? a : -a);
83 return (a >= 0.0 ? 1 : -1);
93 inline double MAX(
double a,
double b)
95 return (a > b ? a : b);
106 inline double MAX3(
double a,
double b,
double c)
118 inline double MIN(
double a,
double b)
120 return (a < b ? a : b);
131 return (a / 180.0 *
M_PI);
142 return (a /
M_PI * 180.0);
153 return (a / 200.0 *
M_PI);
164 return (a /
M_PI * 200.0);
175 return (a / 200.0 * 180.0);
186 return (a / 180.0 * 200.0);
197 return (a >= 0.0 ? (
int)(a + 0.5) : (
int)(a - 0.5));
208 inline double BORNE(
double a,
double b,
double c)
210 return (a < b ? b : (a > c ? c : a));
221 return (
int)
BORNE((
double) a, 0, 255);
237 OCoord3D(
double x,
double y,
double z);
249 void setCoords(
double x,
double y,
double z);
269 operator const double* ()
const {
return &
_value[0]; }
273 operator double* () {
return &
_value[0]; }
382 void balance(
double c1,
const OVector3D& vector2,
double c2);
392 double scalar(
const OVector3D& vector)
const;
400 double norme()
const;
428 double angle(
const OVector3D& vector)
const;
444 OVector3D getRotationOzBase2(
double alpha);
458 OVector3D getRotationOyBase2(
double alpha);
466 OVector3D getRotationOzOy(
double alpha,
double theta);
515 OPoint3D(
double x,
double y,
double z);
537 virtual void set(
double x,
double y,
double z);
546 virtual void setFromOGL(
double x,
double y,
double z);
547 virtual void setFromOGL(
float x,
float y,
float z);
553 virtual void setFromOGL(
float coords[3]);
561 setFromOGL(coords[0], coords[1], coords[2]);
570 virtual void getToOGL(
double& x,
double& y,
double& z);
576 virtual void getToOGL(
double coords[3]);
584 double distFrom(
const OPoint3D& pt)
const;
590 double dist2DFrom(
const OPoint3D& pt)
const;
595 return *
this == oPoint;
608 const double& distanceMax);
614 const OPoint3D& point2,
const double& distanceMax);
690 int setTranslation(
double x,
double y,
double z);
703 int setScale(
double x,
double y,
double z);
714 int setRotationOx(
double a);
725 int setRotationOy(
double a);
736 int setRotationOz(
double a);
779 int aligneVecteurSurOx(
const OVector3D& vector);
822 int aligneVecteurSurOy(
const OVector3D& vector);
850 OMatrix getInvert(
int* ok = 0)
const;
893 double determinant();
899 static double mat2x2Det(
double a,
double b,
double c,
double d);
905 static double mat3x3Det(
double a1,
double a2,
double a3,
double b1,
double b2,
double b3,
double c1,
double c2,
double c3);
1018 static bool pointInPolygonAngleSum(
const OPoint3D& ptP,
const OPoint3D* pts,
int nbPts);
1031 static bool pointInPolygonRayCasting(
const OPoint3D& ptP,
const OPoint3D* pts,
int nbPts);
1116 virtual double longueur()
const;
1140 virtual int projection(
const OPoint3D& pt,
OPoint3D& ptProj,
double seuilConfondus)
const;
1155 virtual int intersects(
const OSegment3D& seg,
OPoint3D& pt,
double seuilConfondus)
const;
1171 virtual OPoint3D centerOfCurvedPath(
const double& R)
const;
1179 virtual double lengthOfCurvedPath(
const double& R);
1258 void set(
const OMatrix& matrix);
1300 OBox(
double x1,
double y1,
double z1,
double x2,
double y2,
double z2);
1314 virtual bool isInside(
const OPoint3D& pt)
const;
1322 virtual bool isInside2D(
const OPoint3D& pt)
const;
1330 virtual bool isInContact(
const OBox& box)
const;
1338 virtual void Enlarge(
const OPoint3D& pt);
1348 virtual void Enlarge(
float x,
float y,
float z);
1356 virtual void Enlarge(
const OBox& box);
1364 virtual void Translate(
const OPoint3D& vectorTranslate);
1394 OBox2(
const double& length,
const double& width,
const double& height);
1429 virtual bool isInside(
const OPoint3D& pt)
const;
1435 virtual bool isInside2D(
const OPoint3D& pt)
const;
1440 virtual void Translate(
const OVector3D& vect);
1451 void BoxRotationOzOy(
double alpha,
double theta);
3D frame with a point and 3 vectors.
The 3D Plane class using Hessian normal form.
double BORNE(double a, double b, double c)
Limit a number.
OVector3D _vecK
Vector K for the Z axis.
OPoint3D _max
Maximal coordinates of the OBox.
double ABS(double a)
Return the absolute value.
double MIN(double a, double b)
Return the smallest number of two ones.
Class to define a box (not necessary parallel to the axis as OBox)
virtual bool operator!=(const OBox2 &box) const
OVector3D operator*(const OMatrix &mat, const OVector3D &vec)
OPoint3D _ptB
Point B of the segment.
double RADTOGRA(double a)
Converts an angle from radians to gradians.
OPoint3D _ptA
Point A of the segment.
double MAX3(double a, double b, double c)
Return the biggest number of three ones.
double MAX(double a, double b)
Return the biggest number of two ones.
bool operator==(const OCoord3D &coord) const
operator==
OCoord3D()
Default constructor.
std::vector< OPoint3D > TabPoint3D
OCoord3D operator+(const OCoord3D &coord, const OVector3D &vect)
Return a OCoord3D from an operator+ between a OCoord3D and a OVector3D.
CGAL_Vector3 normalize(CGAL_Vector3 v)
normalize vector v
double GRATORAD(double a)
Converts an angle from gradians to radians.
double * getCoords()
Gets the coordinates as an array of double.
bool operator!=(const OCoord3D &coord) const
operator!=
virtual ~OBox()
Destructor.
virtual ~OCoord3D()
Destructor.
virtual void setFromOGL(double coords[3])
::std::ostream & operator<<(::std::ostream &os, const OCoord3D &c)
void setCoords(double x, double y, double z)
Sets the coordinates as an array of double.
OVector3D _vecJ
Vector J for the Y axis.
double _y
y coordinate of OCoord3D
double _x
x coordinate of OCoord3D
double DEGTORAD(double a)
Converts an angle from degrees to radians.
OPoint3D _min
Minimal coordinates of the OBox.
int ROUND(double a)
Compute the rounded value of a number.
virtual ~OBox2()
Destructor.
Class to define a segment.
double RADTODEG(double a)
Converts an angle from radians to degrees.
virtual OVector3D toVector3D() const
Build a OVector3D from a segment used for the direction of the sources.
OCoord3D & operator=(const OCoord3D &coord)
operator=
double _z
z coordinate of OCoord3D
virtual bool operator!=(const OBox &box) const
OPoint3D _origin
The origin point.
double GRATODEG(double a)
Converts an angle from gradians to degrees.
OVector3D _vecI
Vector I for the X axis.
Class Geometry utilities.
bool isEqual(const OPoint3D &oPoint) const
Compatibility alias for operator==.
double DEGTOGRA(double a)
Converts an angle from degrees to gradians.
double dot(const OVector3D &v)
dot product (assuming an orthonormal reference frame)
double SIGNE(double a)
Return the number sign.