SuperTuxKart
|
A wrapper around bullets btVector3 to include conventient conversion functions (e.g. More...
#include <vec3.hpp>
Public Member Functions | |
Vec3 (const core::vector3df &v) | |
Convert an irrlicht vector3df into the internal (bullet) format. More... | |
Vec3 (const btVector3 &a) | |
Initialises a vector from a btVector3 (or a Vec3). More... | |
Vec3 () | |
Empty constructor. More... | |
Vec3 (float x, float y, float z) | |
Creates a 3d vector from three scalars. More... | |
Vec3 (float x, float y, float z, float w) | |
Creates a 3d vector from three scalars. More... | |
Vec3 (float x) | |
Initialises a 3d vector from one scalar value, which is used to initialise all components. More... | |
Vec3 (float heading, const Vec3 &normal) | |
Sets the heading, and computes pitch and roll dependent on the normal it is displayed on. More... | |
void | setHPR (const btQuaternion &q) |
Sets the heading, pitch, roll of this vector that is used to store a rotation from a quaternion. More... | |
const float & | operator[] (int n) const |
Returns a reference to the n-th element (x=0, y=1, z=2, w=3). More... | |
float & | operator[] (int n) |
Returns a reference to the n-th element (x=0, y=1, z=2, w=3). More... | |
const float | getHeading () const |
Returns the heading of a vector that is used to store a rotation. More... | |
const float | getPitch () const |
Returns the pitch of a vector that is used to store a rotation. More... | |
const float | getRoll () const |
Returns the roll of a vector that is used to store a rotation. More... | |
const float | getW () const |
Returns the W component (bullet vectors contain 4 elements, the last element is usually unused). More... | |
const void | setHeading (float f) |
Sets the heading of a vector that is used to store a rotation. More... | |
const void | setPitch (float f) |
Sets the pitch of a vector that is used to store a rotation. More... | |
const void | setRoll (float f) |
Sets the roll of a vector that is used to store a rotation. More... | |
const core::vector3df & | toIrrVector () const |
Converts a vec3 into an irrlicht vector (which is a simple type cast). More... | |
const core::vector3df | toIrrHPR () const |
Converts a bullet HPR value into an irrlicht HPR value. More... | |
const core::vector2df | toIrrVector2d () const |
Returns the X and Z component as an irrlicht 2d vector. More... | |
void | degreeToRad () |
Converts degree values stored in this vec3 to radians. More... | |
Vec3 & | operator= (const btVector3 &a) |
Sets this = a. More... | |
Vec3 & | operator= (const btQuaternion &q) |
Sets the rotation given by the quaternion as HPR vector. More... | |
bool | operator== (const Vec3 &other) const |
Operator== of btQuadWord also compares m_floats[3], which is not useful (and wrong in certain circumstances). More... | |
bool | operator!= (const Vec3 &other) const |
Operator!= of btQuadWord also compares m_floats[3], which is not useful (and wrong in certain circumstances). More... | |
Vec3 | operator- (const Vec3 &v1) const |
Computes this = this - v1. More... | |
Vec3 | operator- (const btVector3 v1) const |
Computes this = this - v1. More... | |
float | length2_2d () const |
Helper functions to treat this vec3 as a 2d vector. More... | |
float | length_2d () const |
Returns the length of this vector in the plane, i.e. More... | |
void | max (const Vec3 &a) |
Sets this = max(this, a) componentwise. More... | |
void | min (const Vec3 &a) |
Sets this = min(this, a) componentwise. More... | |
float | sideOfLine2D (const Vec3 &start, const Vec3 &end) const |
Determines which side of a line this point is. More... | |
float | sideofPlane (const Vec3 &x1, const Vec3 &x2, const Vec3 &x3) const |
Private Member Functions | |
void | setPitchRoll (const Vec3 &normal) |
Sets the pitch and the roll of this vector to follow the normal given. More... | |
A wrapper around bullets btVector3 to include conventient conversion functions (e.g.
between btVector3 and the graphics specific 3d vector).
|
inline |
Convert an irrlicht vector3df into the internal (bullet) format.
Irrlicht's and STK's axis are different (STK: Z up, irrlicht: Y up). We might want to change this as well, makes it easier to work with bullet and irrlicht together, without having to swap indices (bullet can handle any axis ordering). Note that toIrrVector swaps the axis as well (so a vector3df can be stored in and restored from a vec3).
|
inline |
Initialises a vector from a btVector3 (or a Vec3).
|
inline |
Empty constructor.
|
inline |
Creates a 3d vector from three scalars.
|
inline |
Creates a 3d vector from three scalars.
|
inline |
Initialises a 3d vector from one scalar value, which is used to initialise all components.
|
inline |
Sets the heading, and computes pitch and roll dependent on the normal it is displayed on.
heading | The heading to set. |
normal | The normal from which pitch and roll should be computed. |
|
inline |
Converts degree values stored in this vec3 to radians.
|
inline |
Returns the heading of a vector that is used to store a rotation.
|
inline |
Returns the pitch of a vector that is used to store a rotation.
|
inline |
Returns the roll of a vector that is used to store a rotation.
|
inline |
Returns the W component (bullet vectors contain 4 elements, the last element is usually unused).
|
inline |
Helper functions to treat this vec3 as a 2d vector.
This returns the square of the length of the first 2 dimensions.
|
inline |
Returns the length of this vector in the plane, i.e.
the vector is used as a 2d vector. Returns the length of the vector using only the x/z coordinates.
|
inline |
Sets this = max(this, a) componentwise.
Vector | to compare with. |
|
inline |
Sets this = min(this, a) componentwise.
a | Vector to compare with. |
|
inline |
Operator!= of btQuadWord also compares m_floats[3], which is not useful (and wrong in certain circumstances).
|
inline |
|
inline |
Sets this = a.
|
inline |
Sets the rotation given by the quaternion as HPR vector.
|
inline |
Operator== of btQuadWord also compares m_floats[3], which is not useful (and wrong in certain circumstances).
|
inline |
Returns a reference to the n-th element (x=0, y=1, z=2, w=3).
|
inline |
Returns a reference to the n-th element (x=0, y=1, z=2, w=3).
|
inline |
Sets the heading of a vector that is used to store a rotation.
void Vec3::setHPR | ( | const btQuaternion & | q | ) |
Sets the heading, pitch, roll of this vector that is used to store a rotation from a quaternion.
|
inline |
Sets the pitch of a vector that is used to store a rotation.
|
private |
Sets the pitch and the roll of this vector to follow the normal given.
The heading is taken from this vector.
normal | The normal vector to which pitch and roll should be aligned. |
|
inline |
Sets the roll of a vector that is used to store a rotation.
Determines which side of a line this point is.
This is using a 2d projection (into the X-Z plane).
start | The start point of the line. |
end | The end point of the line. |
|
inline |
Converts a bullet HPR value into an irrlicht HPR value.
|
inline |
Converts a vec3 into an irrlicht vector (which is a simple type cast).
|
inline |
Returns the X and Z component as an irrlicht 2d vector.