Like this:
1 2 3 4
|
point cart::point::operator - ()
{
return this->inverted();
}
| |
I can't think how the class 'point' that you made can be of much use. Also, you are missing the other most important thing in cartesian plane - vectors.
Basically, for 2D points and vectors you need to make classes that contain their x,y coordinates. The basic functions operating on points are:
Point2D Move(Point2D p, Vector2D v);
Vector2D Diff(Point2D a, Point2D b);
double Distance(Point2D a, Point2D b);
The basic functions operating on vectors are:
double Vector2D::Length() const;
Vector2D VecMul(Vector2D vec, double k);
Vector2D VecDiv(Vector2D vec, double k);
Vector2D VecAdd(Vector2D v1, Vector2D v2);
Vector2D VecSub(Vector2D v1, Vector2D v2);
Vector2D VecNormalize(Vector2D vec);
double DotProduct(Vector2D v1, Vector2D v2);