| 72 | } |
| 73 | |
| 74 | LinePlaneIntersectionType LNLib::Intersection::ComputeLineAndPlane( |
| 75 | const XYZ& normal, |
| 76 | const XYZ& pointOnPlane, |
| 77 | const XYZ& pointOnLine, |
| 78 | const XYZ& lineDirection, |
| 79 | XYZ& intersectPoint) |
| 80 | { |
| 81 | double denom = lineDirection.DotProduct(normal); |
| 82 | |
| 83 | XYZ P0Q = pointOnLine - pointOnPlane; |
| 84 | double numer = -P0Q.DotProduct(normal); |
| 85 | |
| 86 | if (MathUtils::IsAlmostEqualTo(std::abs(denom),0.0)) { |
| 87 | if (MathUtils::IsAlmostEqualTo(std::abs(numer), 0.0)) { |
| 88 | intersectPoint = pointOnLine; |
| 89 | return LinePlaneIntersectionType::On; |
| 90 | } |
| 91 | else { |
| 92 | return LinePlaneIntersectionType::Parallel; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | double t = numer / denom; |
| 97 | intersectPoint = pointOnLine + t * lineDirection; |
| 98 | return LinePlaneIntersectionType::Intersecting; |
| 99 | } |
nothing calls this directly
no test coverage detected