HatchitMath
|
Public Member Functions | |
Vector2 (const float rawArray[]) | |
Vector2 (float xy) | |
Vector2 (float x, float y) | |
Vector2 (const Vector2 &other) | |
Vector2 (const __m128 &vector) | |
Vector2 (__m128 &&vector) | |
void * | operator new (size_t _size) |
void | operator delete (void *p) |
void * | operator new[] (size_t size) |
void | operator delete[] (void *p) |
operator __m128 (void) const | |
Casts a Vector2 object to a __m128 This operator casts a Vector2 to an intrinsic __m128. | |
Vector2 | operator+ (float s) const |
Adds all elements in Vector2 by a given scalar This operator returns a new Vector2. More... | |
Vector2 | operator- (float s) const |
Subtracts all elements in Vector2 by a given scalar This operator returns a new Vector2. More... | |
Vector2 | operator* (float s) const |
Multiplies all elements in Vector2 by a given scalar This operator returns a new Vector2. More... | |
Vector2 | operator/ (float s) const |
Divides all elements in Vector2 by a given scalar This operator returns a new Vector2. More... | |
Vector2 & | operator+= (float s) |
Adds all elements in this Vector2 by a given scalar This operation affects the elements in this Vector2. More... | |
Vector2 & | operator-= (float s) |
Subtracts all elements in this Vector2 by a given scalar This operation affects the elements in this Vector2. More... | |
Vector2 & | operator*= (float s) |
Multiplies all elements in this Vector2 by a given scalar This operation affects the elements in this Vector2. More... | |
Vector2 & | operator/= (float s) |
Divides all elements in this Vector2 by a given scalar This operation affects the elements in this Vector2. More... | |
Vector2 | operator+ (const Vector2 &u) const |
Adds all of the elements from a given Vector2 to this one. More... | |
Vector2 | operator- (const Vector2 &u) const |
Subtracts all of the elements from a given Vector2 to this one. More... | |
Vector2 | operator* (const Vector2 &u) const |
Multiplies all of the elements from a given Vector2 to this one. More... | |
Vector2 | operator/ (const Vector2 &u) const |
Divides all of the elements from a given Vector2 to this one. More... | |
Vector2 & | operator+= (const Vector2 &u) |
Adds all of the elements from a given Vector2 to this one. More... | |
Vector2 & | operator-= (const Vector2 &u) |
Subtracts all of the elements from a given Vector2 to this one. More... | |
Vector2 & | operator*= (const Vector2 &u) |
Multiplies all of the elements from a given Vector2 to this one. More... | |
Vector2 & | operator/= (const Vector2 &u) |
Divides all of the elements from a given Vector2 to this one. More... | |
bool | operator== (const Vector2 &u) const |
Compares the values of this Vector2 to another given Vector2. More... | |
bool | operator!= (const Vector2 &u) const |
Compares the values of this Vector2 to another given Vector2. More... | |
const float & | operator[] (size_t i) const |
Fetches an element of this Vector2 at the index i. More... | |
float & | operator[] (size_t i) |
Fetches an element of this Vector2 at the index i. More... | |
float | MagnitudeSquared () const |
Calculates the magnitude squared of this vector. More... | |
float | Magnitude () const |
Calculates the magnitude of this vector. More... | |
Vector2 | Normalized () const |
Calculates a normalized copy of this float. More... | |
Vector2 | Normalize () |
Normalizes this vector in place. More... | |
Float2 | ToFloat2 () const |
Stores values from SIMD registers into Float2. More... | |
Vector2 () | |
Create a Vector2 with both elements being 0. | |
Vector2 (float x, float y) | |
Create a Vector2 with the elements described by x and y. | |
Vector2 (const Vector2 &other) | |
Create a Vector2 with the elements of another Vector2. | |
float | getX () |
Returns the first element. More... | |
float | getY () |
Returns the second element. More... | |
float | getMagnitude () |
Returns the magnitude. More... | |
float * | getAsArray () |
Returns this Vector3 as a pointer to an array of floats. More... | |
void | setX (float x) |
Sets the first element. More... | |
void | setY (float y) |
Sets the second element. More... | |
float | operator* (Vector2 u) |
Performs the dot procduct between this Vector2 and another Vector2. More... | |
Vector2 | operator* (float s) |
Multiplies a scalar into this Vector2. More... | |
Vector2 | operator+ (Vector2 u) |
Adds another Vector2 to this one. More... | |
float & | operator[] (int i) |
Fetches an element of this Vector at the index i. More... | |
Static Public Member Functions | |
static float | Dot (const Vector2 &v, const Vector2 &u) |
Calculates the dot product of two vectors. More... | |
static float | Angle (const Vector2 &v, const Vector2 &u) |
Calculates the angle between two vectors. More... | |
static float | Distance (const Vector2 &v, const Vector2 &u) |
Calculates the distance between two vectors. More... | |
static float | Dot (Vector2 v, Vector2 u) |
Executes the Dot product on two Vector2s as v * u. More... | |
static Vector2 | Normalize (Vector2 v) |
Normalizes a Vector2. More... | |
Public Attributes | |
union { | |
__m128 m_vector | |
struct { | |
float x | |
float y | |
} | |
float m_data [2] | |
}; | |
Calculates the dot product of two vectors.
v,u | vectors used to calculate the dot product |
float * Vector2::getAsArray | ( | ) |
Returns this Vector3 as a pointer to an array of floats.
float Vector2::getMagnitude | ( | ) |
Returns the magnitude.
float Vector2::getX | ( | void | ) |
Returns the first element.
float Vector2::getY | ( | void | ) |
Returns the second element.
|
inline |
Calculates the magnitude of this vector.
|
inline |
Calculates the magnitude squared of this vector.
|
inline |
Normalizes this vector in place.
|
inline |
Calculates a normalized copy of this float.
|
inline |
float Vector2::operator* | ( | Vector2 | u | ) |
Vector2 Vector2::operator* | ( | float | s | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
float & Vector2::operator[] | ( | int | i | ) |
Fetches an element of this Vector at the index i.
i | The index of the element to fetch |
|
inline |
|
inline |
void Vector2::setX | ( | float | x | ) |
Sets the first element.
x | The float you want to be the first element of this vector |
void Vector2::setY | ( | float | y | ) |
Sets the second element.
y | The float you want to be the second element of this vector |
|
inline |