rl_basicray  1.0.12
rl_RayMath Class Reference

A class gathering together static methods for operations on ray position or direction vectors. More...

#include <rl_RayMath.h>

Static Public Member Functions

static void rotate (dvm3_RotMat const &rotmat, dvm3_Vector &vector)
 Rotate vector from STD coordinates to BCS coordinates. More...
 
static void rotate (dvm3_RotMat const &rotmat, double vector[])
 Rotate vector from STD coordinates to BCS coordinates. More...
 
static void derotate (dvm3_RotMat const &rotmat, dvm3_Vector &vector)
 De-rotate vector from BCS coordinates back to STD coordinates. More...
 
static void derotate (dvm3_RotMat const &rotmat, double vector[])
 De-rotate vector from BCS coordinates back to STD coordinates. More...
 
static void translate_rotate (dvm3_Vector const &trans, dvm3_RotMat const &rotmat, dvm3_Vector &vector)
 Translate to BCS origin, then rotate from STD to BCS coordinates. More...
 
static void translate_rotate (double const trans[], dvm3_RotMat const &rotmat, double vector[])
 Translate to BCS origin, then rotate from STD to BCS coordinates. More...
 
static void derotate_detranslate (dvm3_Vector const &trans, dvm3_RotMat const &rotmat, dvm3_Vector &vector)
 Rotate from BCS to STD coordinates, then translate back to original position. More...
 
static void derotate_detranslate (double const trans[], dvm3_RotMat const &rotmat, double vector[])
 Rotate from BCS to STD coordinates, then translate back to original position. More...
 

Detailed Description

A class gathering together static methods for operations on ray position or direction vectors.

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.

Member Function Documentation

◆ derotate() [1/2]

void rl_RayMath::derotate ( dvm3_RotMat const &  rotmat,
dvm3_Vector &  vector 
)
inlinestatic

De-rotate vector from BCS coordinates back to STD coordinates.

Parameters
rotmatrotation vector (STD to BCS) to be used. The INVERSE of rotmat is applied to the vector.
vectorvector to be rotated.

Definition at line 219 of file rl_RayMath.h.

◆ derotate() [2/2]

void rl_RayMath::derotate ( dvm3_RotMat const &  rotmat,
double  vector[] 
)
inlinestatic

De-rotate vector from BCS coordinates back to STD coordinates.

Parameters
rotmatrotation vector (STD to BCS) to be used. The INVERSE of rotmat is applied to the vector.
vectorc-style vector to be rotated.

Definition at line 228 of file rl_RayMath.h.

◆ derotate_detranslate() [1/2]

void rl_RayMath::derotate_detranslate ( dvm3_Vector const &  trans,
dvm3_RotMat const &  rotmat,
dvm3_Vector &  vector 
)
inlinestatic

Rotate from BCS to STD coordinates, then translate back to original position.

This is the inverse operation to translate_rotate.

Parameters
transtranslation vector.
rotmatrotation vector (STD to BCS) to be applied.
vectorc-style vector to be derotated.

Definition at line 267 of file rl_RayMath.h.

◆ derotate_detranslate() [2/2]

void rl_RayMath::derotate_detranslate ( double const  trans[],
dvm3_RotMat const &  rotmat,
double  vector[] 
)
inlinestatic

Rotate from BCS to STD coordinates, then translate back to original position.

This is the inverse operation to translate_rotate.

Parameters
transc-style translation vector.
rotmatrotation vector (STD to BCS) to be applied.
vectorc-style vector to be derotated.

Definition at line 278 of file rl_RayMath.h.

◆ rotate() [1/2]

void rl_RayMath::rotate ( dvm3_RotMat const &  rotmat,
dvm3_Vector &  vector 
)
inlinestatic

Rotate vector from STD coordinates to BCS coordinates.

Parameters
rotmatrotation vector (STD to BCS) to be applied.
vectorvector to be rotated.

Definition at line 197 of file rl_RayMath.h.

◆ rotate() [2/2]

void rl_RayMath::rotate ( dvm3_RotMat const &  rotmat,
double  vector[] 
)
inlinestatic

Rotate vector from STD coordinates to BCS coordinates.

Parameters
rotmatrotation vector (STD to BCS) to be applied.
vectorc-style vector to be rotated.

Definition at line 206 of file rl_RayMath.h.

◆ translate_rotate() [1/2]

void rl_RayMath::translate_rotate ( dvm3_Vector const &  trans,
dvm3_RotMat const &  rotmat,
dvm3_Vector &  vector 
)
inlinestatic

Translate to BCS origin, then rotate from STD to BCS coordinates.

Parameters
transtranslation vector.
rotmatrotation vector (STD to BCS) to be applied.
vectorvector to be derotated.

Definition at line 241 of file rl_RayMath.h.

◆ translate_rotate() [2/2]

void rl_RayMath::translate_rotate ( double const  trans[],
dvm3_RotMat const &  rotmat,
double  vector[] 
)
inlinestatic

Translate to BCS origin, then rotate from STD to BCS coordinates.

Parameters
transtranslation vector.
rotmatrotation vector (STD to BCS) to be applied.
vectorc-style vector to be derotated.

Definition at line 252 of file rl_RayMath.h.


The documentation for this class was generated from the following file: