Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents a 2-dimensional point or vector. More...
#include <omVector2D.h>
Public Member Functions | |
VectorND () | |
Create a new 2D vector with all elements equal to zero. More... | |
VectorND (T value) | |
Create a new 2D vector with all elements equal to a single value. More... | |
VectorND (const T array[2]) | |
Create a new 2D vector from a pointer to a 2 element array. More... | |
VectorND (T newX, T newY) | |
Create a new 2D vector by specifying it's x and y values. More... | |
template<typename U > | |
VectorND (const VectorND< U, 2 > &vector) | |
Create a new 2D vector from an existing vector of a different template type. More... | |
VectorND (const VectorND &vector) | |
Create a new 2D vector from an existing vector with the same template type. More... | |
VectorND & | operator= (const VectorND &vector) |
Create a new 2D vector from an existing vector with a different template type. More... | |
T | getMagnitude () const |
Return the magnitude of this vector (the length). More... | |
T | getMagnitudeSquared () const |
Return the square of the magnitude of this vector. More... | |
VectorND | normalize () const |
Return a normalized version of this vector. More... | |
VectorND | normalize (T &magnitude) const |
Return a normalized version of this vector, placing the vector's magnitude in the output parameter. More... | |
VectorND | projectOn (const VectorND &vector) const |
Project this vector on another vector and return the projected vector. More... | |
VectorND | projectOnNormalized (const VectorND &vector) const |
Project this vector on a normalized vector and return the projected vector. More... | |
T | getDistanceTo (const VectorND &vector) const |
Return the distance from this vector to another in 2D Euclidean space. More... | |
T | getDistanceToSquared (const VectorND &vector) const |
Return the square of the distance from this vector to another in 2D Euclidean space. More... | |
T * | toArray () |
Return a pointer to the internal storage of this vector. More... | |
const T * | toArray () const |
Return a const pointer to the internal storage of this vector. More... | |
T | getMin () const |
Return the minimum coordinate of this vector. More... | |
T | getMax () const |
Return the maximum coordinate of this vector. More... | |
T & | get (Index index) |
Return a reference to the vector coordinate at the specified index. More... | |
const T & | get (Index index) const |
Return a const reference to the vector coordinate at the specified index. More... | |
T & | operator[] (Index index) |
Return a reference to the vector coordinate at the specified index. More... | |
const T & | operator[] (Index index) const |
Return a const reference to the vector coordinate at the specified index. More... | |
void | setAll (T newX, T newY) |
Set the X and Y coordinates of the vector to the specified values. More... | |
void | set (Index index, T newValue) |
Set the coordinate of this vector at the specified index to a new value. More... | |
Bool | operator== (const VectorND &v) const |
Return whether or not this vector is equal to another for all components. More... | |
Bool | operator!= (const VectorND &v) const |
Return whether or not this vector is not equal to another for any component. More... | |
VectorND | operator- () const |
Negate each component of this vector and return the result. More... | |
VectorND | operator+ () const |
Return copy of the original vector. More... | |
VectorND | operator+ (T value) const |
Add a scalar to every component of this vector and return the result. More... | |
VectorND | operator- (T value) const |
Subtract a scalar from every component of this vector and return the result. More... | |
VectorND | operator* (T value) const |
Multiply every component of this vector by a scalar and return the result. More... | |
VectorND | operator/ (T value) const |
Divide every component of this vector by a scalar and return the result. More... | |
VectorND | operator+ (const VectorND &vector) const |
Add this vector to another and return the result and return the result. More... | |
VectorND | operator- (const VectorND &vector) const |
Subtract a vector from this vector and return the result. More... | |
VectorND | operator* (const VectorND &vector) const |
Multiply this vector by another vector and return the result. More... | |
VectorND | operator/ (const VectorND &vector) const |
Divide this vector by another vector and return the result. More... | |
VectorND & | operator+= (T value) |
Add a scalar to each component of this vector and modify the original vector. More... | |
VectorND & | operator-= (T value) |
Subtract a scalar from each component of this vector and modify the original vector. More... | |
VectorND & | operator*= (T value) |
Multiply each component of this vector by a scalar and modify the original vector. More... | |
VectorND & | operator/= (T value) |
Divide each component of this vector by a scalar and modify the original vector. More... | |
VectorND & | operator+= (const VectorND &vector) |
Add a vector to this vector, modifying this vector. More... | |
VectorND & | operator-= (const VectorND &vector) |
Subtract a vector from this vector, modifying this vector. More... | |
VectorND & | operator*= (const VectorND &vector) |
Multiply this vector by another vector and modify this vector. More... | |
VectorND & | operator/= (const VectorND &vector) |
Divide this vector by another vector and modify this vector. More... | |
data::String | toString () const |
Convert this 2D vector into a human-readable string representation. More... | |
operator data::String () const | |
Convert this 2D vector into a human-readable string representation. More... | |
Static Public Member Functions | |
static VectorND | polar (T angle) |
Convert the specified polar angle in radians to a unit-length 2D vector. More... | |
static VectorND | polar (T angle, T r) |
Convert the specified polar coordinates in radians to an r-length 2D vector. More... | |
Public Attributes | |
union om::math::VectorND< T, 2 >:: { ... } | |
T | v [2] |
An array that contains the vector components. More... | |
T | r |
The red component of a 2-component color. More... | |
T | g |
The green component of a 2-component color. More... | |
T | x |
The X coordinate of a 3D vector. More... | |
T | y |
The Y coordinate of a 3D vector. More... | |
Swizzle2D< T, 2, 0, 0 > | xx |
A permutation of the vector elements that consists of the X element repeated twice. More... | |
Swizzle2D< T, 2, 1, 1 > | yy |
A permutation of the vector elements that consists of the Y element repeated twice. More... | |
Swizzle2D< T, 2, 0, 1 > | xy |
A permutation of the vector elements that is the same as the original vector. More... | |
Swizzle2D< T, 2, 1, 0 > | yx |
A permutation of the vector elements that consists of the X and Y element swapped. More... | |
Static Public Attributes | |
static const VectorND | ZERO |
A constant vector with all elements equal to zero. More... | |
A class that represents a 2-dimensional point or vector.
|
inline |
Create a new 2D vector with all elements equal to zero.
|
inlineexplicit |
Create a new 2D vector with all elements equal to a single value.
|
inlineexplicit |
Create a new 2D vector from a pointer to a 2 element array.
|
inline |
Create a new 2D vector by specifying it's x and y values.
|
inline |
Create a new 2D vector from an existing vector of a different template type.
|
inline |
Create a new 2D vector from an existing vector with the same template type.
This is declared because the auto-generated one was not working with the crazy uniform mess.
|
inline |
Create a new 2D vector from an existing vector with a different template type.
This is declared because the auto-generated one was not working with the crazy uniform mess.
|
inlinestatic |
Convert the specified polar angle in radians to a unit-length 2D vector.
|
inlinestatic |
Convert the specified polar coordinates in radians to an r-length 2D vector.
|
inline |
Return the magnitude of this vector (the length).
|
inline |
Return the square of the magnitude of this vector.
|
inline |
Return a normalized version of this vector.
|
inline |
Return a normalized version of this vector, placing the vector's magnitude in the output parameter.
|
inline |
Project this vector on another vector and return the projected vector.
|
inline |
Project this vector on a normalized vector and return the projected vector.
|
inline |
Return the distance from this vector to another in 2D Euclidean space.
|
inline |
Return the square of the distance from this vector to another in 2D Euclidean space.
|
inline |
Return a pointer to the internal storage of this vector.
|
inline |
Return a const pointer to the internal storage of this vector.
|
inline |
Return the minimum coordinate of this vector.
|
inline |
Return the maximum coordinate of this vector.
|
inline |
Return a reference to the vector coordinate at the specified index.
|
inline |
Return a const reference to the vector coordinate at the specified index.
|
inline |
Return a reference to the vector coordinate at the specified index.
|
inline |
Return a const reference to the vector coordinate at the specified index.
|
inline |
Set the X and Y coordinates of the vector to the specified values.
|
inline |
Set the coordinate of this vector at the specified index to a new value.
|
inline |
Return whether or not this vector is equal to another for all components.
|
inline |
Return whether or not this vector is not equal to another for any component.
|
inline |
Negate each component of this vector and return the result.
|
inline |
Return copy of the original vector.
|
inline |
Add a scalar to every component of this vector and return the result.
|
inline |
Subtract a scalar from every component of this vector and return the result.
|
inline |
Multiply every component of this vector by a scalar and return the result.
|
inline |
Divide every component of this vector by a scalar and return the result.
|
inline |
Add this vector to another and return the result and return the result.
|
inline |
Subtract a vector from this vector and return the result.
|
inline |
Multiply this vector by another vector and return the result.
|
inline |
Divide this vector by another vector and return the result.
|
inline |
Add a scalar to each component of this vector and modify the original vector.
|
inline |
Subtract a scalar from each component of this vector and modify the original vector.
|
inline |
Multiply each component of this vector by a scalar and modify the original vector.
|
inline |
Divide each component of this vector by a scalar and modify the original vector.
|
inline |
Add a vector to this vector, modifying this vector.
|
inline |
Subtract a vector from this vector, modifying this vector.
|
inline |
Multiply this vector by another vector and modify this vector.
|
inline |
Divide this vector by another vector and modify this vector.
|
inline |
Convert this 2D vector into a human-readable string representation.
|
inline |
Convert this 2D vector into a human-readable string representation.
T om::math::VectorND< T, 2 >::v[2] |
An array that contains the vector components.
T om::math::VectorND< T, 2 >::r |
The red component of a 2-component color.
T om::math::VectorND< T, 2 >::g |
The green component of a 2-component color.
T om::math::VectorND< T, 2 >::x |
The X coordinate of a 3D vector.
T om::math::VectorND< T, 2 >::y |
The Y coordinate of a 3D vector.
Swizzle2D<T,2,0,0> om::math::VectorND< T, 2 >::xx |
A permutation of the vector elements that consists of the X element repeated twice.
Swizzle2D<T,2,1,1> om::math::VectorND< T, 2 >::yy |
A permutation of the vector elements that consists of the Y element repeated twice.
Swizzle2D<T,2,0,1> om::math::VectorND< T, 2 >::xy |
A permutation of the vector elements that is the same as the original vector.
Swizzle2D<T,2,1,0> om::math::VectorND< T, 2 >::yx |
A permutation of the vector elements that consists of the X and Y element swapped.
union { ... } |
|
static |
A constant vector with all elements equal to zero.