| 36 | // length() must not return 0 |
| 37 | return (*this) * (k / length()); } |
| 38 | point3d getProjection(P(A), P(B)) const { |
| 39 | point3d v = B - A; |
| 40 | return A + v.normalize((v % (*this - A)) / v.length()); } |
| 41 | point3d rotate(P(normal)) const { |
| 42 | //normal must have length 1 and be orthogonal to the vector |
| 43 | return (*this) * normal; } |