| 24 | double length() const { |
| 25 | return sqrt(*this % *this); } |
| 26 | double distTo(P(p)) const { |
| 27 | return (*this - p).length(); } |
| 28 | double distTo(P(A), P(B)) const { |
| 29 | // A and B must be two different points |
| 30 | return ((*this - A) * (*this - B)).length() / A.distTo(B);} |