#include "rimPhysicsMath.h"
#include "rimPhysicsVector2D.h"
Classes | |
class | Vector3D< T > |
A templatized math class representing a 3-dimensional vector. More... | |
Functions | |
template<typename T> | |
Vector3D< T > | operator+ (const T &value, const Vector3D< T > &vector) |
Add a value to every component of the vector. | |
template<typename T> | |
Vector3D< T > | operator- (const T &value, const Vector3D< T > &vector) |
Subtract every component of the vector from the value, returning a vector result. | |
template<typename T> | |
Vector3D< T > | operator * (const T &value, const Vector3D< T > &vector) |
Multiply every component of the vector with the value, returning a vector result. | |
template<typename T> | |
Vector3D< T > | operator/ (const T &value, const Vector3D< T > &vector) |
Divide a value by every component of the vector, returning a vector result. | |
template<typename T> | |
T | dot (const Vector3D< T > &vector1, const Vector3D< T > &vector2) |
Compute and return the dot product of two vectors. | |
template<typename T> | |
Vector3D< T > | cross (const Vector3D< T > &vector1, const Vector3D< T > &vector2) |
Compute and return the cross product of two vectors. | |
template<typename T> | |
Vector3D< T > | midpoint (const Vector3D< T > &vector1, const Vector3D< T > &vector2) |
Compute the midpoint of two vectors. |
Vector3D<T> cross | ( | const Vector3D< T > & | vector1, | |
const Vector3D< T > & | vector2 | |||
) | [inline] |
Compute and return the cross product of two vectors.
This method computes and returns a vector representing the cross product of the two parameter vectors. This vector should be perpendicular to both of the original vectors. It does not modify either of the original vectors.
vector1 | - The first vector of the cross product. | |
vector2 | - The second vector of the cross product. |
T dot | ( | const Vector3D< T > & | vector1, | |
const Vector3D< T > & | vector2 | |||
) | [inline] |
Compute and return the dot product of two vectors.
This method adds all components of the component-wise multiplication of the two vectors together and returns the scalar result. It does not modify either of the original vectors. If the dot product is zero, then the two vectors are perpendicular.
vector1 | - The first vector of the dot product. | |
vector2 | - The second vector of the dot product. |
Vector3D<T> midpoint | ( | const Vector3D< T > & | vector1, | |
const Vector3D< T > & | vector2 | |||
) | [inline] |
Compute the midpoint of two vectors.
This method adds the two vector parameters together component-wise and then multiplies by 1/2, resulting in a point in 3D space at the midpoint between the two vectors. The midpoint is essentially the component-wise average of two vectors. Both original vectors are not modified.
vector1 | - The first vector of the midpoint calculation. | |
vector2 | - The second vector of the midpoint calculation. |
Vector3D<T> operator * | ( | const T & | value, | |
const Vector3D< T > & | vector | |||
) | [inline] |
Multiply every component of the vector with the value, returning a vector result.
This operator multiplies every component of the 2nd paramter, a vector, from the 1st paramter, a value, and then returns a vector containing the resulting vectoral components. This operator does not modify the orignal vector.
value | - The value to multiply with all components of the vector. | |
vector | - The vector to be multiplied with. |
Vector3D<T> operator+ | ( | const T & | value, | |
const Vector3D< T > & | vector | |||
) | [inline] |
Add a value to every component of the vector.
This operator adds the value parameter to every component of the vector, and returns a vector representing this result. It does not modifiy the original vector.
value | - The value to add to all components of the vector. | |
vector | - The vector to be added to. |
Vector3D<T> operator- | ( | const T & | value, | |
const Vector3D< T > & | vector | |||
) | [inline] |
Subtract every component of the vector from the value, returning a vector result.
This operator subtracts every component of the 2nd paramter, a vector, from the 1st paramter, a value, and then returns a vector containing the resulting vectoral components. This operator does not modify the orignal vector.
value | - The value to subtract all components of the vector from. | |
vector | - The vector to be subtracted. |
Vector3D<T> operator/ | ( | const T & | value, | |
const Vector3D< T > & | vector | |||
) | [inline] |
Divide a value by every component of the vector, returning a vector result.
This operator divides the provided value by every component of the vector, returning a vector representing the component-wise division. The operator does not modify the original vector.
value | - The value to be divided by all components of the vector. | |
vector | - The vector to be divided by. |