| 1124 | /// \brief Returns the projection of the 3D point $p$ onto the 3D line $l$ under the assumption that the line is unitized. |
| 1125 | |
| 1126 | inline Point3D Project(const Point3D& p, const Line3D& l) |
| 1127 | { |
| 1128 | float d = Dot(l.v, p); |
| 1129 | return (Point3D(d * l.v.x + l.v.y * l.m.z - l.v.z * l.m.y, d * l.v.y + l.v.z * l.m.x - l.v.x * l.m.z, d * l.v.z + l.v.x * l.m.y - l.v.y * l.m.x)); |
| 1130 | } |
| 1131 | |
| 1132 | /// \brief Returns the projection of the 3D point $p$ onto the 3D plane $g$ under the assumption that the plane is unitized. |
| 1133 | |