| 272 | /// \also Vector4D |
| 273 | |
| 274 | class Point2D : public Vector2D |
| 275 | { |
| 276 | public: |
| 277 | |
| 278 | TERATHON_API static const Origin2D origin; |
| 279 | |
| 280 | /// \brief Default constructor that leaves the components uninitialized. |
| 281 | |
| 282 | inline Point2D() = default; |
| 283 | |
| 284 | /// \brief Constructor that sets components explicitly. |
| 285 | /// \param a,b The components of the point. |
| 286 | |
| 287 | Point2D(float a, float b) : Vector2D(a, b) {} |
| 288 | |
| 289 | explicit Point2D(const Vector2D& p) : Vector2D(p) {} |
| 290 | |
| 291 | Point2D& operator =(const Vector2D& v) |
| 292 | { |
| 293 | xy = v.xy; |
| 294 | return (*this); |
| 295 | } |
| 296 | |
| 297 | void operator =(const Vector2D& v) volatile |
| 298 | { |
| 299 | xy = v.xy; |
| 300 | } |
| 301 | |
| 302 | template <typename type> |
| 303 | Point2D& operator =(const Vec2D<type>& v) |
| 304 | { |
| 305 | x = float(v.x); |
| 306 | y = float(v.y); |
| 307 | return (*this); |
| 308 | } |
| 309 | |
| 310 | Point2D& operator +=(const Vector2D& v) |
| 311 | { |
| 312 | xy += v.xy; |
| 313 | return (*this); |
| 314 | } |
| 315 | |
| 316 | Point2D& operator -=(const Vector2D& v) |
| 317 | { |
| 318 | xy -= v.xy; |
| 319 | return (*this); |
| 320 | } |
| 321 | |
| 322 | Point2D& operator *=(const Vector2D& v) |
| 323 | { |
| 324 | xy *= v.xy; |
| 325 | return (*this); |
| 326 | } |
| 327 | |
| 328 | Point2D& operator *=(float n) |
| 329 | { |
| 330 | xy *= n; |
| 331 | return (*this); |
no outgoing calls
no test coverage detected