#include <rl_RayMath.h>
Static Public Member Functions | |
static void | rotate (dvm3_RotMat const &rotmat, dvm3_Vector &vector) |
static void | rotate (dvm3_RotMat const &rotmat, double vector[]) |
static void | derotate (dvm3_RotMat const &rotmat, dvm3_Vector &vector) |
static void | derotate (dvm3_RotMat const &rotmat, double vector[]) |
static void | translate_rotate (dvm3_Vector const &trans, dvm3_RotMat const &rotmat, dvm3_Vector &vector) |
static void | translate_rotate (double const trans[], dvm3_RotMat const &rotmat, double vector[]) |
static void | derotate_detranslate (dvm3_Vector const &trans, dvm3_RotMat const &rotmat, dvm3_Vector &vector) |
static void | derotate_detranslate (double const trans[], dvm3_RotMat const &rotmat, double vector[]) |
The class is a simple class to handle common numerical operations on 3-vectors of floating point T_fps representing ray position vectors and ray direction vectors.
rl_RayMath has only static member functions; there are no member data. Where possible, the static member functions are inlined.
The static member functions facilitate transformations between an initial coordinate system (termed "Standard" or STD) and another coordinate system (termed "Body Centered" or BCS). This is just convensient labeling which reflects a common usage of the transformations.
The BCS coordinate origin is (optionally) translated relative to the STD origin, and the orientation of the BCS coordinate axes relative to the STD axes is described by a proper rotation matrix.
The transformation from STD to BCS is accomplished by "rotate_translate" (or "rotate" if the coordinate origins are coincident).
The transformation from BCS back to STD is accomplished by "detranslate_derotate" (or "derotate" if the coordinate origins are coincident).
Direction vectors are always transformed using the "rotate"-"derotate" pair, NEVER the versions involving translation.
Positional vectors are transformed using "rotate_translate" and "detranslate_derotate"; if the STD and BCS coordinate systems origins are coincident, the transformation can be accomplished more economically using the "rotate" and "derotate" pair.
NOTE: although dvm3_Matrix works with either dvm3_Vector's or plain old c-style one-dimensional arrays, any call to an rl_RayMath method must use only one vector type within a given method call.
Definition at line 91 of file rl_RayMath.h.
void rl_RayMath::rotate | ( | dvm3_RotMat const & | rotmat, | |
dvm3_Vector & | vector | |||
) | [inline, static] |
Rotate vector from STD coordinates to BCS coordinates.
rotmat | rotation vector (STD to BCS) to be applied. | |
vector | vector to be rotated. |
Definition at line 197 of file rl_RayMath.h.
Referenced by rl_BasicRay::translate_rotate().
void rl_RayMath::rotate | ( | dvm3_RotMat const & | rotmat, | |
double | vector[] | |||
) | [inline, static] |
Rotate vector from STD coordinates to BCS coordinates.
rotmat | rotation vector (STD to BCS) to be applied. | |
vector | c-style vector to be rotated. |
Definition at line 206 of file rl_RayMath.h.
void rl_RayMath::derotate | ( | dvm3_RotMat const & | rotmat, | |
dvm3_Vector & | vector | |||
) | [inline, static] |
De-rotate vector from BCS coordinates back to STD coordinates.
rotmat | rotation vector (STD to BCS) to be used. The INVERSE of rotmat is applied to the vector. | |
vector | vector to be rotated. |
Definition at line 219 of file rl_RayMath.h.
Referenced by rl_BasicRay::derotate_detranslate().
void rl_RayMath::derotate | ( | dvm3_RotMat const & | rotmat, | |
double | vector[] | |||
) | [inline, static] |
De-rotate vector from BCS coordinates back to STD coordinates.
rotmat | rotation vector (STD to BCS) to be used. The INVERSE of rotmat is applied to the vector. | |
vector | c-style vector to be rotated. |
Definition at line 228 of file rl_RayMath.h.
void rl_RayMath::translate_rotate | ( | dvm3_Vector const & | trans, | |
dvm3_RotMat const & | rotmat, | |||
dvm3_Vector & | vector | |||
) | [inline, static] |
Translate to BCS origin, then rotate from STD to BCS coordinates.
trans | translation vector. | |
rotmat | rotation vector (STD to BCS) to be applied. | |
vector | vector to be derotated. |
Definition at line 241 of file rl_RayMath.h.
Referenced by rl_BasicRay::translate_rotate().
void rl_RayMath::translate_rotate | ( | double const | trans[], | |
dvm3_RotMat const & | rotmat, | |||
double | vector[] | |||
) | [inline, static] |
Translate to BCS origin, then rotate from STD to BCS coordinates.
trans | translation vector. | |
rotmat | rotation vector (STD to BCS) to be applied. | |
vector | c-style vector to be derotated. |
Definition at line 252 of file rl_RayMath.h.
void rl_RayMath::derotate_detranslate | ( | dvm3_Vector const & | trans, | |
dvm3_RotMat const & | rotmat, | |||
dvm3_Vector & | vector | |||
) | [inline, static] |
Rotate from BCS to STD coordinates, then translate back to original position. This is the inverse operation to translate_rotate.
trans | translation vector. | |
rotmat | rotation vector (STD to BCS) to be applied. | |
vector | c-style vector to be derotated. |
Definition at line 267 of file rl_RayMath.h.
Referenced by rl_BasicRay::derotate_detranslate().
void rl_RayMath::derotate_detranslate | ( | double const | trans[], | |
dvm3_RotMat const & | rotmat, | |||
double | vector[] | |||
) | [inline, static] |
Rotate from BCS to STD coordinates, then translate back to original position. This is the inverse operation to translate_rotate.
trans | c-style translation vector. | |
rotmat | rotation vector (STD to BCS) to be applied. | |
vector | c-style vector to be derotated. |
Definition at line 278 of file rl_RayMath.h.