#ifndef __POINT_H__
#define __POINT_H__
class Segment;
class Triangle;
class Polygon;
class Point {
public:
explicit Point (double _x = 0, double _y = 0)
: x(_x), y(_y) {}
void draw (int radius = 0) const;
bool is_on (const Segment &) const;
bool is_inside (const Triangle &) const;
bool is_inside (const Polygon &) const;
Point operator+ (const Point & p) const;
Point operator- (const Point & p) const;
Point operator* (double r) const;
double operator* (const Point & p) const;
Point operator/ (double r) const;
bool operator== (const Point & p) const;
bool operator!= (const Point & p) const;
bool operator< (const Point & p) const;
bool operator> (const Point & p) const;
double get_x () const { return x; }
double get_y () const { return y; }
private:
double x,y;
};
inline Point operator* (double x, const Point & p)
{
return p*x;
}
const Point origin (0,0);
#endif
Return to article