94 a_vertex1.
subr(a_vertex0, u);
95 a_vertex2.
subr(a_vertex0, v);
96 return (0.5 * (
cCross(u,v).length()));
125 projectionMatrix.
set(
126 (n(1) * n(1)) + (n(2) * n(2)), -(n(0) * n(1) ),-(n(0) * n(2)),
127 -(n(1) * n(0)), (n(0) * n(0)) + (n(2) * n(2) ),-(n(1) * n(2)),
128 -(n(2) * n(0)),-(n(2) * n(1)), (n(0) * n(0) ) + (n(1) * n(1))
133 a_point.
subr(a_planePoint, point);
134 projectionMatrix.
mul(point);
135 point.
add(a_planePoint);
166 a_planePoint1.
subr(a_planePoint0, v01);
167 a_planePoint2.
subr(a_planePoint0, v02);
222 double m00 = v01(0) * v01(0) + v01(1) * v01(1) + v01(2) * v01(2);
223 double m01 = v01(0) * v02(0) + v01(1) * v02(1) + v01(2) * v02(2);
225 double m11 = v02(0) * v02(0) + v02(1) * v02(1) + v02(2) * v02(2);
226 double det = m00 * m11 - m10 * m01;
229 double vm0 = v01(0) * point(0) + v01(1) * point(1) + v01(2) * point(2);
230 double vm1 = v02(0) * point(0) + v02(1) * point(1) + v02(2) * point(2);
233 a_r01 = (1.0 / det) * ( m11 * vm0 - m01 * vm1);
234 a_r02 = (1.0 / det) * (-m10 * vm0 + m00 * vm1);
263 double lengthDirSq = a_directionOfLine.
lengthsq();
265 if (lengthDirSq > 0.0)
267 a_point.
subr(a_pointOnLine, point);
269 a_directionOfLine.
mulr( (point.
dot(a_directionOfLine) / (lengthDirSq)),
272 result.
add(a_pointOnLine);
277 return (a_pointOnLine);
304 if (a_segmentPointA.
equals(a_segmentPointB))
306 return (a_segmentPointA);
311 a_segmentPointB.
subr(a_segmentPointA, segmentAB);
316 double distanceAB = segmentAB.
lengthsq();
317 double distanceAP =
cDistanceSq(projection, a_segmentPointA);
318 double distanceBP =
cDistanceSq(projection, a_segmentPointB);
320 if (distanceAP > distanceAB)
322 return(a_segmentPointB);
325 if (distanceBP > distanceAB)
327 return(a_segmentPointA);
358 const double& a_height,
359 const double& a_radius)
364 pointProj(2) = a_height;
368 if (ray.
length() < a_radius)
return (pointProj);
372 return center + a_radius * ray;
406 if ((r01 >= 0.0) && (r02 >= 0.0) && (r01 <= 1.0) && (r02 <= 1.0) && ((r01 + r02) <= 1.0))
408 result = a_vertex0 + r01 * (a_vertex1 - a_vertex0) + r02 * (a_vertex2 - a_vertex0);
476 double lengthSq = a_vector1.
lengthsq();
477 a_vector1.
mulr( (a_vector0.
dot(a_vector1) / (lengthSq)), result);
533 a_surfacePoint1.
subr(a_surfacePoint0, v01);
534 a_surfacePoint2.
subr(a_surfacePoint0, v02);
568 if ((a_point(0) >= a_boxMin(0) ) && (a_point(0) <= a_boxMax(0)) &&
569 (a_point(1) >= a_boxMin(1) ) && (a_point(1) <= a_boxMax(1)) &&
570 (a_point(2) >= a_boxMin(2) ) && (a_point(2) <= a_boxMax(2)))
618 cVector3d d = a_segmentPointB - a_segmentPointA;
620 double length = d.
length();
635 c[0] = a_planeNormal(0)*p(0) - a_planeNormal(0)*a_planePos(0) +
636 a_planeNormal(1)*p(1) - a_planeNormal(1)*a_planePos(1) +
637 a_planeNormal(2)*p(2) - a_planeNormal(2)*a_planePos(2);
638 c[1] = a_planeNormal(0)*d(0) + a_planeNormal(1)*d(1) + a_planeNormal(2)*d(2);
648 if ((s[0] >= 0.0) && (s[0] <= length))
650 a_collisionPoint = p + s[0] * d;
651 if (
cDot(a_planeNormal,
cSub(a_segmentPointA, a_collisionPoint)) >= 0.0)
653 a_collisionNormal = a_planeNormal;
657 a_collisionNormal =-a_planeNormal;
704 const double& a_diskRadius,
714 a_collisionNormal) == 0)
720 if (
cDistance(a_collisionPoint, a_diskPos) <= a_diskRadius)
771 const double& a_sphereRadius,
779 a_segmentPointB.
subr(a_segmentPointA, AB);
780 a_segmentPointA.
subr(a_spherePos, CA);
781 double radiusSq = a_sphereRadius * a_sphereRadius;
784 double b = 2.0 *
cDot(AB, CA);
785 double c = CA.
lengthsq() - radiusSq;
793 double d = b*b - 4*a*c;
806 double u0 = (-b + d) / e;
807 double u1 = (-b - d) / e;
814 if (valid_u0 && valid_u1)
816 if (u0 > u1) {
cSwap(u0, u1); }
819 AB.
mulr(u0, a_collisionPoint0);
820 a_collisionPoint0.
add(a_segmentPointA);
822 a_collisionPoint0.
subr(a_spherePos, a_collisionNormal0);
826 AB.
mulr(u1, a_collisionPoint1);
827 a_collisionPoint1.
add(a_segmentPointA);
829 a_collisionPoint1.
subr(a_spherePos, a_collisionNormal1);
839 AB.
mulr(u0, a_collisionPoint0);
840 a_collisionPoint0.
add(a_segmentPointA);
842 a_collisionPoint0.
subr(a_spherePos, a_collisionNormal0);
847 double dotProduct =
cDot(AB, a_collisionNormal0);
848 if (dotProduct < 0.0)
862 AB.
mulr(u1, a_collisionPoint0);
863 a_collisionPoint0.
add(a_segmentPointA);
865 a_collisionPoint0.
subr(a_spherePos, a_collisionNormal0);
870 double dotProduct =
cDot(AB, a_collisionNormal0);
871 if (dotProduct < 0.0)
931 const double& a_radiusX,
932 const double& a_radiusY,
933 const double& a_radiusZ,
940 double radius =
cMin(a_radiusX,
cMin(a_radiusY, a_radiusZ));
941 double scaleX = a_radiusX / radius;
942 double scaleY = a_radiusY / radius;
943 double scaleZ = a_radiusZ / radius;
945 cVector3d segmentPointA = a_segmentPointA;
946 segmentPointA.
mul(1.0 / scaleX, 1.0 / scaleY, 1.0 / scaleZ);
947 cVector3d segmentPointB = a_segmentPointB;
948 segmentPointB.
mul(1.0 / scaleX, 1.0 / scaleY, 1.0 / scaleZ);
952 segmentPointB.
subr(segmentPointA, AB);
953 segmentPointA.
subr(a_pos, CA);
954 double radiusSq = radius * radius;
957 double b = 2.0 *
cDot(AB, CA);
958 double c = CA.
lengthsq() - radiusSq;
966 double d = b*b - 4 * a*c;
979 double u0 = (-b + d) / e;
980 double u1 = (-b - d) / e;
987 if (valid_u0 && valid_u1)
989 if (u0 > u1) {
cSwap(u0, u1); }
992 AB.
mulr(u0, a_collisionPoint0);
993 a_collisionPoint0.
add(segmentPointA);
994 a_collisionPoint0.
subr(a_pos, a_collisionNormal0);
996 a_collisionNormal0.
mul(1.0 / scaleX, 1.0 / scaleY, 1.0 / scaleZ);
997 a_collisionPoint0.
mul(scaleX, scaleY, scaleZ);
1000 AB.
mulr(u1, a_collisionPoint1);
1001 a_collisionPoint1.
add(segmentPointA);
1002 a_collisionPoint1.
subr(a_pos, a_collisionNormal1);
1004 a_collisionNormal1.
mul(1.0 / scaleX, 1.0 / scaleY, 1.0 / scaleZ);
1005 a_collisionPoint1.
mul(scaleX, scaleY, scaleZ);
1014 AB.
mulr(u0, a_collisionPoint0);
1015 a_collisionPoint0.
add(segmentPointA);
1016 a_collisionPoint0.
subr(a_pos, a_collisionNormal0);
1018 a_collisionNormal0.
mul(1.0 / scaleX, 1.0 / scaleY, 1.0 / scaleZ);
1019 a_collisionPoint0.
mul(scaleX, scaleY, scaleZ);
1023 double dotProduct =
cDot(AB, a_collisionNormal0);
1024 if (dotProduct < 0.0)
1038 AB.
mulr(u1, a_collisionPoint0);
1039 a_collisionPoint0.
add(segmentPointA);
1040 a_collisionPoint0.
subr(a_pos, a_collisionNormal0);
1042 a_collisionNormal0.
mul(1.0 / scaleX, 1.0 / scaleY, 1.0 / scaleZ);
1043 a_collisionPoint0.
mul(scaleX, scaleY, scaleZ);
1047 double dotProduct =
cDot(AB, a_collisionNormal0);
1048 if (dotProduct < 0.0)
1111 const double& a_cylinderRadius,
1114 double& a_collisionPointRelPosAB0,
1117 double& a_collisionPointRelPosAB1)
1120 cVector3d cylinderAB = a_cylinderPointB - a_cylinderPointA;
1121 double lengthCylinderAB = cylinderAB.
length();
1124 if (lengthCylinderAB == 0.0) {
return (0); }
1128 cVector3d RC = a_segmentPointA - a_cylinderPointA;
1129 cVector3d segmentAB = a_segmentPointB - a_segmentPointA;
1130 if (segmentAB.
lengthsq() == 0) {
return (0); }
1136 double length = n.
length();
1143 double d = fabs (
cDot (RC,n));
1145 if (d <= a_cylinderRadius)
1148 double t = -
cDot(O,n) / length;
1149 O =
cCross(n, cylinderDir);
1151 double s = fabs(sqrt(a_cylinderRadius*a_cylinderRadius - d*d) /
cDot(segmentDir,O));
1156 if (u0 > u1) {
cSwap (u0,u1); }
1158 bool valid_u0 =
true;
1159 bool valid_u1 =
true;
1162 double lengthAB = segmentAB.
length();
1163 if (!
cContains(u0, 0.0, lengthAB)) { valid_u0 =
false; }
1164 if (!
cContains(u1, 0.0, lengthAB)) { valid_u1 =
false; }
1172 P0 = a_segmentPointA + u0 * segmentDir;
1176 double cosAngleA =
cCosAngle(cylinderDir, P0A);
1177 double cosAngleB =
cCosAngle(cylinderDirNeg, P0B);
1179 if ((cosAngleA <= 0.0) || (cosAngleB <= 0.0))
1185 a_collisionPointRelPosAB0 = cosAngleA * (P0A.
length() / lengthCylinderAB);
1191 P1 = a_segmentPointA + u1 * segmentDir;
1195 double cosAngleA =
cCosAngle(cylinderDir, P1A);
1196 double cosAngleB =
cCosAngle(cylinderDirNeg, P1B);
1198 if ((cosAngleA <= 0.0) || (cosAngleB <= 0.0))
1204 a_collisionPointRelPosAB1 = cosAngleA * (P1A.
length() / lengthCylinderAB);
1208 if (valid_u0 && valid_u1)
1210 a_collisionPoint0 = P0;
1212 a_collisionPoint1 = P1;
1218 a_collisionPoint0 = P0;
1222 double dotProduct =
cDot(segmentAB, a_collisionNormal0);
1223 if (dotProduct < 0.0)
1234 a_collisionPoint0 = P1;
1238 double dotProduct =
cDot(segmentAB, a_collisionNormal0);
1239 if (dotProduct < 0.0)
1290 const double& a_baseRadius,
1291 const double& a_topRadius,
1292 const double& a_height,
1298 cVector3d d = a_segmentPointB - a_segmentPointA;
1299 double length = d.
length();
1306 d.
mul(1.0 / length);
1309 double A = a_baseRadius;
1310 double B = (a_topRadius - a_baseRadius) / a_height;
1316 c[1] = 2.0*p(0)*d(0) + 2.0*p(1)*d(1) - 2.0*A*B*d(2) - 2.0*
cSqr(B)*p(2)*d(2);
1322 cVector3d collisionPointTop, collisionNormalTop;
1330 collisionNormalTop);
1333 cVector3d collisionPointBase, collisionNormalBase;
1341 collisionNormalBase);
1351 distance =
cDistance(a_segmentPointA, collisionPointTop);
1352 a_collisionPoint = collisionPointTop;
1353 a_collisionNormal =
cVector3d(0.0, 0.0, 1.0);
1360 double dist =
cDistance(a_segmentPointA, collisionPointBase);
1361 if (dist < distance)
1363 a_collisionPoint = collisionPointBase;
1364 a_collisionNormal =
cVector3d(0.0, 0.0,-1.0);
1372 if ((s[0] >= 0.0) && (s[0] <= length) && (s[0] < distance))
1374 cVector3d collisionPoint = p + d * s[0];
1375 if ((collisionPoint(2) > 0.0) && (collisionPoint(2) < a_height))
1377 cVector3d normal(collisionPoint(0), collisionPoint(1), 0.0);
1379 normal(2) = (a_baseRadius - a_topRadius) / a_height;
1380 a_collisionNormal = normal;
1381 a_collisionPoint = collisionPoint;
1391 if ((s[1] >= 0.0) && (s[1] <= length) && (s[1] < distance))
1393 cVector3d collisionPoint = p + d * s[1];
1394 if ((collisionPoint(2) > 0.0) && (collisionPoint(2) < a_height))
1396 cVector3d normal(collisionPoint(0), collisionPoint(1), 0.0);
1398 normal(2) = (a_baseRadius - a_topRadius) / a_height;
1399 a_collisionNormal = normal;
1400 a_collisionPoint = collisionPoint;
1458 cVector3d d = a_segmentPointB - a_segmentPointA;
1459 double distance = d.
length();
1467 double normalDir = 1.0;
1470 for (
int i = 0; i<3; i++)
1475 if (a_segmentPointA(i) < a_boxMin(i) || a_segmentPointA(i) > a_boxMax(i))
1483 double ood = 1.0 / d(i);
1484 double t1 = (a_boxMin(i) - a_segmentPointA(i)) * ood;
1485 double t2 = (a_boxMax(i) - a_segmentPointA(i)) * ood;
1516 if (tmin > distance)
1522 a_collisionPoint = a_segmentPointA +
cMul(tmin, d);
1523 a_collisionNormal.
zero();
1524 a_collisionNormal(normalAxis) = normalDir;
1563 const double& a_innerRadius,
1564 const double& a_outerRadius,
1568 cVector3d collisionPoint, collisionNormal;
1571 double width = a_outerRadius + a_innerRadius;
1572 cVector3d boxMin(-width,-width,-a_innerRadius);
1573 cVector3d boxMax( width, width, a_innerRadius);
1581 collisionNormal) == 0)
1589 double dd =
cDot(d, d);
1590 double pd =
cDot(p, d);
1591 double pp =
cDot(p, p);
1592 double r2 =
cSqr(a_innerRadius);
1593 double R2 =
cSqr(a_outerRadius);
1599 c[3] = 4.0 * dd * pd;
1600 c[2] = 4.0 *
cSqr(pd) + 2.0 * dd * (pp - r2 - R2) + 4.0 * R2 *
cSqr(d(2));
1601 c[1] = 4.0 * pd * (pp - r2 - R2) + 8.0 * R2 * p(2) * d(2);
1602 c[0] =
cSqr(pp - r2 - R2) + 4.0 * R2 *
cSqr(p(2)) - 4.0 * R2 * r2;
1614 for (
int i=0; i<num; i++)
1623 a_collisionPoint = p + sol * d;
1627 a_collisionNormal =
cNormalize(a_collisionPoint - pt);
1673 const bool a_reportFrontSideCollision,
1674 const bool a_reportBackSideCollision,
1677 double& a_collisionPosVertex01,
1678 double& a_collisionPosVertex02
1683 const double C_INTERSECT_EPSILON = 10e-14f;
1687 a_segmentPointB.
subr(a_segmentPointA, rayDir);
1688 double segmentLengthSquare = rayDir.
lengthsq();
1689 if (segmentLengthSquare == 0.0) {
return (
false); }
1693 a_triangleVertex1.
subr(a_triangleVertex0, t_E0);
1694 a_triangleVertex2.
subr(a_triangleVertex0, t_E1);
1699 double dotProduct = t_N.
dot(rayDir);
1700 if (fabs(dotProduct)<10E-15f)
return (
false);
1702 if ((dotProduct < 0.0) && (a_reportFrontSideCollision ==
false))
return (
false);
1703 if ((dotProduct > 0.0) && (a_reportBackSideCollision ==
false))
return (
false);
1705 double t_T =
cDot(t_N,
cSub(a_triangleVertex0, a_segmentPointA)) /
cDot(t_N, rayDir);
1707 if (t_T + C_INTERSECT_EPSILON < 0)
return (
false);
1710 double t_Q0 =
cDot(t_E0,t_Q);
1711 double t_Q1 =
cDot(t_E1,t_Q);
1712 double t_E00 =
cDot(t_E0,t_E0);
1713 double t_E01 =
cDot(t_E0,t_E1);
1714 double t_E11 =
cDot(t_E1,t_E1);
1715 double t_D = (t_E00 * t_E11) - (t_E01 * t_E01);
1717 if ((t_D > -C_INTERSECT_EPSILON) && (t_D < C_INTERSECT_EPSILON))
return(
false);
1719 double t_S0 = ((t_E11 * t_Q0) - (t_E01 * t_Q1)) / t_D;
1720 double t_S1 = ((t_E00 * t_Q1) - (t_E01 * t_Q0)) / t_D;
1724 (t_S0 >= 0.0 - C_INTERSECT_EPSILON) &&
1725 (t_S1 >= 0.0 - C_INTERSECT_EPSILON) &&
1726 ((t_S0 + t_S1) <= 1.0 + C_INTERSECT_EPSILON)
1732 double distanceSquare = a_segmentPointA.
distancesq(t_I);
1735 if (distanceSquare <= segmentLengthSquare)
1737 a_collisionPoint =
cAdd(a_segmentPointA,
cMul(t_T, rayDir));
1739 if (
cCosAngle(a_collisionNormal, rayDir) > 0.0)
1741 a_collisionNormal.
negate();
1744 a_collisionPosVertex01 = t_S0;
1745 a_collisionPosVertex02 = t_S1;
1762 #endif // CGeometryH This class implements a 3D vector.
Definition: CVector3d.h:88
cVector3d cProjectPointOnLine(const cVector3d &a_point, const cVector3d &a_pointOnLine, const cVector3d &a_directionOfLine)
This function computes the projection of a point onto a line.
Definition: CGeometry.h:255
const double C_SMALL
Small value near zero.
Definition: CConstants.h:103
cVector3d cProject(const cVector3d &a_vector0, const cVector3d &a_vector1)
This function computes the projection of a vector V0 onto a vector V1.
Definition: CGeometry.h:470
double cDistance(const cVector3d &a_point1, const cVector3d &a_point2)
This function computes the Euclidean distance between two points.
Definition: CMaths.h:953
void normalize()
This method normalizes this vector to length 1.
Definition: CVector3d.h:1054
void zero()
This method clears all vector components with zeros.
Definition: CVector3d.h:256
bool equals(const cVector3d &a_vector, const double a_epsilon=0.0) const
This method performs an equality test between two vectors.
Definition: CVector3d.h:1201
cVector3d cComputeSurfaceNormal(const cVector3d &a_surfacePoint0, const cVector3d &a_surfacePoint1, const cVector3d &a_surfacePoint2)
This function computes the surface normal of a plane.
Definition: CGeometry.h:526
int cIntersectionSegmentPlane(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_planePos, const cVector3d &a_planeNormal, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal)
This function computes the intersection between a segment and a plane.
Definition: CGeometry.h:611
double distancesq(const cVector3d &a_vector) const
This method computes the squared value distance between two points.
Definition: CVector3d.h:1172
int cSolveQuartic(double a_coefficient[5], double a_solution[4])
This function computes the solution of a quartic equation.
Definition: CPolySolver.h:272
void crossr(const cVector3d &a_vector, cVector3d &a_result) const
This method computes the cross product.
Definition: CVector3d.h:975
double cCosAngle(const cVector3d &a_vector1, const cVector3d &a_vector2)
This function computes the cosine of the angle between two vectors.
Definition: CMaths.h:1424
cVector3d cAdd(const cVector3d &a_vector1, const cVector3d &a_vector2)
This function computes the addition of two vectors.
Definition: CMaths.h:708
cVector3d cProjectPointOnSegment(const cVector3d &a_point, const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB)
This function computes the projection of a point onto a segment.
Definition: CGeometry.h:299
int cSolveQuadric(double a_coefficient[3], double a_solution[2])
This function computes the solution of a quadric equation.
Definition: CPolySolver.h:121
void normalizer(cVector3d &a_result) const
This method normalizes this vector to length 1.
Definition: CVector3d.h:1086
double length() const
This method computes the Euclidean norm of this vector.
Definition: CVector3d.h:1015
cVector3d cSub(const cVector3d &a_vector1, const cVector3d &a_vector2)
This function computes the subtraction of two vectors.
Definition: CMaths.h:769
double cDistanceToLine(const cVector3d &a_point, const cVector3d &a_linePoint1, const cVector3d &a_linePoint2)
This function computes the distance between a point and a line.
Definition: CGeometry.h:501
void mul(const cMatrix3d &a_matrix)
This function computes the multiplication of this matrix with another.
Definition: CMatrix3d.h:883
void mulr(const double &a_scalar, cVector3d &a_result) const
This method computes the multiplication of this vector with a scalar.
Definition: CVector3d.h:739
cVector3d cProjectPointOnDiskXY(const cVector3d &a_point, const double &a_height, const double &a_radius)
This function computes the projection of a point onto a disk.
Definition: CGeometry.h:357
double cTriangleArea(const cVector3d &a_vertex0, const cVector3d &a_vertex1, const cVector3d &a_vertex2)
This function computes the area of a triangle.
Definition: CGeometry.h:89
double cDistanceSq(const cVector3d &a_point1, const cVector3d &a_point2)
This function computes the squared distance between two points.
Definition: CMaths.h:975
bool cBoxContains(const cVector3d &a_point, const cVector3d &a_boxMin, const cVector3d &a_boxMax)
This function checks if a point is contained in a box.
Definition: CGeometry.h:564
int cIntersectionSegmentTorus(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const double &a_innerRadius, const double &a_outerRadius, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal)
This function computes the nearest intersection point between a segment and a torus.
Definition: CGeometry.h:1561
This class implements a 3D matrix.
Definition: CMatrix3d.h:97
void negate()
This method computes the negated vector.
Definition: CVector3d.h:900
int cSolveLinear(double a_coefficient[2], double a_solution[1])
This function computes the solution of a linear equation.
Definition: CPolySolver.h:91
int cIntersectionSegmentEllipsoid(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_pos, const double &a_radiusX, const double &a_radiusY, const double &a_radiusZ, cVector3d &a_collisionPoint0, cVector3d &a_collisionNormal0, cVector3d &a_collisionPoint1, cVector3d &a_collisionNormal1)
This function computes the intersection between a segment and a sphere.
Definition: CGeometry.h:928
cVector3d cMul(const double &a_value, const cVector3d &a_vector)
This function computes the multiplication of a vector by a scalar.
Definition: CMaths.h:824
double lengthsq() const
This method computes the squared value of the Euclidean norm of this vector.
Definition: CVector3d.h:1033
int cIntersectionSegmentToplessCylinder(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_cylinderPointA, const cVector3d &a_cylinderPointB, const double &a_cylinderRadius, cVector3d &a_collisionPoint0, cVector3d &a_collisionNormal0, double &a_collisionPointRelPosAB0, cVector3d &a_collisionPoint1, cVector3d &a_collisionNormal1, double &a_collisionPointRelPosAB1)
This function computes the intersection between a segment and a topless cylinder. ...
Definition: CGeometry.h:1107
double cDot(const cVector3d &a_vector1, const cVector3d &a_vector2)
This function computes the dot product between two vectors.
Definition: CMaths.h:909
void set(const double &a_value)
This method initializes all elements of this matrix with an input value.
Definition: CMatrix3d.h:345
Implements polynomial solvers.
cVector3d cProjectPointOnTriangle(const cVector3d &a_point, const cVector3d &a_vertex0, const cVector3d &a_vertex1, const cVector3d &a_vertex2)
This function computes the projection of a point onto a triangle.
Definition: CGeometry.h:394
void cSwap(T &a_value1, T &a_value2)
This function swaps two elements.
Definition: CMaths.h:309
cVector3d cProjectPointOnPlane(const cVector3d &a_point, const cVector3d &a_planePoint, const cVector3d &a_planeNormal)
This function computes the projection of a point onto a plane.
Definition: CGeometry.h:117
bool cIntersectionSegmentTriangle(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_triangleVertex0, const cVector3d &a_triangleVertex1, const cVector3d &a_triangleVertex2, const bool a_reportFrontSideCollision, const bool a_reportBackSideCollision, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal, double &a_collisionPosVertex01, double &a_collisionPosVertex02)
This function computes the intersection between a segment and a triangle.
Definition: CGeometry.h:1668
cVector3d cNormalize(const cVector3d &a_vector)
This function computes the normalized vector.
Definition: CMaths.h:930
double cSqr(const double &a_value)
This function computes the square of a scalar.
Definition: CMaths.h:454
bool cContains(const T &a_value, const V &a_low, const V &a_high)
This function checks whether a value is within a specified range.
Definition: CMaths.h:429
void subr(const cVector3d &a_vector, cVector3d &a_result) const
This method computes the subtraction of this vector with another.
Definition: CVector3d.h:622
int cIntersectionSegmentCylinder(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const double &a_baseRadius, const double &a_topRadius, const double &a_height, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal)
This function computes the nearest intersection point between a segment and a cylinder.
Definition: CGeometry.h:1288
const double C_LARGE
Biggest value for a double.
Definition: CConstants.h:109
T cMin(const T &a_value1, const T &a_value2)
This function computes the minimum value between two values.
Definition: CMaths.h:242
cVector3d cNegate(const cVector3d &a_vector)
This function computes the negated vector.
Definition: CMaths.h:797
cVector3d cCross(const cVector3d &a_vector1, const cVector3d &a_vector2)
This function computes the cross product between two vectors.
Definition: CMaths.h:881
void mul(const double &a_scalar)
This method computes the multiplication of this vector with a scalar.
Definition: CVector3d.h:680
double dot(const cVector3d &a_vector) const
This method computes the dot product between this vector and another.
Definition: CVector3d.h:998
Definition: CAudioBuffer.cpp:56
int cIntersectionSegmentDisk(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_diskPos, const cVector3d &a_diskNormal, const double &a_diskRadius, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal)
This function computes the intersection between a segment and a disk.
Definition: CGeometry.h:700
int cIntersectionSegmentBox(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_boxMin, const cVector3d &a_boxMax, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal)
This function computes the nearest intersection point between a segment and a box.
Definition: CGeometry.h:1448
void add(const cVector3d &a_vector)
This method computes the addition of this vector with another.
Definition: CVector3d.h:452
bool cZero(const double &a_value)
This function checks if a value is equal to or almost near zero.
Definition: CMaths.h:153
int cIntersectionSegmentSphere(const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_spherePos, const double &a_sphereRadius, cVector3d &a_collisionPoint0, cVector3d &a_collisionNormal0, cVector3d &a_collisionPoint1, cVector3d &a_collisionNormal1)
This function computes the intersection between a segment and a sphere.
Definition: CGeometry.h:768