33 assert(!ALineDirection.
isNull());
40 ( ( AVertex.
getX() - ALineVertex.
getX() ) * ALineDirection.
getX() +
41 ( AVertex.
getY() - ALineVertex.
getY() ) * ALineDirection.
getY() +
42 ( AVertex.
getZ() - ALineVertex.
getZ() ) * ALineDirection.
getZ() ) / n2;
44 return ALineVertex + t*ALineDirection;
80 #define X (AVertex.getX())
81 #define Y (AVertex.getY())
82 #define Z (AVertex.getZ())
98 assert(!APlaneNormal.
isNull());
112 #define A (APlaneNormal.getX())
113 #define B (APlaneNormal.getY())
114 #define C (APlaneNormal.getZ())
115 #define D (- (A * APlaneVertex.getX() + \
116 B * APlaneVertex.getY() + \
117 C * APlaneVertex.getZ()))
140 return ACenter + ACoef*(AVertex-ACenter);
148 return ACenter + ACoef.
multiply(AVertex-ACenter);
157 assert(!ALineDirection.
isNull());
159 ALineVertex, ALineDirection);
160 return center + ACoef*(AVertex-center);
169 assert(!APlaneNormal.
isNull());
171 APlaneVertex, APlaneNormal);
172 return center + ACoef*(AVertex-center);
179 return (AVertex-AOtherVertex).norm();
188 return (AVertex-proj).norm();
197 return (AVertex-proj).norm();
205 assert(!AVector1.
isNull());
206 assert(!AVector2.
isNull());
211 if ((V1+V2).isNull())
220 if (
isPositive((AVector1*AVector2).dot(ANormal)))
230 assert(!AVector.
isNull());
233 return AVector.
norm()*OX;
240 return (AVector.
norm()/V.norm()) * V;
258 return ((n1+n2)/(2*V.
norm()))*V;
273 assert(ALine1Vertex1 != ALine1Vertex2);
274 assert(ALine2Vertex1 != ALine2Vertex2);
276 #define A (ALine1Vertex1)
277 #define B (ALine1Vertex2)
278 #define C (ALine2Vertex1)
279 #define D (ALine2Vertex2)
301 return (AVector1*AVector2).isNull();
317 if (!n .isNull()) n /= n .
norm();
321 if (cosinus > +1) cosinus = +1;
322 if (cosinus < -1) cosinus = -1;
351 matrix.
rotate(Vz, -gamma);
368 return CVertex(alpha,beta,gamma);
377 assert(!ALineDirection.
isNull());
378 assert(!APlaneNormal.
isNull());
380 CVertex direction = ALineDirection / ALineDirection.
norm();
381 CVertex normal = APlaneNormal / APlaneNormal .
norm();
383 return sign((direction * normal).dot(AVertex-ALineVertex));
392 int& AIntersection1On,
394 int& AIntersection2On,
397 assert(!APlaneNormal.
isNull());
399 bool nullLength1 = AVertexA == AVertexB;
400 bool nullLength2 = AVertexC == AVertexD;
403 if (nullLength1 || nullLength2)
406 if (nullLength1 && nullLength2)
408 AIntersection1On = AIntersection2On = 0;
414 AIntersection1On = 0;
415 AIntersection2On = 0;
421 CVertex directionAB = AVertexB - AVertexA;
422 CVertex directionCD = AVertexD - AVertexC;
425 AVertexC, directionCD,
429 AVertexC, directionCD,
437 { & AVertexA, & AVertexB, & AVertexC, & AVertexD };
439 CVertex normal = directionAB * APlaneNormal;
442 normal /= normal.
norm();
449 for (j=i+1; j<4; ++j)
451 normal, APlaneNormal) == 1)
453 const CVertex * tmp = vertices[i];
454 vertices[i] = vertices[j];
458 bool firstSegment[4];
461 firstSegment[i] = vertices[i]==&AVertexA || vertices[i]==&AVertexB;
464 if (firstSegment[0]==firstSegment[1])
467 AIntersection1On = AIntersection2On = 0;
472 if (*vertices[0] == *vertices[1])
473 AIntersection1On = 0;
476 AIntersection1On = firstSegment[0] ? 1 : 2;
477 AIntersection1 = * vertices[1];
480 if (*vertices[2] == *vertices[3])
481 AIntersection2On = 0;
484 AIntersection2On = firstSegment[3] ? 1 : 2;
485 AIntersection2 = * vertices[2];
493 AVertexA, directionAB,
497 AVertexA, directionAB,
505 AIntersection1On = (combineAB==-1 && combineCD<=0) ? 1 : 0;
506 AIntersection2On = (combineCD==-1 && combineAB<=0) ? 2 : 0;
508 if (AIntersection1On!=0 || AIntersection2On!=0)
510 AIntersection1 = AIntersection2 =
521 int& AIntersection1On,
523 int& AIntersection2On,
528 AIntersection1On, AIntersection1,
529 AIntersection2On, AIntersection2);
547 return AC * (AB * AC);