 |
Gorgon Game Engine
|
Go to the documentation of this file.
5 #include "../Property.h"
7 namespace Gorgon {
namespace Geometry {
12 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &)>
17 Property<C_,T_, Getter_, Setter_>(object),
29 return (this->
Object.*Getter_)();
32 operator const T_()
const {
33 return (this->
Object.*Getter_)();
37 (this->
Object.*Setter_)(value);
43 return this->
Get() - point;
53 return this->
Get() + point;
60 return this->
Get() * value;
65 return this->
Get() * value;
72 return this->
Get() / value;
78 this->
Set(this->
Get() - point);
86 this->
Set(this->
Get() + point);
94 this->
Set(this->
Get() * value);
102 this->
Set(this->
Get() / value);
109 return this->
Get().CrossProduct(value);
114 return this->
Get().DotProduct(value);
120 return this->
Get().Distance(target);
124 return this->
Get().EuclideanSquare(target);
128 return this->
Get().Distance();
133 return this->
Get().EuclideanSquare();
137 return this->
Get().ManhattanDistance(target);
142 return this->
Get().ManhattanDistance();
147 return this->
Get().Normalize();
152 return this->
Get().Perpendicular();
160 return this->
Get().Angle(origin);
167 return this->
Get().Angle();
174 return this->
Get().Slope(point);
180 return this->
Get().Slop();
185 return this->
Get().Compare(point);
200 return this->
Get().Width;
204 void SetWidth(
const typename T_::BaseType &value) {
205 this->
Set({value, this->
Get().Height});
210 return this->
Get().Height;
215 this->
Set({this->
Get().Width, value});
223 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
225 auto p = point.Get();
231 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
239 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O1_,
class O2_>
242 Scale(s, sizex, sizey);
247 template<
class C_,
class T_, T_(C_::*Getter_)() const,
void(C_::*Setter_)(const T_ &),
class O_>
255 template<
class C_, Size(C_::*Getter_)() const,
void(C_::*Setter_)(const Size &)>
258 template<
class C_, Sizef(C_::*Getter_)() const,
void(C_::*Setter_)(const Sizef &)>
void Set(const T_ &value)
Definition: Property.h:63
T_::BaseType GetHeight() const
Returns Height component.
Definition: SizeProperty.h:209
Float Angle() const
Calculates the angle of the line formed from the origin to this point.
Definition: SizeProperty.h:166
T_::BaseType GetWidth() const
Returns Width component.
Definition: SizeProperty.h:199
Supports arithmetic operators including +, * ..., +=, ...
Definition: Property.h:108
basic_SizeProperty & operator=(basic_SizeProperty &&)=default
Float EuclideanSquare(const T_ &target) const
Calculates EuclideanSquare distance from this point to the given target.
Definition: SizeProperty.h:123
NumericProperty< basic_SizeProperty, typename T_::BaseType, &basic_SizeProperty::GetHeight, &basic_SizeProperty::SetHeight > Height
Definition: SizeProperty.h:219
T_ operator+(const T_ &point) const
Adds another point to this one and returns the result.
Definition: SizeProperty.h:52
T_ operator-() const
Negates this point.
Definition: SizeProperty.h:47
basic_SizeProperty & operator/=(O_ value)
Scales this point.
Definition: SizeProperty.h:101
T_ Perpendicular() const
Calculates perpendicular vector to this point.
Definition: SizeProperty.h:151
float Float
Represents floating point data type.
Definition: Types.h:16
Float Slope(const T_ &point) const
Calculates the slope of the line formed from the given point to this point.
Definition: SizeProperty.h:173
T_ operator*() const
Definition: Property.h:80
Float Distance(const T_ &target) const
Calculates Euclidean distance from this point to the given target.
Definition: SizeProperty.h:119
T_ operator/(O_ value) const
Divides this point to a scalar value.
Definition: SizeProperty.h:71
Float Slope() const
Calculates the slope of the line formed from the origin to this point.
Definition: SizeProperty.h:179
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
Property support for point class.
Definition: SizeProperty.h:13
bool operator==(const T_ &point) const
Compares two points.
Definition: SizeProperty.h:189
void SetHeight(const typename T_::BaseType &value)
Sets Height component.
Definition: SizeProperty.h:214
Float EuclideanSquare() const
Calculates EuclideanSquare distance from this point to the given target.
Definition: SizeProperty.h:132
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
bool Compare(const T_ &point) const
Compares two points.
Definition: SizeProperty.h:184
T_ DotProduct(const T_ &value) const
Calculates dot product of two points.
Definition: SizeProperty.h:113
This is generic property that can be set and retrieved good for enums mostly, its ok to use with POD ...
Definition: Property.h:30
void SetWidth(const typename T_::BaseType &value)
Sets Width component.
Definition: SizeProperty.h:204
basic_SizeProperty(C_ *object)
Definition: SizeProperty.h:16
T_ Normalize() const
Normalizes the point as a unit vector.
Definition: SizeProperty.h:146
Float Distance() const
Calculates Euclidean distance from this point to origin.
Definition: SizeProperty.h:127
Float ManhattanDistance() const
Calculates Manhattan distance from this point to origin.
Definition: SizeProperty.h:141
C_ & Object
Definition: Property.h:35
basic_SizeProperty(C_ &object)
Definition: SizeProperty.h:21
Float Angle(const T_ &origin) const
Calculates the angle of the line formed from the given point to this point.
Definition: SizeProperty.h:159
NumericProperty< basic_SizeProperty, typename T_::BaseType, &basic_SizeProperty::GetWidth, &basic_SizeProperty::SetWidth > Width
Definition: SizeProperty.h:218
basic_SizeProperty & operator-=(const T_ &point)
Subtracts another point from this point.
Definition: SizeProperty.h:77
T_ CrossProduct(const T_ &value) const
Calculates cross product of two points.
Definition: SizeProperty.h:108
basic_SizeProperty & operator+=(const T_ &point)
Adds another point from this point.
Definition: SizeProperty.h:85
T_ Get() const
Definition: Property.h:59
basic_SizeProperty(basic_SizeProperty &&)=default
bool operator!=(const T_ &point) const
Compares two points.
Definition: SizeProperty.h:194
Float ManhattanDistance(const T_ &target) const
Calculates Manhattan distance from this point to the given target.
Definition: SizeProperty.h:136
basic_SizeProperty & operator*=(O_ value)
Scales this point.
Definition: SizeProperty.h:93
Property support for point class.
Definition: PointProperty.h:12