26 Vector2(
const float x = 0,
const float y = 0);
47 void Set(
const float x,
const float y) {
X = x;
Y = y; }
61 bool IsZero()
const {
return (
X == 0 &&
Y == 0); }
Vector2 & operator=(const Vector2 &vector)
Assigns the reference of a vector.
Definition: Vector2.cpp:93
Vector2 Left()
Calculates the left-hand orthogonal vector.
Definition: Vector2.h:105
float DotProduct(const Vector2 &vector) const
Calculates the dot product of two vectors.
Definition: Vector2.cpp:47
static Vector2 GetRandom(bool normalize=false)
Creates a random vector.
Definition: Vector2.cpp:75
bool operator==(const Vector2 &vector) const
Determines if two vectors are equal.
Definition: Vector2.cpp:156
static const Vector2 UnitY
A unit vector on the y-axis.
Definition: Vector2.h:32
void Display() const
Prints the vector to the console.
Definition: Vector2.h:120
void Set(const float x, const float y)
Sets the components of the vector.
Definition: Vector2.h:47
bool operator!=(const Vector2 &vector) const
Determines if two vectors are not equal.
Definition: Vector2.cpp:161
bool IsZero() const
Determines if the vector is the zero vector.
Definition: Vector2.h:61
const Vector2 operator/(const float scalar) const
Divides a vector by a scalar.
Definition: Vector2.cpp:151
static float Distance(const Vector2 &vector1, const Vector2 &vector2)
Calculates the distance between two vectors.
Definition: Vector2.cpp:57
Vector2 & operator-=(const Vector2 &vector)
Subtracts a vector.
Definition: Vector2.cpp:112
Vector2 & operator*=(const float scalar)
Multiplies by a scalar.
Definition: Vector2.cpp:120
static const Vector2 Zero
A vector with both of its components set to zero.
Definition: Vector2.h:29
float X
The x-coordinate of the vector.
Definition: Vector2.h:184
Defines a vector with 2 components (x and y). This is additional information...
Definition: Vector2.h:18
Vector2(const float x=0, const float y=0)
Instantiates a new Vector2 object.
Definition: Vector2.cpp:21
static float DistanceSquared(const Vector2 &vector1, const Vector2 &vector2)
Calculates the distance squared between two vectors.
Definition: Vector2.cpp:62
Vector2 & operator+=(const Vector2 &vector)
Adds a vector.
Definition: Vector2.cpp:104
float Length() const
Calculates the length of the vector.
Definition: Vector2.cpp:32
std::string ToString() const
Gets a string representation of the vector.
Definition: Vector2.cpp:86
static Vector2 Lerp(const Vector2 &start, const Vector2 &end, const float value)
Linearly interpolate between two vectors.
Definition: Vector2.cpp:67
const Point ToPoint() const
Converts the vector into a point.
Definition: Vector2.cpp:166
float Y
The y-coordinate of the vector.
Definition: Vector2.h:185
static const Vector2 UnitX
A unit vector on the x-axis.
Definition: Vector2.h:31
Vector2 Right()
Calculates the right-hand orthogonal vector.
Definition: Vector2.h:109
void Set(const Vector2 vector)
Sets the components of the vector.
Definition: Vector2.h:53
float CrossProduct(const Vector2 &vector) const
Calculates the cross product between two vectors.
Definition: Vector2.cpp:52
Defines a point in 2D space.
Definition: Point.h:19
float LengthSquared() const
Calculates the length of the vector squared.
Definition: Vector2.cpp:27
const Vector2 operator+(const Vector2 &vector) const
Adds two vectors.
Definition: Vector2.cpp:136
static const Vector2 One
A vector with both of its components set to one.
Definition: Vector2.h:30
Vector2 & operator/=(const float scalar)
Divides by a scalar.
Definition: Vector2.cpp:128
const Vector2 operator*(const float scalar) const
Multiplies a vector by a scalar.
Definition: Vector2.cpp:146
const Vector2 operator-() const
Negates the vector.
Definition: Vector2.h:150
void Normalize()
Resize a vector to a length of one unit. If the starting vector is the zero vector, the call will be ignored.
Definition: Vector2.cpp:37
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition: Animation.cpp:14