2-dimensional Vector representation
Definition Vector2.h:14
float y
The upward/forward axis of the vector.
Definition Vector2.h:22
float x
The right axis of the vector.
Definition Vector2.h:18
A 2-dimensional vector.
Definition Vector2.h:31
static Vector2 Normalize(Vector2 vector)
Connvert a vector to a length of 1.
Definition Vector2.cpp:55
static const Vector2 up
A vector with values (0, 1)
Definition Vector2.h:71
Vector2 normalized() const
Convert the vector to a length of a.
Definition Vector2.cpp:63
static float Dot(const Vector2 &vector1, const Vector2 &vector2)
The dot product of two vectors.
Definition Vector2.cpp:96
Vector2()
Create a new 2-dimensinal zero vector.
Definition Vector2.cpp:15
static const Vector2 zero
A vector with zero for all axis.
Definition Vector2.h:54
static const Vector2 one
A vector with values (1, 1)
Definition Vector2.h:58
static float SqrMagnitude(const Vector2 &vector)
The squared length of a vector.
Definition Vector2.cpp:48
Vector2 operator-()
Negate the vector.
Definition Vector2.cpp:76
static Vector2 Rotate(Vector2 v, float angle)
Rotate the vector.
Definition Vector2.cpp:130
static const Vector2 down
A vector with values (0, -1)
Definition Vector2.h:75
static float Magnitude(const Vector2 &vector)
The length of a vector.
Definition Vector2.cpp:41
Vector2 operator+(const Vector2 &vector2) const
Add another vector to this vector.
Definition Vector2.cpp:80
static float ToFactor(Vector2 a, Vector2 b)
Definition Vector2.cpp:151
static const Vector2 right
A vector with values (1, 0)
Definition Vector2.h:63
static const Vector2 left
A vector3 with values (-1, 0)
Definition Vector2.h:67
float magnitude() const
The length of this vector.
Definition Vector2.cpp:44
float sqrMagnitude() const
The squared length of this vector.
Definition Vector2.cpp:51
Vector2 operator/(const float &factor)
Scale a vector uniformy down.
Definition Vector2.cpp:92
Vector2 operator*(float factor) const
Scale a vector uniformly up.
Definition Vector2.cpp:88
static Vector2 Lerp(Vector2 from, Vector2 to, float f)
Lerp between two vectors.
Definition Vector2.cpp:146
~Vector2()
Definition Vector2.cpp:30
static Vector2 Scale(const Vector2 &vector1, const Vector2 &vector2)
Scale a vector using another vector.
Definition Vector2.cpp:84
bool operator==(const Vector2 &vector)
Check is this vector is equal to the given vector.
Definition Vector2.cpp:100
static float SignedAngle(Vector2 from, Vector2 to)
Calculate the angle between two vectors rotation around an axis.
Definition Vector2.cpp:112
static float Distance(const Vector2 &vector1, const Vector2 &vector2)
The distance between two vectors.
Definition Vector2.cpp:104
static const Vector2 back
A vector with values (0, -1)
Definition Vector2.h:83
static const Vector2 forward
A vector with values (0, 1)
Definition Vector2.h:79