2 #ifndef UGDK_MATH_VECTOR2D_H_
3 #define UGDK_MATH_VECTOR2D_H_
11 #pragma SWIG nowarn=312
45 struct {
double x,
y; };
46 struct {
double val[2]; };
159 return (a.
x * b.
x) + (a.
y * b.
y);
198 return x==rhs.
x &&
y==rhs.
y;
248 operator std::array<double, 2> ()
const {
249 std::array<double, 2> result {{
x,
y }};
253 operator std::pair<double, double> ()
const {
254 return std::make_pair(
x,
y);
262 Vector2D
operator*(
double scalar,
const Vector2D &right);
267 #endif // UGDK_MATH_VECTOR2D_H_
Vector2D & operator*=(double other)
Integer2D operator*(int scalar, const Integer2D &right)
Method that returns a integer equal to the a integer multiplied by a scalar.
Vector2D operator+(const Vector2D &right) const
Method that returns a vector equal to the sum of two others.
static Vector2D Rotate(Vector2D &a, double angle)
Deprecated. Use the method function Rotate.
Definition: vector2D.h:188
Vector2D Mirrored(const ugdk::enums::mirroraxis::MirrorAxis axis) const
Returns a new Vector2D, mirrored by the "axis" axis. Include types.h and use "using namespace ugdk::e...
Vector2D & operator+=(const Vector2D &other)
double Angle() const
Returns the angle (in radians) of this vector.
Definition: vector2D.h:18
void Mirror(const ugdk::enums::mirroraxis::MirrorAxis axis)
Mirrors this Vector2D (in-place) by the "axis" axis. Include types.h and use "using namespace ugdk::e...
Vector2D operator-() const
Method that returns a vector equal to the oposite of another.
double x
Definition: vector2D.h:45
Definition: integer2D.h:20
double angle() const
Deprecated. Use the upper case method.
Definition: vector2D.h:174
static double InnerProduct(const Vector2D &a, const Vector2D &b)
Static method that returns a scalar equal to the inner product of two vectors.
Definition: vector2D.h:158
Vector2D Scale(const Vector2D &scale) const
Returns a new vector which is this vector scaled coordinate by coordinate with "scale".
double length() const
Deprecated. Use the upper case method.
Definition: vector2D.h:167
Vector2D Rotate(double angle) const
Returns a new vector equal to this vector rotated by "angle" (in radians) counter-clockwise.
Definition: animation.h:11
Vector2D & operator-=(const Vector2D &other)
void Divide(const Vector2D ÷r)
In-place integer division, coordinate by coordinate.
Vector2D()
Initializes both fields with 0.0.
Definition: vector2D.h:23
Vector2D Divided(const Vector2D ÷r) const
Returns a new Integer2D equal to this divided coordinate by coordinate by "multiplier".
void set_y(double y_)
Definition: vector2D.h:52
Vector2D Normalize() const
Returns a new vector equal to this vector normalized.
double get_x() const
Definition: vector2D.h:49
double NormOne() const
Returns the norm-1 of this vector.
static Vector2D Subtract(const Vector2D &a, const Vector2D &b)
Static method that returns a vector equal to the subtraction of two others.
Definition: vector2D.h:142
static Vector2D Add(const Vector2D &a, const Vector2D &b)
Static method that returns a vector equal to the sum of two others.
Definition: vector2D.h:134
double y
Definition: vector2D.h:45
double Length() const
Returns the norm-2 of this vector.
static Vector2D Normalized(Vector2D &a)
Deprecated. Use the method function Normalize.
Definition: vector2D.h:181
Vector2D operator*(double scalar) const
Method that returns a vector equal to the a vector multiplied by a scalar.
void set_x(double x_)
Definition: vector2D.h:51
~Vector2D()
Definition: vector2D.h:41
Vector2D(double value)
Initializes both fields with val.
Definition: vector2D.h:29
double LengthSquared() const
Returns the norm-2 squared.
Definition: vector2D.h:76
Vector2D(double _x, double _y)
Initializes both fields with given values.
Definition: vector2D.h:36
static Vector2D Multiply(const Vector2D &a, double scalar)
Static method that returns a vector equal to the a vector multiplied by a scalar. ...
Definition: vector2D.h:150
double get_y() const
Definition: vector2D.h:50
bool operator==(const Vector2D &rhs)
Compares this vector to the given vector, return True if they are equivalent.
Definition: vector2D.h:197
MirrorAxis
Definition: types.h:29
Vector2D operator/(double scalar) const
Method that returns a vector equal to the a vector multiplied by the inverse of a scalar...
double val[2]
Definition: vector2D.h:46