Generalized three-element cartesian coordinate vector. More...
#include <sifteo/math.h>
Public Member Functions | |
template<typename R > | |
Vector3< R > | cast () const |
Explicitly cast this vector to another vector type, using default C++ truncation or extension rules. | |
T | len () const |
Calculate the scalar length (magnitude) of this vector. | |
T | len2 () const |
Calculate the scalar length (magnitude) of this vector, squared. More... | |
T | lenManhattan () const |
Calculate the manhattan (city block) distance of this vector. | |
Vector3< T > | normalize () const |
Return a normalized version of this vector. More... | |
Vector3< int > | round () const |
Round a floating point vector to the nearest integer. | |
void | set (T _x, T _y, T _z) |
Modify this vector's value in-place. | |
Vector3< double > | toDouble () const |
Explicit cast to double. | |
Vector3< float > | toFloat () const |
Explicit cast to float. | |
Vector3< int > | toInt () const |
Explicit cast to int. | |
Vector2< T > | xy () const |
Extract a 2-vector with only the XY components. | |
Vector2< T > | xz () const |
Extract a 2-vector with only the XZ components. | |
Vector2< T > | yx () const |
Extract a 2-vector with only the YX components. | |
Vector2< T > | yz () const |
Extract a 2-vector with only the YZ components. | |
Vector3< T > | zRotate (float angle) const |
Rotate the vector about the Z axis counterclockwise by 'angle' radians. | |
Vector3< T > | zRotateI (int angle) const |
Rotate this vector about the Z axis counterclockwise by an integer multiple of 90 degrees. More... | |
Vector2< T > | zx () const |
Extract a 2-vector with only the ZX components. | |
Vector2< T > | zy () const |
Extract a 2-vector with only the ZY components. | |
Public Attributes | |
T | x |
Vector component X. | |
T | y |
Vector component Y. | |
T | z |
Vector component Z. | |
Generalized three-element cartesian coordinate vector.
|
inline |
Calculate the scalar length (magnitude) of this vector, squared.
This avoids the costly square root calculation.
|
inline |
Return a normalized version of this vector.
The returned vector will have a magnitude of 1.0.
|
inline |
Rotate this vector about the Z axis counterclockwise by an integer multiple of 90 degrees.
The angle must be 0, 1, 2, or 3. If you must pass larger angles, you can use umod(a, 4) to fold them into this range.
Sifteo SDK v1.1.0 (see all versions)
Last updated Tue Dec 23 2014, by Doxygen