31 #ifndef PT_GFX_POINT_H
32 #define PT_GFX_POINT_H
34 #include <Pt/Gfx/Api.h>
51 Point(Float x, Float y)
56 : _x(pt._x), _y(pt._y)
65 void set(Float xpos, Float ypos)
83 const Point& addX(Float x)
89 const Point& subX(Float x)
95 const Point& addY(Float y)
101 const Point& subY(Float y)
107 const Point& move(Float dx, Float dy)
114 Float calcDistance(
const Point& other)
const
119 return hypot(_x - other._x, _y - other._y);
129 bool operator==(
const Point& pt)
const
130 {
return (_x == pt._x && _y == pt._y); }
132 bool operator!=(
const Point& pt)
const
133 {
return (_x != pt._x || _y != pt._y); }
144 return Point(_x + pt._x, _y + pt._y);
156 return Point(_x - pt._x, _y - pt._y);
159 Point operator*(Float factor)
const
161 return Point(_x * factor, _y * factor);
164 Point operator/(Float factor)
const
166 return Point(_x / factor, _y / factor);
169 Point operator+(Float factor)
const
171 return Point(_x + factor, _y + factor);
174 Point operator-(Float factor)
const
176 return Point(_x - factor, _y - factor);
179 Point& operator*=(Float factor)
186 Point& operator/=(Float factor)
214 : _x(pt._x), _y(pt._y)
223 void set(Int xpos, Int ypos)
265 const PointI& move(Int dx, Int dy)
279 bool operator==(
const PointI& pt)
const
280 {
return (_x == pt._x && _y == pt._y); }
282 bool operator!=(
const PointI& pt)
const
283 {
return (_x != pt._x || _y != pt._y); }
294 return PointI(_x + pt._x, _y + pt._y);
306 return PointI(_x - pt._x, _y - pt._y);
309 PointI operator*(Int factor)
const
311 return PointI(_x * factor, _y * factor);
314 PointI operator+(Int offset)
const
316 return PointI(_x + offset, _y + offset);
319 PointI operator-(Int offset)
const
321 return PointI(_x - offset, _y - offset);
324 PointI& operator*=(Int factor)