 |
Gorgon Game Engine
|
Go to the documentation of this file.
4 #include "../Property.h"
6 namespace Gorgon {
namespace Geometry {
11 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
16 Property<C_,T_, Getter_, Setter_>(object),
28 return (this->
Object.*Getter_)();
31 operator const T_()
const {
32 return (this->
Object.*Getter_)();
36 (this->
Object.*Setter_)(value);
42 return this->
Get() - point;
52 return this->
Get() + point;
59 return this->
Get() * value;
64 return this->
Get() * value;
71 return this->
Get() / value;
77 this->
Set(this->
Get() - point);
85 this->
Set(this->
Get() + point);
93 this->
Set(this->
Get() * value);
101 this->
Set(this->
Get() / value);
108 return this->
Get().CrossProduct(value);
113 return this->
Get().DotProduct(value);
119 return this->
Get().Distance(target);
123 return this->
Get().EuclideanSquare(target);
127 return this->
Get().Distance();
132 return this->
Get().EuclideanSquare();
136 return this->
Get().ManhattanDistance(target);
141 return this->
Get().ManhattanDistance();
146 return this->
Get().Normalize();
151 return this->
Get().Perpendicular();
159 return this->
Get().Angle(origin);
166 return this->
Get().Angle();
173 return this->
Get().Slope(point);
179 return this->
Get().Slope();
184 return this->
Get().Compare(point);
198 void Move(
const T_ &x,
const T_ &y) {
203 typename T_::BaseType
GetX()
const {
204 return this->
Get().X;
208 void SetX(
const typename T_::BaseType &value) {
209 this->
Set({value, this->
Get().Y});
213 typename T_::BaseType
GetY()
const {
214 return this->
Get().Y;
218 void SetY(
const typename T_::BaseType &value) {
219 this->
Set({this->
Get().X, value});
227 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
229 auto p = point.Get();
235 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
237 auto p = point.Get();
243 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
245 auto p = point.Get();
251 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O1_,
class O2_>
253 auto p = point.Get();
254 Scale(p, sizex, sizey);
260 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
262 auto p = point.Get();
263 Scale(p, size, origin);
269 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O1_,
class O2_>
271 auto p = point.Get();
272 Scale(p, sizex, sizey, origin);
280 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
282 auto p = point.Get();
291 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
293 auto p = point.Get();
301 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
303 auto p = point.Get();
311 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
313 auto p = point.Get();
321 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
323 point.
X += T_((point.
Y-origin.Y)*rate);
329 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
331 point.
Y += T_((point.
X-origin.
X)*rate);
335 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
341 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
347 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
353 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
359 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
361 point.
Y = -point.
Y+origin.
Y*2;
365 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
367 point.
X = -point.
X+origin.
X*2;
371 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
377 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
382 template<
class C_, Po
int(C_::*Getter_)() const,
void(C_::*Setter_)(const Po
int &)>
385 template<
class C_, Po
intf(C_::*Getter_)() const,
void(C_::*Setter_)(const Po
intf &)>
void Set(const T_ &value)
Definition: Property.h:63
T_ Perpendicular() const
Calculates perpendicular vector to this point.
Definition: PointProperty.h:150
bool operator!=(const T_ &point) const
Compares two points.
Definition: PointProperty.h:193
void SkewY(basic_Bounds< T_ > &bounds, const O_ &rate)
Skews the given bounds with the given rate along Y axis.
Definition: Bounds.h:675
Float Angle() const
Calculates the angle of the line formed from the origin to this point.
Definition: PointProperty.h:165
Float EuclideanSquare(const T_ &target) const
Calculates EuclideanSquare distance from this point to the given target.
Definition: PointProperty.h:122
Supports arithmetic operators including +, * ..., +=, ...
Definition: Property.h:108
T_ Normalize() const
Normalizes the point as a unit vector.
Definition: PointProperty.h:145
void ReflectX(basic_Point< T_ > &point)
Reflects the given point along the X axis.
Definition: Point.h:551
Float Distance() const
Calculates Euclidean distance from this point to origin.
Definition: PointProperty.h:126
T_ X
X coordinate.
Definition: Point.h:368
void SetY(const typename T_::BaseType &value)
Sets Y component.
Definition: PointProperty.h:218
T_::BaseType GetY() const
Returns Y component.
Definition: PointProperty.h:213
T_ operator-() const
Negates this point.
Definition: PointProperty.h:46
void VerticalMirror(basic_Point< T_ > &point)
Reflects the given point vertically.
Definition: Point.h:569
basic_PointProperty(C_ &object)
Definition: PointProperty.h:20
float Float
Represents floating point data type.
Definition: Types.h:16
T_ operator*() const
Definition: Property.h:80
void Scale(basic_Bounds< T_ > &bounds, const O_ &size)
Scales the given bounds by the given factor. Center of the bounds is used as origin.
Definition: Bounds.h:544
void Move(const T_ &x, const T_ &y)
Moves this point to the given coordinates.
Definition: PointProperty.h:198
void Translate(basic_Bounds< T_ > &bounds, O_ x, O_ y)
Translation moves the given bounds by the given amount.
Definition: Bounds.h:526
Float ManhattanDistance(const T_ &target) const
Calculates Manhattan distance from this point to the given target.
Definition: PointProperty.h:135
basic_PointProperty & operator=(basic_PointProperty &&)=default
Float Slope(const T_ &point) const
Calculates the slope of the line formed from the given point to this point.
Definition: PointProperty.h:172
void SkewX(basic_Bounds< T_ > &bounds, const O_ &rate)
Skews the given bounds with the given rate along X axis.
Definition: Bounds.h:658
void ReflectY(basic_Point< T_ > &point)
Reflects the given point along the Y axis.
Definition: Point.h:557
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
basic_PointProperty & operator*=(O_ value)
Scales this point.
Definition: PointProperty.h:92
bool Compare(const T_ &point) const
Compares two points.
Definition: PointProperty.h:183
This is generic property that can be set and retrieved good for enums mostly, its ok to use with POD ...
Definition: Property.h:30
Float EuclideanSquare() const
Calculates EuclideanSquare distance from this point to the given target.
Definition: PointProperty.h:131
T_::BaseType GetX() const
Returns X component.
Definition: PointProperty.h:203
basic_PointProperty & operator+=(const T_ &point)
Adds another point from this point.
Definition: PointProperty.h:84
void SetX(const typename T_::BaseType &value)
Sets X component.
Definition: PointProperty.h:208
Float Angle(const T_ &origin) const
Calculates the angle of the line formed from the given point to this point.
Definition: PointProperty.h:158
T_ operator+(const T_ &point) const
Adds another point to this one and returns the result.
Definition: PointProperty.h:51
bool operator==(const T_ &point) const
Compares two points.
Definition: PointProperty.h:188
C_ & Object
Definition: Property.h:35
Float Slope() const
Calculates the slope of the line formed from the origin to this point.
Definition: PointProperty.h:178
basic_PointProperty(basic_PointProperty &&)=default
This class represents a 2D point.
Definition: Point.h:32
basic_PointProperty(C_ *object)
Definition: PointProperty.h:15
basic_PointProperty & operator-=(const T_ &point)
Subtracts another point from this point.
Definition: PointProperty.h:76
basic_PointProperty & operator/=(O_ value)
Scales this point.
Definition: PointProperty.h:100
T_ operator/(O_ value) const
Divides this point to a scalar value.
Definition: PointProperty.h:70
Float Distance(const T_ &target) const
Calculates Euclidean distance from this point to the given target.
Definition: PointProperty.h:118
T_ CrossProduct(const T_ &value) const
Calculates cross product of two points.
Definition: PointProperty.h:107
T_ Y
Y coordinate.
Definition: Point.h:371
T_ Get() const
Definition: Property.h:59
NumericProperty< basic_PointProperty, typename T_::BaseType, &basic_PointProperty::GetY, &basic_PointProperty::SetY > Y
Definition: PointProperty.h:223
Float ManhattanDistance() const
Calculates Manhattan distance from this point to origin.
Definition: PointProperty.h:140
void HorizontalMirror(basic_Point< T_ > &point)
Reflects the given point horizontally.
Definition: Point.h:563
T_ DotProduct(const T_ &value) const
Calculates dot product of two points.
Definition: PointProperty.h:112
NumericProperty< basic_PointProperty, typename T_::BaseType, &basic_PointProperty::GetX, &basic_PointProperty::SetX > X
Definition: PointProperty.h:222
Property support for point class.
Definition: PointProperty.h:12
void Rotate(basic_Bounds< T_ > &bounds, Float angle)
Rotates the given bounds by the given angle.
Definition: Bounds.h:614