PPoint2Di.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 
18 PAPILLON_BEGIN_NAMESPACE
19 
20 class PPoint2Df;
21 
27 class PAPILLON_API_CORE PPoint2Di : public PObject
28 {
29 public:
30 
34  static const PPoint2Di& Zero() { static const PPoint2Di ZERO(0, 0); return ZERO; }
35 
39  explicit PPoint2Di(papillon::int32 xx = 0, papillon::int32 yy = 0);
40 
44  PPoint2Di(const PPoint2Di& other);
45 
49  virtual ~PPoint2Di();
50 
54  PPoint2Di& operator=(const PPoint2Di& other);
55 
59  papillon::int32 GetX() const;
60 
64  papillon::int32 GetY() const;
65 
70  bool operator==(const PPoint2Di& other) const;
71 
76  bool operator!=(const PPoint2Di& other) const;
77 
82  PPoint2Di operator+(const PPoint2Di& v) const;
83 
88  PPoint2Di operator-(const PPoint2Di& v) const;
89 
93  PPoint2Di operator-() const;
94 
98  PPoint2Di operator*(papillon::int32 scaleBy) const;
99 
103  PPoint2Di Translated(papillon::int32 vx, papillon::int32 vy) const;
104 
108  PPoint2Di Translated(const PPoint2Di &value) const;
109 
114  PPoint2Di Scaled(papillon::int32 scaleBy) const;
115 
119  PPoint2Df ToPPoint2Df() const;
120 
124  float EuclideanDistance(const PPoint2Di& other) const;
125 };
126 
127 PAPILLON_END_NAMESPACE
The PPoint2Df class represents a 2D-point with float coordinates; PPoint2Df instances are immutable (...
Definition: PPoint2Df.h:28
PAPILLON_API_CORE papillon::PString operator+(const papillon::PString &lhs, const papillon::PString &rhs)
Constructs a new string by concatenating string lhs with string rhs.
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PObject: the root class of all Papillon classes.
static const PPoint2Di & Zero()
Returns the constant holding the point (0,0).
Definition: PPoint2Di.h:34
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45
The PPoint2Di class represents a 2D-point with 32-bit int coordinates; PPoint2Di instances are immuta...
Definition: PPoint2Di.h:27