| 23 | } |
| 24 | |
| 25 | bool LNLib::Projection::PointToLine(const XYZ& start, const XYZ& end, const XYZ& point, XYZ& projectPoint) |
| 26 | { |
| 27 | XYZ direction = end - start; |
| 28 | double lenSqr = direction.DotProduct(direction); |
| 29 | |
| 30 | if (MathUtils::IsAlmostEqualTo(lenSqr, 0.0)) { |
| 31 | return false; |
| 32 | } |
| 33 | |
| 34 | double t = (point - start).DotProduct(direction) / lenSqr; |
| 35 | |
| 36 | if (MathUtils::IsLessThan(t, 0.0) || |
| 37 | MathUtils::IsGreaterThan(t, 1.0)) { |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | projectPoint = start + t * direction; |
| 42 | return true; |
| 43 | } |
| 44 | |
| 45 | LNLib::XYZ LNLib::Projection::Stereographic(const XYZ& pointOnSphere, double radius) |
| 46 | { |
nothing calls this directly
no test coverage detected