36 template <
class coord_type>
47 inline Point2D(coord_type x0, coord_type y0)
53 template <
class po
int_type>
60 template <
class po
int_type>
94 coord_type
getX()
const {
return _x; };
95 coord_type
getY()
const {
return _y; };
96 coord_type
x()
const {
return _x; };
97 coord_type
y()
const {
return _y; };
99 void setX(coord_type nx) { _x = nx; }
100 void setY(coord_type ny) { _y = ny; }
101 void set(coord_type nx, coord_type ny) {
setX(nx);
setY(ny); }
108 default: assert(NULL ==
"Point2D::operator[] index out of range");
113 template <
class po
int_type>
116 if ((_x == old.
_x)&&(_y==old.
_y))
122 template <
class po
int_type>
125 if ((_x == old.
_x)&&(_y==old.
_y))
132 template <
class po
int_type>
141 template <
class po
int_type>
158 rot_x = ( _x*cos(angle)+_y*sin(angle));
159 rot_y = (-_x*sin(angle)+_y*cos(angle));
172 return (sqrt(_x*_x+_y*_y));
179 template <
class mul_type,
class po
int_type>
186 template <
class po
int_type,
class mul_type>
197 template <
class po
int_type,
class div_type>
201 std::cout<<
" Error: <Point2D operator/> Division by 0"<<std::endl;
214 template <
class po
int1_type,
class po
int2_type>
227 template <
class po
int1_type,
class po
int2_type>
244 template <
class po
int_type1,
class po
int_type2>
247 double x_dist, y_dist,dist=0;
252 dist = sqrt(x_dist+y_dist);
Point2D< coord_type > & operator-=(const Point2D< point_type > &old)
Point2D< double > operator+(const Point2D< point1_type > &pt1, const Point2D< point2_type > &pt2)
bool operator!=(const Point2D< point_type > &old) const
coord_type operator[](int i) const
Point2D< coord_type > & operator+=(const Point2D< point_type > &old)
double euc_distance(Point2D< point_type1 > pt1, Point2D< point_type2 > pt2)
void rotate(double angle)
Point2D< point_type > operator/(const Point2D< point_type > pt, div_type val)
bool operator==(const Point2D< point_type > &old) const
Point2D< point_type > operator*(mul_type val, const Point2D< point_type > pt)
Point2D(coord_type x0, coord_type y0)
Point2D< point1_type > operator-(Point2D< point1_type > pt1, Point2D< point2_type > pt2)
Point2D< coord_type > & operator=(const Point2D< coord_type > &old)
Point2D< coord_type > & operator=(const Point2D< point_type > &old)