21 #define MAX(A, B) (((A) > (B)) ? (A) : (B))
22 #define MIN(A, B) (((A) > (B)) ? (B) : (A))
23 #define minP(A, B, C) ((((A).C) > ((B).C)) ? (B) : (A))
24 #define coeff_ang(PA, PB) (((PB)._y - (PA)._y) / ((PB)._x - (PA)._x))
25 #define DOT(u, v) ((u)._x * (v)._x + (u)._y * (v)._y + (u)._z * (v)._z)
99 double* res =
new double[3];
108 return os <<
"(" <<
c._x <<
", " <<
c._y <<
", " <<
c._z <<
")";
123 *
this = vecTo - vecFrom;
156 vectorRet.
_x = this->
_x + vector.
_x;
157 vectorRet.
_y = this->
_y + vector.
_y;
158 vectorRet.
_z = this->
_z + vector.
_z;
165 vectorRet.
_x = this->
_x - vector.
_x;
166 vectorRet.
_y = this->
_y - vector.
_y;
167 vectorRet.
_z = this->
_z - vector.
_z;
175 vectorRet.
_x = this->
_x * vector.
_x;
176 vectorRet.
_y = this->
_y * vector.
_y;
177 vectorRet.
_z = this->
_z * vector.
_z;
184 return (a * (*
this));
190 vectorRet.
_x = vector.
_x * a;
191 vectorRet.
_y = vector.
_y * a;
192 vectorRet.
_z = vector.
_z * a;
199 vectorRet.
_x = (this->
_y * vector.
_z) - (this->
_z * vector.
_y);
200 vectorRet.
_y = (this->
_z * vector.
_x) - (this->
_x * vector.
_z);
201 vectorRet.
_z = (this->
_x * vector.
_y) - (this->
_y * vector.
_x);
207 *
this = *
this * c1 + vector2 * c2;
212 return (this->
_x * vector.
_x + this->_y * vector.
_y + this->_z * vector.
_z);
222 return (vector2 - *
this).
cross(vector3 - *
this);
251 return (acos(
BORNE(cosVal, -1.0, 1.0)));
257 double cosA = cos(alpha);
258 double sinA = sin(alpha);
261 Vfinal.
_x = cosA * V.
_x - sinA * V.
_y;
262 Vfinal.
_y = sinA * V.
_x + cosA * V.
_y;
270 double cosA = cos(alpha);
271 double sinA = sin(alpha);
274 Vfinal.
_x = cosA * V.
_x - sinA * V.
_z;
276 Vfinal.
_z = sinA * V.
_x + cosA * V.
_z;
283 double cosA = cos(alpha);
284 double sinA = sin(alpha);
287 Vfinal.
_x = cosA * V.
_x + sinA * V.
_y;
288 Vfinal.
_y = -sinA * V.
_x + cosA * V.
_y;
296 double cosA = cos(alpha);
297 double sinA = sin(alpha);
300 Vfinal.
_x = cosA * V.
_x + sinA * V.
_z;
302 Vfinal.
_z = -sinA * V.
_x + cosA * V.
_z;
309 double cosA = cos(alpha);
310 double sinA = sin(alpha);
311 double cosB = cos(theta);
312 double sinB = sin(theta);
315 Vfinal.
_x = cosA * cosB * V.
_x - sinA * V.
_y - cosA * sinB * V.
_z;
316 Vfinal.
_y = sinA * cosB * V.
_x + cosA * V.
_y - sinA * sinB * V.
_z;
317 Vfinal.
_z = sinB * V.
_x + cosB * V.
_z;
323 return os <<
"OVector3D" <<
static_cast<const OCoord3D&
>(v);
368 getToOGL(coords[0], coords[1], coords[2]);
389 if (points.empty() || (distanceMax <= 0.1))
393 bool pointAdded =
false;
396 seg.
_ptA = points[0];
397 retTab.push_back(seg.
_ptA);
399 for (
unsigned int i = 1; i < points.size(); i++)
401 seg.
_ptB = points[i];
404 if (dist > distanceMax)
410 retTab.push_back(newPt);
413 retTab.push_back(seg.
_ptB);
424 const double& distanceMax)
427 tabPoints.push_back(point1);
428 tabPoints.push_back(point2);
434 return os <<
"OPoint3D" <<
static_cast<const OCoord3D&
>(v);
452 for (i = 0; i < 4; i++)
454 for (j = 0; j < 4; j++)
456 _m[i][j] = matrix[i][j];
467 for (
int i = 0; i < 4; i++)
469 for (
int j = 0; j < 4; j++)
471 _m[i][j] = matrix.
_m[i][j];
482 for (
int i = 0; i < 4; i++)
484 for (
int j = 0; j < 4; j++)
486 if (
_m[i][j] != matrix.
_m[i][j])
504 for (
int i = 0; i < 3; i++)
506 for (
int j = 0; j < 3; j++)
508 matrixRes.
_m[i][j] =
_m[i][j] + matrix.
_m[i][j];
517 for (
int i = 0; i < 3; i++)
519 for (
int j = 0; j < 3; j++)
521 matrixRes.
_m[i][j] =
_m[i][j] - matrix.
_m[i][j];
530 for (
int i = 0; i < 4; i++)
532 for (
int j = 0; j < 4; j++)
535 for (
int k = 0; k < 4; k++)
537 t +=
_m[i][k] * matrix.
_m[k][j];
539 matrixRes.
_m[i][j] = t;
548 coordRes.
_x =
_m[0][0] * coord.
_x +
_m[0][1] * coord.
_y +
_m[0][2] * coord.
_z;
549 coordRes.
_y =
_m[1][0] * coord.
_x +
_m[1][1] * coord.
_y +
_m[1][2] * coord.
_z;
550 coordRes.
_z =
_m[2][0] * coord.
_x +
_m[2][1] * coord.
_y +
_m[2][2] * coord.
_z;
571 resVec = mat.
scale(resVec);
579 resPt.
_x = resPt.
_x + mat.
_m[0][3];
580 resPt.
_y = resPt.
_y + mat.
_m[1][3];
581 resPt.
_z = resPt.
_z + mat.
_m[2][3];
587 double echelle = NAN;
590 vecRes.
_x =
_m[0][0] * normal.
_x +
_m[0][1] * normal.
_y +
_m[0][2] * normal.
_z;
591 vecRes.
_y =
_m[1][0] * normal.
_x +
_m[1][1] * normal.
_y +
_m[1][2] * normal.
_z;
592 vecRes.
_z =
_m[2][0] * normal.
_x +
_m[2][1] * normal.
_y +
_m[2][2] * normal.
_z;
593 echelle =
_m[3][0] * normal.
_x +
_m[3][1] * normal.
_y +
_m[3][2] * normal.
_z +
_m[3][3];
601 vecRes.
_x /= echelle;
602 vecRes.
_y /= echelle;
603 vecRes.
_z /= echelle;
612 for (i = 0; i < 4; i++)
614 for (j = 0; j < 4; j++)
616 printf(
"%12.7f ",
_m[i][j]);
625 for (i = 0; i < 4; i++)
627 for (j = 0; j < 4; j++)
637 for (i = 0; i < 4; i++)
639 for (j = 0; j < 4; j++)
641 _m[i][j] = (i == j ? 1 : 0);
666 double cosa = cos(a);
667 double sina = sin(a);
678 double cosa = cos(a);
679 double sina = sin(a);
690 double cosa = cos(a);
691 double sina = sin(a);
703 double n2 = vector.
norme();
706 double n1 = NAN, cos1 = NAN, sin1 = NAN, cos2 = NAN, sin2 = NAN;
708 n1 = sqrt(vector.
_x * vector.
_x + vector.
_y * vector.
_y);
714 sin2 = (vector.
_z >= 0 ? 1 : -1);
718 cos1 = vector.
_x / n1;
719 sin1 = vector.
_y / n1;
721 sin2 = vector.
_z / n2;
723 _m[0][0] = cos2 * cos1;
724 _m[0][1] = cos2 * sin1;
731 _m[2][0] = -sin2 * cos1;
732 _m[2][1] = -sin2 * sin1;
746 double n2 = vector.
norme();
749 double n1 = NAN, cos1 = NAN, sin1 = NAN, cos2 = NAN, sin2 = NAN;
751 n1 = sqrt(vector.
_x * vector.
_x + vector.
_y * vector.
_y);
757 sin2 = (vector.
_z >= 0 ? 1 : -1);
765 n1 = (vector.
_y < 0.0 ? -n1 : n1);
767 cos1 = vector.
_y / n1;
768 sin1 = vector.
_x / n1;
770 sin2 = vector.
_z / n2;
776 _m[1][0] = sin1 * cos2;
777 _m[1][1] = cos1 * cos2;
780 _m[2][0] = -sin1 * sin2;
781 _m[2][1] = -cos1 * sin2;
803 for (
int i = 0; i < 4; i++)
805 for (
int j = 0; j < 4; j++)
807 _m[i][j] =
_m[i][j] / det;
826 double a1 = NAN, a2 = NAN, a3 = NAN, a4 = NAN, b1 = NAN, b2 = NAN, b3 = NAN, b4 = NAN;
827 double c1 = NAN, c2 = NAN, c3 = NAN, c4 = NAN, d1 = NAN, d2 = NAN, d3 = NAN, d4 = NAN;
877 double a1 = NAN, a2 = NAN, a3 = NAN, a4 = NAN, b1 = NAN, b2 = NAN, b3 = NAN, b4 = NAN, c1 = NAN, c2 = NAN,
878 c3 = NAN, c4 = NAN, d1 = NAN, d2 = NAN, d3 = NAN, d4 = NAN;
903 return a * d - b *
c;
906 double OMatrix::mat3x3Det(
double a1,
double a2,
double a3,
double b1,
double b2,
double b3,
double c1,
907 double c2,
double c3)
932 double ca = (ptA.
_x != ptB.
_x) ?
coeff_ang(ptA, ptB) : HUGE_VAL;
934 double cp = (ptS.
_x - my.
_x) ?
coeff_ang(my, ptS) : HUGE_VAL;
943 double d = (ptC.
_x - ptD.
_x) * (ptA.
_y - ptB.
_y) - (ptC.
_y - ptD.
_y) * (ptA.
_x - ptB.
_x);
947 k = ((ptA.
_x - ptD.
_x) * (ptA.
_y - ptB.
_y) - (ptA.
_y - ptD.
_y) * (ptA.
_x - ptB.
_x)) / d;
952 d = (ptC.
_x - ptD.
_x) * (ptA.
_z - ptB.
_z) - (ptC.
_z - ptD.
_z) * (ptA.
_x - ptB.
_x);
955 k = ((ptA.
_x - ptD.
_x) * (ptA.
_z - ptB.
_z) - (ptA.
_z - ptD.
_z) * (ptA.
_x - ptB.
_x)) / d;
960 d = (ptC.
_y - ptD.
_y) * (ptA.
_z - ptB.
_z) - (ptC.
_z - ptD.
_z) * (ptA.
_y - ptB.
_y);
963 k = ((ptA.
_y - ptD.
_y) * (ptA.
_z - ptB.
_z) - (ptA.
_z - ptD.
_z) * (ptA.
_y - ptB.
_y)) / d;
970 ptI.
_x = ptD.
_x + k * (ptC.
_x - ptD.
_x);
971 ptI.
_y = ptD.
_y + k * (ptC.
_y - ptD.
_y);
972 ptI.
_z = ptD.
_z + k * (ptC.
_z - ptD.
_z);
997 k = (ptP.
_x - ptA.
_x) * vecAB.
_x + (ptP.
_y - ptA.
_y) * vecAB.
_y + (ptP.
_z - ptA.
_z) * vecAB.
_z;
998 k /= vecAB.
_x * vecAB.
_x + vecAB.
_y * vecAB.
_y + vecAB.
_z * vecAB.
_z;
1012 ptI = 2 * (vecPtA + (k * vecAB)) - vecPtP;
1021 double anglesum = 0;
1025 for (i = 0; i < nbPts; i++)
1027 vec2 =
OVector3D(ptP, pts[(i + 1) % nbPts]);
1035 angle = acos((vec1.
scalar(vec2)) / (m1m2));
1037 sign = (vec1.
cross(vec2).
_z > 0) ? -1 : 1;
1038 anglesum += (angle * sign);
1048 int cross = 0, i = 0;
1049 for (i = 0; i < nbPts - 1; i++)
1060 return cross % 2 != 0;
1065 OPoint3D& ptB,
double* mua,
double* mub)
1068 double d1343 = NAN, d4321 = NAN, d1321 = NAN, d4343 = NAN, d2121 = NAN;
1069 double numer = NAN, denom = NAN;
1070 p13.
_x = pt1.
_x - pt3.
_x;
1071 p13.
_y = pt1.
_y - pt3.
_y;
1072 p13.
_z = pt1.
_z - pt3.
_z;
1073 p43.
_x = pt4.
_x - pt3.
_x;
1074 p43.
_y = pt4.
_y - pt3.
_y;
1075 p43.
_z = pt4.
_z - pt3.
_z;
1080 p21.
_x = pt2.
_x - pt1.
_x;
1081 p21.
_y = pt2.
_y - pt1.
_y;
1082 p21.
_z = pt2.
_z - pt1.
_z;
1087 d1343 = p13.
_x * p43.
_x + p13.
_y * p43.
_y + p13.
_z * p43.
_z;
1088 d4321 = p43.
_x * p21.
_x + p43.
_y * p21.
_y + p43.
_z * p21.
_z;
1089 d1321 = p13.
_x * p21.
_x + p13.
_y * p21.
_y + p13.
_z * p21.
_z;
1090 d4343 = p43.
_x * p43.
_x + p43.
_y * p43.
_y + p43.
_z * p43.
_z;
1091 d2121 = p21.
_x * p21.
_x + p21.
_y * p21.
_y + p21.
_z * p21.
_z;
1092 denom = d2121 * d4343 - d4321 * d4321;
1097 numer = d1343 * d4321 - d1321 * d4343;
1098 *mua = numer / denom;
1099 *mub = (d1343 + d4321 * (*mua)) / d4343;
1100 ptA.
_x = pt1.
_x + *mua * p21.
_x;
1101 ptA.
_y = pt1.
_y + *mua * p21.
_y;
1102 ptA.
_z = pt1.
_z + *mua * p21.
_z;
1103 ptB.
_x = pt3.
_x + *mub * p43.
_x;
1104 ptB.
_y = pt3.
_y + *mub * p43.
_y;
1105 ptB.
_z = pt3.
_z + *mub * p43.
_z;
1115 ptMax = ptMin = pts[0];
1116 for (
int i = 0; i < nbPts; i++)
1119 if (pts[i]._x <= ptMin.
_x)
1121 ptMin.
_x = pts[i].
_x;
1123 if (pts[i]._y <= ptMin.
_y)
1125 ptMin.
_y = pts[i].
_y;
1127 if (pts[i]._z <= ptMin.
_z)
1129 ptMin.
_z = pts[i].
_z;
1132 if (pts[i]._x >= ptMax.
_x)
1134 ptMax.
_x = pts[i].
_x;
1136 if (pts[i]._y >= ptMax.
_y)
1138 ptMax.
_y = pts[i].
_y;
1140 if (pts[i]._z >= ptMax.
_z)
1142 ptMax.
_z = pts[i].
_z;
1149 double ax = NAN, ay = NAN, az = NAN, bx = NAN, by = NAN, bz = NAN;
1157 for (
int i = 2; i < nbPts; i++)
1163 ax = vecPt2.
_x - vecPt1.
_x;
1164 ay = vecPt2.
_y - vecPt1.
_y;
1165 az = vecPt2.
_z - vecPt1.
_z;
1166 bx = vecPt0.
_x - vecPt1.
_x;
1167 by = vecPt0.
_y - vecPt1.
_y;
1168 bz = vecPt0.
_z - vecPt1.
_z;
1169 vec.
_x += (ay * bz - az * by);
1170 vec.
_y += (az * bx - ax * bz);
1171 vec.
_z += (ax * by - ay * bx);
1251 if ((0.0 <= k) && (k <= 1.0))
1271 double mua = NAN, mub = NAN;
1278 if ((0.0 <= mua) && (mua <= 1.0) && (0.0 <= mub) && (mub <= 1.0))
1283 if (vecSeg.
norme() <= seuilConfondus)
1296 double x = NAN, y = NAN, z = NAN;
1307 double demiLongueur =
longueur() / 2;
1308 double x = NAN, y = NAN, z = NAN;
1312 if (R > demiLongueur)
1314 double d = sqrt(R * R - demiLongueur * demiLongueur);
1319 y = milieu.
_y + d / sqrt(1 + q * q);
1321 z = milieu.
_z + sqrt(
ABS(d * d - (y - milieu.
_y) * (y - milieu.
_y)));
1332 double angle = 2 * asin(cote / R);
1347 ORepere3D::ORepere3D() : _origin(0, 0, 0), _vecI(1, 0, 0), _vecJ(0, 1, 0), _vecK(0, 0, 1) {}
1356 : _origin(origin), _vecI(vecI), _vecJ(vecJ), _vecK(vecK)
1376 double y2 = (y1 != 0.) ? -(x1 * x1 + z1 * z1) / y1 : -(x1 * x1 + z1 * z1);
1388 if (
this != &repere)
1400 if (
this != &repere)
1503 OBox::OBox(
double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
1701 :
OBox(), _repere(
ORepere3D()), _center(0.0, 0.0, 0.0), _A(0.0, 0.0, 0.0), _B(0.0, 0.0, 0.0),
1702 _C(0.0, 0.0, 0.0), _D(0.0, 0.0, 0.0), _E(0.0, 0.0, 0.0), _F(0.0, 0.0, 0.0), _G(0.0, 0.0, 0.0),
1703 _H(0.0, 0.0, 0.0), _length(0.0), _height(0.0), _width(0.0)
1719 _center =
OPoint3D((maxX - minX) / 2.0 + minX, (maxY - minY) / 2.0 + minY, (maxZ - minZ) / 2.0 + minZ);
1753 OBox2::OBox2(
const double& length,
const double& width,
const double& height)
1754 : _center(
OPoint3D(0.0, 0.0, 0.0)), _length(length), _height(height), _width(width)
1929 OBox2 box, boxIn = *
this;
1958 if (v1.
_z == 0 && v2.
_z == 0)
1963 else if (v1.
_y == 0 && v2.
_y == 0)
1971 return this->
rot3D(v1, v2, O, P2);
2017 double alpha = v1.
angle(v2);
2025 return OBox2(box, r, O);
2036 double theta = v1.
angle(v2);
2047 return OBox2(box, r, O);
2068 double alpha = v1.
angle(O2H);
2078 double theta = O2H.
angle(v2);
2087 return OBox2(box, r, O);
2143 res = res && (
_N == Plane.
_N);
2144 res = res && (
_p == Plane.
_p);
2171 double D =
DOT(
_N, u);
2172 double N = -
DOT(
_N, w);
2187 if ((sI < 0.0f) || (sI > 1.0f))
::std::ostream & operator<<(::std::ostream &os, const OCoord3D &c)
OVector3D operator*(const double a, const OVector3D &vector)
#define coeff_ang(PA, PB)
All base classes related to 3D manipulation.
double BORNE(double a, double b, double c)
Limit a number.
#define INTERS_OUI
The intersection exists.
double SIGNE(double a)
Return the number sign.
double ABS(double a)
Return the absolute value.
std::vector< OPoint3D > TabPoint3D
#define INTERS_NULLE
No intersection.
Class to define a box (not necessary parallel to the axis as OBox)
virtual bool operator==(const OBox2 &box) const
virtual bool isInside(const OPoint3D &pt) const
Test whether the point is inside the box or not.
OBox2 rotInXOZOnly(const OVector3D &v1, const OVector3D &v2, const OPoint3D &O, const OPoint3D &P2)
OBox2()
Default constructor.
virtual bool isInside2D(const OPoint3D &pt) const
Test whether the point is inside the box or not (from upper point of view).
OPoint3D BoxCoord(int N) const
Returns the coordinates of one of the box corner. \ We consider that the first corner is the one on t...
OBox2 boxRotation(const OPoint3D &O, const OPoint3D &P2)
OBox2 rot3D(const OVector3D &v1, const OVector3D &v2, const OPoint3D &O, const OPoint3D &P2)
virtual OBox2 & operator=(const OBox2 &box)
virtual void Translate(const OVector3D &vect)
Translate this box.
void moveAndRotate(const OPoint3D &origin, const OVector3D &vec)
Move and rotate the box.
OBox2 rotInXOYOnly(const OVector3D &v1, const OVector3D &v2, const OPoint3D &O, const OPoint3D &P2)
void BoxRotationOzOy(double alpha, double theta)
Computes the box rotation around Oz and Oy (usual coordinates system).
virtual bool isInContact(const OBox &box) const
Test whether the boxes are in contact or not.
virtual bool isInside2D(const OPoint3D &pt) const
Test whether the point is inside the box or not (from upper point of view).
virtual bool isInside(const OPoint3D &pt) const
Test whether the point is inside the box or not.
virtual void Enlarge(const OPoint3D &pt)
Enlarge the box with the point if the point is outside the box.
OPoint3D _min
Minimal coordinates of the OBox.
virtual bool operator==(const OBox &box) const
OPoint3D _max
Maximal coordinates of the OBox.
virtual void Translate(const OPoint3D &vectorTranslate)
Translate this box.
OBox()
Default constructor.
virtual OBox & operator=(const OBox &box)
double _y
y coordinate of OCoord3D
OCoord3D & operator=(const OCoord3D &coord)
operator=
OCoord3D()
Default constructor.
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
bool operator==(const OCoord3D &coord) const
operator==
void setCoords(double x, double y, double z)
Sets the coordinates as an array of double.
bool operator!=(const OCoord3D &coord) const
operator!=
double * getCoords()
Gets the coordinates as an array of double.
virtual ~OCoord3D()
Destructor.
static void boundingBox(OPoint3D *pts, int nbPts, OPoint3D &ptMin, OPoint3D &ptMax)
Computes the simple bounding box for a volume using min-max method.
static bool intersDemiSegmentAvecSegment(const OPoint3D &ptS, const OPoint3D &ptA, const OPoint3D &ptB)
Return true if the horizontal from the ptS point intersects the segment defined by ptA and ptB.
static void computeNormal(OPoint3D *pts, int nbPts, OVector3D &normal)
Computes the normal of the list of points.
static bool shortestSegBetween2Lines(const OPoint3D &pt1, const OPoint3D &pt2, const OPoint3D &pt3, const OPoint3D &pt4, OPoint3D &ptA, OPoint3D &ptB, double *mua, double *mub)
Calculates the line segment PaPb that is the shortest route between two lines P1P2 and P3P4.
static double symPointDroite(const OPoint3D &ptA, const OPoint3D &ptB, const OPoint3D &ptP, OPoint3D &ptI)
Calculate the symmetrical of a point with respect to a line (defined by two points).
static bool pointInPolygonAngleSum(const OPoint3D &ptP, const OPoint3D *pts, int nbPts)
Tests if a point is inside a polygon using angle sum algorithm.
static bool pointInPolygonRayCasting(const OPoint3D &ptP, const OPoint3D *pts, int nbPts)
Tests if a point is inside a polygon using ray casting algorithm.
static int intersDroitesPointVecteur(const OPoint3D &ptA, const OVector3D &vecA, const OPoint3D &ptB, const OVector3D &vecB, OPoint3D &ptI)
Calculate the intersection between two lines each defined by a point and a vector.
static int intersDroitesPoints(const OPoint3D &ptA, const OPoint3D &ptB, const OPoint3D &ptC, const OPoint3D &ptD, OPoint3D &ptI)
Calculate the intersection between two lines each defined by two points.
The 3D Plane class using Hessian normal form.
bool operator!=(const OHPlane3D &Plane) const
bool operator==(const OHPlane3D &Plane) const
int intersects(const OPoint3D &pt1, const OPoint3D &pt2, OPoint3D &ptIntersec, double &t) const
Calculate the intersection with a segment defined by two points.
OHPlane3D & operator=(const OHPlane3D &Plane)
virtual ~OHPlane3D()
Destructor.
void set(const OVector3D &normal, const OPoint3D &origin)
set a new Plane.
OHPlane3D()
Default constructor.
virtual ~OMatrix()
Destructor.
OCoord3D scale(const OCoord3D &coord) const
static double mat3x3Det(double a1, double a2, double a3, double b1, double b2, double b3, double c1, double c2, double c3)
Compute a 3 x 3 matrix determinant.
int setRotationOz(double a)
Update a rotation matrix (Oz axis).
int setRotationOy(double a)
Update a rotation matrix (Oy axis).
int invert()
Matrix inversion.
void reset()
Set the matrix elements to zero.
OMatrix getInvert(int *ok=0) const
Return the inverse matrix of this matrix.
static double mat2x2Det(double a, double b, double c, double d)
Compute a 2 x 2 matrix determinant.
void unite()
Initialize the matrix to the identity matrix.
OMatrix operator*(const OMatrix &matrix) const
OVector3D multNormal(const OVector3D &normal) const
Multiplication with a normal (the translation is removed).
int aligneVecteurSurOx(const OVector3D &vector)
Mise a jour d'une matrice d'alignement d'un vecteur quelconque avec l'axe des x.
OMatrix & operator=(const OMatrix &matrix)
operators
OMatrix operator-(const OMatrix &matrix) const
OMatrix()
Default constructor.
int setRotationOx(double a)
Update a rotation matrix (Ox axis).
bool operator==(const OMatrix &matrix) const
OMatrix operator+(const OMatrix &matrix) const
void adjoint()
Calculate the adjoint matrix from this matrix.
bool operator!=(const OMatrix &matrix) const
void show()
Print a matrix (debug).
int setTranslation(double x, double y, double z)
Update a translation matrix.
OMatrix getAdjoint()
Return the adjoint matrix.
double determinant()
Compute the matrix determinant.
int aligneVecteurSurOy(const OVector3D &vector)
Mise a jour d'une matrice d'alignement d'un vecteur quelconque avec l'axe des y.
OCoord3D dot(const OCoord3D &coord) const
Multiplication with a 3D coordinate.
int setScale(double x, double y, double z)
Update a zoom matrix.
double _m[4][4]
The 4x4 matrix array.
virtual ~OPoint3D()
Destructor.
virtual void set(double x, double y, double z)
double dist2DFrom(const OPoint3D &pt) const
Computes the distance from this point to another in 2D plan.
double distFrom(const OPoint3D &pt) const
Computes the distance from this point to another.
OPoint3D()
Default constructor.
virtual void getToOGL(double &x, double &y, double &z)
virtual void setFromOGL(double x, double y, double z)
static TabPoint3D checkPointsMaxDistance(const TabPoint3D &points, const double &distanceMax)
3D frame with a point and 3 vectors.
void normalize()
Normalize each vectors composing this frame.
OVector3D _vecK
Vector K for the Z axis.
bool operator==(const ORepere3D &repere) const
operator==
OVector3D _vecJ
Vector J for the Y axis.
ORepere3D & operator=(const ORepere3D &repere)
operator=
void set(const OPoint3D &origin, const OVector3D &vecI, const OVector3D &vecJ, const OVector3D &vecK)
Sets with a point and 3 vectors.
OVector3D _vecI
Vector I for the X axis.
OPoint3D _origin
The origin point.
ORepere3D()
Default constructor.
OMatrix asMatrix() const
return the transformation matrix from unity to this pose such as this = transform * unity
bool operator!=(const ORepere3D &repere) const
operator!=
virtual ~ORepere3D()
Destructor.
Class to define a segment.
virtual double longueur() const
Return the segment length.
virtual OPoint3D centreOf() const
Return the position of the segment middle.
virtual ~OSegment3D()
Destructor.
virtual OPoint3D centerOfCurvedPath(const double &R) const
Return the position of the arc circle center of radius R passing by the segment extremities.
OSegment3D()
Default constructor.
virtual int symetrieOf(const OPoint3D &pt, OPoint3D &ptSym) const
Return the symmetrical of a point.
virtual double lengthOfCurvedPath(const double &R)
Calculate the path length of radius R passing by the segment extremities.
OPoint3D _ptA
Point A of the segment.
virtual bool operator!=(const OSegment3D &other) const
operator!=
virtual int projection(const OPoint3D &pt, OPoint3D &ptProj, double seuilConfondus) const
Return the projection of a point.
virtual int intersects(const OSegment3D &seg, OPoint3D &pt, double seuilConfondus) const
Return the intersection point with another segment.
virtual OSegment3D swap() const
Return the segment.
virtual OSegment3D operator*(const OMatrix &matrix) const
Multiplication with a matrix.
virtual bool operator==(const OSegment3D &other) const
operator==
virtual OSegment3D & operator=(const OSegment3D &other)
operator=
OPoint3D _ptB
Point B of the segment.
OVector3D operator*(const OVector3D &vector) const
double norme() const
Computes the length of this vector.
OVector3D getRotationOzBase2(double alpha)
Returns the vector after a rotation around z axis \ and gives back the coordinates of xprime or yprim...
void invert()
Inverts this vector.
OVector3D normal(const OVector3D &vector2, const OVector3D &vector3) const
Computes the normal with this vector and 2 others.
void balance(double c1, const OVector3D &vector2, double c2)
Balances this vector.
virtual ~OVector3D()
Destructor.
OVector3D operator-(const OVector3D &vector) const
OVector3D getRotationOzOy(double alpha, double theta)
Returns the vector after 2 rotations around z axis and y axis. It gives the coordinates of xsecond,...
bool operator!=(const OVector3D &vector) const
bool operator==(const OVector3D &vector) const
void normalize()
Normalizes this vector.
double scalar(const OVector3D &vector) const
Performs the scalar product between this object and another vector.
OVector3D cross(const OVector3D &vector) const
Cross product.
double angle(const OVector3D &vector) const
Computes the angle between this vector and another vector.
OVector3D()
Default constructor.
OVector3D operator+(const OVector3D &vector) const
OVector3D getRotationOz(double alpha)
Returns the vector after a rotation around z axis \ x -> xprime. Both of these vectors will be given ...
OVector3D & operator=(const OVector3D &vector)
operators
OVector3D getRotationOyBase2(double alpha)
Returns the vector after a rotation around y axis \ and gives back the coordinates of xprime or zprim...
OVector3D getRotationOy(double alpha)
Returns the vector after a rotation around z axis.
void reset()
Reset this vector.