| 29 | // A and B must be two different points |
| 30 | return ((*this - A) * (*this - B)).length() / A.distTo(B);} |
| 31 | double signedDistTo(PL(A,B,C)) const { |
| 32 | // A, B and C must not be collinear |
| 33 | point3d N = (B-A)*(C-A); double D = A%N; |
| 34 | return ((*this)%N - D)/N.length(); } |
| 35 | point3d normalize(double k = 1) const { |
| 36 | // length() must not return 0 |
| 37 | return (*this) * (k / length()); } |