HatchitMath
|
Public Member Functions | |
Vector3 (const float rawArray[]) | |
Vector3 (float xyz) | |
Vector3 (const Vector2 &xy, float z) | |
Vector3 (float x, float y, float z) | |
Vector3 (const Vector3 &other) | |
void * | operator new (size_t _size) |
void | operator delete (void *p) |
operator const __m128 (void) const | |
Casts a Vector3 object to a __m128 This operator casts a Vector3 to an instrinsic __m128. | |
Vector3 | operator+ (float s) const |
Adds all elements in this Vector3 by a given scalar This operation returns a new Vector3. More... | |
Vector3 | operator- (float s) const |
Subtracts all elements in this Vector3 by a given scalar This operation returns a new Vector3. More... | |
Vector3 | operator* (float s) const |
Multiplies all elements in this Vector3 by a given scalar This operation returns a new Vector3. More... | |
Vector3 | operator/ (float s) const |
Divides all elements in this Vector3 by a given scalar This operation returns a new Vector3. More... | |
Vector3 | operator+= (float s) |
Adds all elements in this Vector3 by a given scalar This operation affects the elements in this Vector3. More... | |
Vector3 | operator-= (float s) |
Subtracts all elements in this Vector3 by a given scalar This operation affects the elements in this Vector3. More... | |
Vector3 | operator*= (float s) |
Multiplies all elements in this Vector3 by a given scalar This operation affects the elements in this Vector3. More... | |
Vector3 | operator/= (float s) |
Divides all elements in this Vector3 by a given scalar This operation affects the elements in this Vector3. More... | |
Vector3 | operator+ (const Vector3 &u) const |
Adds all of the elements from a given vector to this one. More... | |
Vector3 | operator- (const Vector3 &u) const |
Subtracts all of the elements from this vector by a given vector. More... | |
Vector3 | operator* (const Vector3 &u) const |
Executes memberwise multiplication on two vectors. More... | |
Vector3 | operator/ (const Vector3 &u) const |
Executes memberwise division on two vectors. More... | |
Vector3 | operator+= (const Vector3 &u) |
Adds all of the elements from a given vector to this one. More... | |
Vector3 | operator-= (const Vector3 &u) |
Subtracts all of the elements from this vector by a given one. More... | |
Vector3 | operator*= (const Vector3 &u) |
memberwise multiplication that stores the result in the first operand More... | |
Vector3 | operator/= (const Vector3 &u) |
memberwise division that stores the result in the first operand More... | |
bool | operator== (const Vector3 &u) const |
Compares the values of this Vector3 to another given Vector3. More... | |
bool | operator!= (const Vector3 &u) const |
Compares the values of this Vector3 to another given Vector3. More... | |
const float & | operator[] (int i) const |
Fetches an element of this Vector at the index i by reference. More... | |
float & | operator[] (int i) |
Fetches an element of this Vector at the index i by reference. More... | |
operator Vector2 () const | |
float | MagnitudeSquared () const |
Calculates the magnitude squared of this vector. More... | |
float | Magnitude () const |
Calculates the magnitude of this vector. More... | |
Vector3 | Normalized () const |
Calculates a normalized copy of this float. More... | |
Vector3 | Normalize () |
Normalizes this vector in place. More... | |
Float3 | ToFloat3 () const |
Stores values from SIMD registers into Float3. More... | |
Vector3 () | |
Create a Vector3 with all 3 elements being 0. | |
Vector3 (float x, float y, float z) | |
Create a Vector3 with the elements x, y and z. | |
Vector3 (const Vector3 &other) | |
Create a copy of an existing Vector3. | |
Vector3 (Vector4 &v4) | |
Create a Vector3 with the first three elements of a given Vector4 all divided by the 4th element. | |
void * | operator new (size_t _size) |
Allocate a 16byte aligned array of Vector3s. | |
void | operator delete (void *p) |
Delete an array of Vector3s. | |
operator const __m128 (void) const | |
Fetch the Vector3's SSE intrinsic __m128. | |
float | getX () |
Returns the first element. More... | |
float | getY () |
Returns the second element. More... | |
float | getZ () |
Returns the third element. More... | |
float | getMagnitude () |
Returns the magnitude of the vector. 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... | |
void | setZ (float z) |
Sets the third element. More... | |
Vector3 | operator* (float s) |
Multiplies all elements in this Vector3 by a given scalar This operation returns a new Vector3. More... | |
Vector3 | operator/ (float s) |
Divides all elements in this Vector3 by a given scalar This operation returns a new Vector3. More... | |
Vector3 | operator- (float s) |
Subtracts all elements in this Vector3 by a given scalar This operation returns a new Vector3. More... | |
Vector3 | operator+ (float s) |
Adds all elements in this Vector3 by a given scalar This operation returns a new Vector3. More... | |
Vector3 | operator*= (float s) |
Multiplies all elements in this Vector3 by a given scalar This operation affects the elements in this Vector3. More... | |
Vector3 | operator/= (float s) |
Divides all elements in this Vector3 by a given scalar This operation affects the elements in this Vector3. More... | |
Vector3 | operator-= (float s) |
Subtracts all elements in this Vector3 by a given scalar This operation affects the elements in this Vector3. More... | |
Vector3 | operator+= (float s) |
Adds all elements in this Vector3 by a given scalar This operation affects the elements in this Vector3. More... | |
bool | operator> (Vector3 u) |
Compares the magnitue of this Vector3 to another given Vector3. More... | |
bool | operator< (Vector3 u) |
Compares the magnitue of this Vector3 to another given Vector3. More... | |
bool | operator== (Vector3 u) |
Compares the values of this Vector3 to another given Vector3. More... | |
bool | operator!= (Vector3 u) |
Compares the values of this Vector3 to another given Vector3. More... | |
float | operator* (Vector3 u) |
Executes the Dot product this Vector3 and another as this * other. More... | |
Vector3 | operator+ (Vector3 u) |
Adds all of the elements from a given vector to this one. More... | |
Vector3 | operator- (Vector3 u) |
Subtracts all of the elements from this vector by a given vector. More... | |
Vector3 | operator+= (Vector3 u) |
Adds all of the elements from a given vector to this one. More... | |
Vector3 | operator-= (Vector3 u) |
Subtracts all of the elements from this vector by a given one. More... | |
float & | operator[] (int i) |
Fetches an element of this Vector at the index i. More... | |
operator Vector4 () | |
Returns a Vector4 with the first three elements from this vector and the last one being 0. | |
operator Vector2 () | |
Returns a Vector2 with the fist two elements from this vector. | |
Static Public Member Functions | |
static Vector3 | Cross (const Vector3 &v, const Vector3 &u) |
Calculates the cross product of two vectors. More... | |
static float | Dot (const Vector3 &v, const Vector3 &u) |
Calculates the dot product of two vectors. More... | |
static float | Angle (const Vector3 &v, const Vector3 &u) |
Calculates the angle between two vectors. More... | |
static float | Distance (const Vector3 &v, const Vector3 &u) |
Calculates the distance between two vectors. More... | |
static Vector3 | Cross (Vector3 v, Vector3 u) |
Executes the cross product on two given Vector3s as v X u. More... | |
static float | Dot (Vector3 v, Vector3 u) |
Executes the Dot product on two Vector3s as v * u. More... | |
static Vector3 | Normalize (Vector3 v) |
Normalizes a Vector3. More... | |
Public Attributes | |
union { | |
struct { | |
float x | |
float y | |
float z | |
} | |
float m_data [3] | |
__m128 m_vector | |
}; | |
Friends | |
class | Matrix4 |
Calculates the cross product of two vectors.
v,u | vectors used to calculate the cross product |
Calculates the dot product of two vectors.
v,u | vectors used to calculate the dot product |
float * Vector3::getAsArray | ( | ) |
Returns this Vector3 as a pointer to an array of floats.
float Vector3::getMagnitude | ( | ) |
Returns the magnitude of the vector.
float Vector3::getX | ( | void | ) |
Returns the first element.
float Vector3::getY | ( | void | ) |
Returns the second element.
float Vector3::getZ | ( | void | ) |
Returns the third 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.
bool Vector3::operator!= | ( | Vector3 | u | ) |
|
inline |
Vector3 Vector3::operator* | ( | float | s | ) |
float Vector3::operator* | ( | Vector3 | u | ) |
|
inline |
Executes memberwise multiplication on two vectors.
u | The other Vector3 |
Vector3 Hatchit::Math::Vector3::operator*= | ( | float | s | ) |
|
inline |
memberwise multiplication that stores the result in the first operand
u | other vector3 |
Vector3 Vector3::operator+ | ( | float | s | ) |
Adds all of the elements from a given vector to this one.
u | The other Vector3 |
|
inline |
Adds all of the elements from a given vector to this one.
u | The other Vector3 |
Vector3 Hatchit::Math::Vector3::operator+= | ( | float | s | ) |
Adds all of the elements from a given vector to this one.
u | The other Vector3 |
|
inline |
Adds all of the elements from a given vector to this one.
u | The other Vector3 |
Vector3 Vector3::operator- | ( | float | s | ) |
Subtracts all of the elements from this vector by a given vector.
u | The other Vector3 |
|
inline |
Subtracts all of the elements from this vector by a given vector.
u | The other Vector3 |
Vector3 Hatchit::Math::Vector3::operator-= | ( | float | s | ) |
Subtracts all of the elements from this vector by a given one.
u | The other Vector3 |
|
inline |
Subtracts all of the elements from this vector by a given one.
u | The other Vector3 |
Vector3 Vector3::operator/ | ( | float | s | ) |
|
inline |
Executes memberwise division on two vectors.
u | The other Vector3 |
Vector3 Hatchit::Math::Vector3::operator/= | ( | float | s | ) |
|
inline |
memberwise division that stores the result in the first operand
u | other vector3 |
bool Vector3::operator< | ( | Vector3 | u | ) |
bool Vector3::operator== | ( | Vector3 | u | ) |
|
inline |
bool Vector3::operator> | ( | Vector3 | u | ) |
float& Hatchit::Math::Vector3::operator[] | ( | int | i | ) |
Fetches an element of this Vector at the index i.
i | The index of the element to fetch |
|
inline |
Fetches an element of this Vector at the index i by reference.
i | The index of the element to fetch |
|
inline |
Fetches an element of this Vector at the index i by reference.
i | The index of the element to fetch |
void Vector3::setX | ( | float | x | ) |
Sets the first element.
x | The float you want to be the first element of this vector |
void Vector3::setY | ( | float | y | ) |
Sets the second element.
y | The float you want to be the second element of this vector |
void Vector3::setZ | ( | float | z | ) |
Sets the third element.
z | The float you want to be the third element of this vector |
|
inline |