| 13 | #include "MathUtils.h" |
| 14 | |
| 15 | LNLib::XYZ LNLib::Projection::PointToRay(const XYZ& origin, const XYZ& vector, const XYZ& point) |
| 16 | { |
| 17 | XYZ diff = point - origin; |
| 18 | double dot = diff.DotProduct(vector); |
| 19 | double lenSqr = vector.DotProduct(vector); |
| 20 | |
| 21 | double t = dot / lenSqr; |
| 22 | return origin + t * vector; |
| 23 | } |
| 24 | |
| 25 | bool LNLib::Projection::PointToLine(const XYZ& start, const XYZ& end, const XYZ& point, XYZ& projectPoint) |
| 26 | { |
nothing calls this directly
no test coverage detected