DubiousEngine
0.2.0
Simple Game Engine
|
Representation of a position and rotation. More...
#include <Coordinate_space.h>
Public Member Functions | |
Coordinate_space ()=default | |
std::tuple< Unit_vector, Unit_vector, Unit_vector > | get_axes () const |
Get 3 axis. More... | |
void | get_matrix (float matrix[16]) const |
Get the OpenGL rotation Matrix. More... | |
const Point & | position () const |
Position accessor. More... | |
Point & | position () |
const Unit_quaternion & | rotation () const |
Rotation accessor. More... | |
Unit_quaternion & | rotation () |
void | translate (const Vector &diff) |
Move by the amount specified. More... | |
void | translate (const Local_vector &diff) |
Move by the amount specified. More... | |
void | rotate (const Unit_quaternion &diff) |
Rotate the coordinate space. More... | |
void | rotate (const Local_unit_quaternion &diff) |
Rotate the coordinate space. More... | |
Vector | transform (const Local_vector &v) const |
Converts the local vector to the global coord space. More... | |
Local_vector | transform (const Vector &v) const |
Converts the vector to the local coord space. More... | |
Point | transform (const Local_point &p) const |
Converts the local point to the global coord space. More... | |
Local_point | transform (const Point &p) const |
Converts the point to the local coord space. More... | |
Friends | |
class | Physics_test::Collision_solver_test |
Representation of a position and rotation.
The Coordinate_space is meant to represent a position and rotation. It allows you to hide the complexities of world versus local rotation and position. You can easily specify that you want to move along the global X OR local X axis. Likewise you can rotate around the global OR local Z axis.
The system uses a "Right Handed" coordinate space, the same as OpenGL and Bullet Physics. This means that as you are reading this, positive X is to your right, positive Y is up, and positive Z is going from this text to your eye. If you hold up your right hand and place your thumb along positive X and your index finger along positive Y then your middle finger is pointing along positive Z (at you).
|
default |
std::tuple< Unit_vector, Unit_vector, Unit_vector > Dubious::Math::Coordinate_space::get_axes | ( | ) | const |
Get 3 axis.
It's common to want the X, Y, and Z axis that make up a coordinate system
void Dubious::Math::Coordinate_space::get_matrix | ( | float | matrix[16] | ) | const |
Get the OpenGL rotation Matrix.
Get the rotation matrix from the Quaternion. This is directly usable by openGL
matrix | - [out] The rotation matrix |
|
inline |
Position accessor.
|
inline |
void Dubious::Math::Coordinate_space::rotate | ( | const Unit_quaternion & | diff | ) |
Rotate the coordinate space.
This version takes a global quaternion, therefore it rotates relative to global space
diff | - [in] The amount to rotate |
void Dubious::Math::Coordinate_space::rotate | ( | const Local_unit_quaternion & | diff | ) |
Rotate the coordinate space.
This version takes a local quaternion, therefore it rotates relative to local space
diff | - [in] The amount to rotate |
|
inline |
Rotation accessor.
|
inline |
Vector Dubious::Math::Coordinate_space::transform | ( | const Local_vector & | v | ) | const |
Converts the local vector to the global coord space.
v | - [in] a vector in local coordinate space |
Local_vector Dubious::Math::Coordinate_space::transform | ( | const Vector & | v | ) | const |
Converts the vector to the local coord space.
v | - [in] a vector in world coordinate space |
Point Dubious::Math::Coordinate_space::transform | ( | const Local_point & | p | ) | const |
Converts the local point to the global coord space.
Note that this is not a vector, it's a point. As such this takes the coordinate space position into account.
p | - [in] a point in local coordinate space |
Local_point Dubious::Math::Coordinate_space::transform | ( | const Point & | p | ) | const |
Converts the point to the local coord space.
Note that this is not a vector, it's a point. As such this takes the coordinate space position into account.
p | - [in] a point in world coordinate space |
void Dubious::Math::Coordinate_space::translate | ( | const Vector & | diff | ) |
Move by the amount specified.
This version takes a global vector, therefore it moves relative to global space.
diff | - [in] The amount to move |
void Dubious::Math::Coordinate_space::translate | ( | const Local_vector & | diff | ) |
Move by the amount specified.
This version takes a local vector, therefore it moves relative to local space.
diff | - [in] The amount to move |
|
friend |