|
Arcade Shooter
|
Defines a vector with 2 components (x and y). This is additional information... More...
#include <Vector2.h>
Public Member Functions | |
| Vector2 (const float x=0, const float y=0) | |
| Instantiates a new Vector2 object. More... | |
| float | LengthSquared () const |
| Calculates the length of the vector squared. More... | |
| float | Length () const |
| Calculates the length of the vector. More... | |
| void | Set (const float x, const float y) |
| Sets the components of the vector. More... | |
| void | Set (const Vector2 vector) |
| Sets the components of the vector. More... | |
| void | Normalize () |
| Resize a vector to a length of one unit. If the starting vector is the zero vector, the call will be ignored. | |
| bool | IsZero () const |
| Determines if the vector is the zero vector. More... | |
| float | DotProduct (const Vector2 &vector) const |
| Calculates the dot product of two vectors. More... | |
| float | CrossProduct (const Vector2 &vector) const |
| Calculates the cross product between two vectors. More... | |
| Vector2 | Left () |
| Calculates the left-hand orthogonal vector. More... | |
| Vector2 | Right () |
| Calculates the right-hand orthogonal vector. More... | |
| const Point | ToPoint () const |
| Converts the vector into a point. More... | |
| std::string | ToString () const |
| Gets a string representation of the vector. More... | |
| void | Display () const |
| Prints the vector to the console. | |
| Vector2 & | operator= (const Vector2 &vector) |
| Assigns the reference of a vector. More... | |
| Vector2 & | operator+= (const Vector2 &vector) |
| Adds a vector. More... | |
| Vector2 & | operator-= (const Vector2 &vector) |
| Subtracts a vector. More... | |
| Vector2 & | operator*= (const float scalar) |
| Multiplies by a scalar. More... | |
| Vector2 & | operator/= (const float scalar) |
| Divides by a scalar. More... | |
| const Vector2 | operator- () const |
| Negates the vector. More... | |
| const Vector2 | operator+ (const Vector2 &vector) const |
| Adds two vectors. More... | |
| const Vector2 | operator- (const Vector2 &vector) const |
| Subtracts a vector from another. More... | |
| const Vector2 | operator* (const float scalar) const |
| Multiplies a vector by a scalar. More... | |
| const Vector2 | operator/ (const float scalar) const |
| Divides a vector by a scalar. More... | |
| bool | operator== (const Vector2 &vector) const |
| Determines if two vectors are equal. More... | |
| bool | operator!= (const Vector2 &vector) const |
| Determines if two vectors are not equal. More... | |
Static Public Member Functions | |
| static float | Distance (const Vector2 &vector1, const Vector2 &vector2) |
| Calculates the distance between two vectors. More... | |
| static float | DistanceSquared (const Vector2 &vector1, const Vector2 &vector2) |
| Calculates the distance squared between two vectors. More... | |
| static Vector2 | Lerp (const Vector2 &start, const Vector2 &end, const float value) |
| Linearly interpolate between two vectors. More... | |
| static Vector2 | GetRandom (bool normalize=false) |
| Creates a random vector. More... | |
Public Attributes | |
| float | X |
| The x-coordinate of the vector. | |
| float | Y |
| The y-coordinate of the vector. | |
Static Public Attributes | |
| static const Vector2 | Zero = Vector2(0, 0) |
| A vector with both of its components set to zero. | |
| static const Vector2 | One = Vector2(1, 1) |
| A vector with both of its components set to one. | |
| static const Vector2 | UnitX = Vector2(1, 0) |
| A unit vector on the x-axis. | |
| static const Vector2 | UnitY = Vector2(0, 1) |
| A unit vector on the y-axis. | |
Defines a vector with 2 components (x and y). This is additional information...
| KatanaEngine::Vector2::Vector2 | ( | const float | x = 0, |
| const float | y = 0 |
||
| ) |
Instantiates a new Vector2 object.
| x | The X component |
| y | The Y component |
| float KatanaEngine::Vector2::CrossProduct | ( | const Vector2 & | vector | ) | const |
Calculates the cross product between two vectors.
| vector | The other vector. |
Calculates the distance between two vectors.
| vector1 | The first vector. |
| vector2 | The second vector. |
|
static |
Calculates the distance squared between two vectors.
| vector1 | The first vector. |
| vector2 | The second vector. |
| float KatanaEngine::Vector2::DotProduct | ( | const Vector2 & | vector | ) | const |
Calculates the dot product of two vectors.
| vector | The other vector. |
|
static |
Creates a random vector.
| normalize | Specify true to generate a unit vector. False will generate a vector with a random length. |
|
inline |
Determines if the vector is the zero vector.
|
inline |
Calculates the left-hand orthogonal vector.
| float KatanaEngine::Vector2::Length | ( | ) | const |
Calculates the length of the vector.
| float KatanaEngine::Vector2::LengthSquared | ( | ) | const |
Calculates the length of the vector squared.
|
static |
Linearly interpolate between two vectors.
| start | The result when the value is zero. |
| end | The result when the value is one. |
| value | A value between 0 and 1 that will indicate the resulting weight between start and end. |
| bool KatanaEngine::Vector2::operator!= | ( | const Vector2 & | vector | ) | const |
Determines if two vectors are not equal.
| vector | The vector to compare. |
| const Vector2 KatanaEngine::Vector2::operator* | ( | const float | scalar | ) | const |
Multiplies a vector by a scalar.
| scalar | The scalar to multiply by. |
| Vector2 & KatanaEngine::Vector2::operator*= | ( | const float | scalar | ) |
Multiplies by a scalar.
| scalar | The scalar to multiply by. |
Adds two vectors.
| vector | The vector to add. |
Adds a vector.
| vector | The vector to add. |
|
inline |
Negates the vector.
Subtracts a vector from another.
| vector | The vector to subtract. |
Subtracts a vector.
| vector | The vector to subtract. |
| const Vector2 KatanaEngine::Vector2::operator/ | ( | const float | scalar | ) | const |
Divides a vector by a scalar.
| scalar | The scalar to divide by. |
| Vector2 & KatanaEngine::Vector2::operator/= | ( | const float | scalar | ) |
Divides by a scalar.
| scalar | The scalar to divide by. |
Assigns the reference of a vector.
| vector | The reference vector. |
| bool KatanaEngine::Vector2::operator== | ( | const Vector2 & | vector | ) | const |
Determines if two vectors are equal.
| vector | The vector to compare. |
|
inline |
Calculates the right-hand orthogonal vector.
|
inline |
Sets the components of the vector.
| x | The X component. |
| y | The Y component. |
|
inline |
Sets the components of the vector.
| vector | The vector whose components to copy. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| const Point KatanaEngine::Vector2::ToPoint | ( | ) | const |
Converts the vector into a point.
| std::string KatanaEngine::Vector2::ToString | ( | ) | const |
Gets a string representation of the vector.
1.8.13