Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches
tz::quat Struct Reference

Description

Quaternion. Represents a rotation in 3D space.

#include "quaternion.hpp"

Inheritance diagram for tz::quat:
tz::vector< float, 4 >

Public Member Functions

 quat (tz::v4f vec)
 Create a quaternion directly from xyzw components.
 
tz::m4f matrix () const
 Create a rotation matrix that transforms identically to the quaternion.
 
quat inverse () const
 Create a quaternion that causes the inverse transformation. Such that the product of this and the result are the identity quaternion.
 
quat combine (const quat &rhs) const
 Combine one quaternion with another, producing a result equal to applying both rotations.
 
tz::v3f rotate (tz::v3f pos) const
 Rotate a 3D position by this quaternion.
 
quat normalise () const
 Retrieve a normalised copy of the quaternion.
 
quat slerp (const quat &rhs, float factor) const
 Retrieve a quaternion that represents a spherical interpolation between this quaternion and another, based upon a given factor.
 
- Public Member Functions inherited from tz::vector< float, 4 >
constexpr vector (Ts &&... ts)
 
constexpr vector (std::array< float, N > data)
 
 vector ()=default
 
const float & operator[] (std::size_t idx) const
 
float & operator[] (std::size_t idx)
 
vector< float, N > & operator*= (const vector< float, N > &rhs)
 Multiply one vector with another.
 
vector< float, N > & operator/= (const vector< float, N > &rhs)
 Divide one vector by another.
 
vector< float, N > operator* (const vector< float, N > &rhs) const
 Multiply one vector with another.
 
vector< float, N > operator/ (const vector< float, N > &rhs) const
 Divide one vector by another.
 
vector< float, N > & operator+= (const vector< float, N > &rhs)
 Add one vector to another.
 
vector< float, N > & operator-= (const vector< float, N > &rhs)
 Subtract one vector from another.
 
vector< float, N > operator+ (const vector< float, N > &rhs) const
 Add one vector to another.
 
vector< float, N > operator- (const vector< float, N > &rhs) const
 Subtract one vector from another.
 
float length () const
 Retrieve the magnitude of the vector.
 
float dot (const vector< float, N > &rhs) const
 Retrieve the dot (scalar) product of two vectors.
 
vector< float, N > cross (const vector< float, N > &rhs) const
 Retrieve a cross product between two three-dimensional vectors.
 
bool operator== (const vector< float, N > &rhs) const=default
 Compare two vectors. Two vectors are equal if all of their components are exactly equal.
 

Static Public Member Functions

static quat iden ()
 Retrieve the identity quaternion, that is - represents no transformation.
 
static quat from_axis_angle (tz::v3f axis, float angle)
 Create a quaternion that represents a rotation about a certain axis.
 
static quat from_euler_angles (tz::v3f euler_angles)
 Create a quaternion that represents a rotation equivalent to the provided euler angles.
 
- Static Public Member Functions inherited from tz::vector< float, 4 >
static constexpr vector< float, N > zero ()
 Retrieve a vector filled with zeroes.
 
static constexpr vector< float, N > filled (float t)
 Retrieve a vector filled with the given value.
 

Constructor & Destructor Documentation

◆ quat()

tz::quat::quat ( tz::v4f vec)

Create a quaternion directly from xyzw components.

Member Function Documentation

◆ iden()

static quat tz::quat::iden ( )
inlinestatic

Retrieve the identity quaternion, that is - represents no transformation.

◆ from_axis_angle()

static quat tz::quat::from_axis_angle ( tz::v3f axis,
float angle )
static

Create a quaternion that represents a rotation about a certain axis.

◆ from_euler_angles()

static quat tz::quat::from_euler_angles ( tz::v3f euler_angles)
static

Create a quaternion that represents a rotation equivalent to the provided euler angles.

◆ matrix()

tz::m4f tz::quat::matrix ( ) const

Create a rotation matrix that transforms identically to the quaternion.

◆ inverse()

quat tz::quat::inverse ( ) const

Create a quaternion that causes the inverse transformation. Such that the product of this and the result are the identity quaternion.

◆ combine()

quat tz::quat::combine ( const quat & rhs) const

Combine one quaternion with another, producing a result equal to applying both rotations.

◆ rotate()

tz::v3f tz::quat::rotate ( tz::v3f pos) const

Rotate a 3D position by this quaternion.

◆ normalise()

quat tz::quat::normalise ( ) const

Retrieve a normalised copy of the quaternion.

◆ slerp()

quat tz::quat::slerp ( const quat & rhs,
float factor ) const

Retrieve a quaternion that represents a spherical interpolation between this quaternion and another, based upon a given factor.