1#define _USE_MATH_DEFINES
40 if ((x == 0.) && (y == 0.)) {
53 if ((x == 0.) && (y == 0.)) {
57 double A = atan2(y, x);
78 return ((x == Q.x) && (y == Q.y));
82 return !((*this) == Q);
92 return Point(x + Q.x, y + Q.y);
96 return Point(x - Q.x, y - Q.y);
100 return Point(c*x, c*y);
104 return Point(x/c, y/c);
109 return (*
this) = (*this) + Q;
113 return (*
this) = (*this) - Q;
117 return (*
this) = (*this) * c;
121 return (*
this) = (*this) / c;
127 return sqrt(dx * dx + dy * dy);
135 os <<
"(" << P.
getX() <<
"," << P.
getY() <<
")";
void rotate(double theta)
a pont forgatása az origó körül
double getX() const
a pont első (x) koordinátája
Point & operator-=(const Point &Q)
Point & operator*=(double c)
Point operator*(double c) const
pont skalárral való szorzása
void setX(double xx)
x koordináta beállítása
Point & operator/=(double c)
Point()
Default konstruktor.
Point & operator=(const Point &Q)
Point operator+(const Point &Q) const
pontok mint vektorok összeadása
double getY() const
a pont második (y) koordinátája
bool operator==(const Point &Q) const
void setA(double theta)
a pontba mutató vektor szögének beállítása
void setY(double yy)
y koordináta beállítása
void setR(double r)
a pontba mutató vektor skálázása
double getR() const
a pontba mutató vektor hossza
Point & operator+=(const Point &Q)
Point operator-(const Point &Q) const
pontok mint vektorok kivonása
bool operator!=(const Point &Q) const
double getA() const
a pontba mutató vektor szöge
Point operator/(double c) const
pont skalárral való osztása (reciprokkal való szorzás)
Point operator*(double c, const Point &P)
skalárral való szorzás
double dist(Point P, Point Q)
két pont távolsága
Point midpoint(Point P, Point Q)
felezőpont
ostream & operator<<(ostream &os, const Point &P)
pont kiírása
a Point osztály és kapcsolódó függvények deklarációja