Tuesday
|
The quat
class template and its associated functions.
Classes | |
class | tue::quat< T > |
A quaternion. More... | |
Typedefs | |
using | tue::fquat = quat< float > |
A quaternion with float components. More... | |
using | tue::dquat = quat< double > |
A quaternion with double components. More... | |
Functions | |
template<typename T , typename U > | |
constexpr quat< decltype(std::declval< T >)*std::declval< U >))> | tue::operator* (const quat< T > &lhs, const quat< U > &rhs) noexcept |
Computes a copy of lhs rotated by rhs . More... | |
template<typename T , typename U > | |
constexpr vec3< decltype(std::declval< T >)*std::declval< U >))> | tue::operator* (const vec3< T > &lhs, const quat< U > &rhs) noexcept |
Computes a copy of lhs rotated by rhs . More... | |
template<typename T , typename U > | |
constexpr bool | tue::operator== (const quat< T > &lhs, const quat< U > &rhs) noexcept |
Determines whether or not two quat 's compare equal. More... | |
template<typename T , typename U > | |
constexpr bool | tue::operator!= (const quat< T > &lhs, const quat< U > &rhs) noexcept |
Determines whether or not two quat 's compare not equal. More... | |
template<typename T > | |
quat< T > | tue::math::normalize (const quat< T > &q) noexcept |
Computes a normalized copy of q . More... | |
template<typename T > | |
constexpr quat< T > | tue::math::conjugate (const quat< T > &q) noexcept |
Computes the conjugate of q . More... | |
class tue::quat |
A quaternion.
quat
has the same size and alignment requirements as T[4]
. The first three components represent the vector part of the quaternion. The fourth component represents the scalar part.
T | The component type. is_vec_component<T>value must be true . |
Public Types | |
using | component_type = T |
This quat type's component type. More... | |
Static Public Attributes | |
static constexpr int | component_count = 4 |
This quat type's component count. More... | |
Constructors, Conversions, and Factory Functions | |
quat () noexcept=default | |
Default constructs each component. More... | |
constexpr | quat (const T &x, const T &y, const T &z, const T &w) noexcept |
Constructs each component with the value of the corresponding argument. More... | |
constexpr | quat (const vec3< T > &xyz, const T &w) noexcept |
Constructs each component with the value of the corresponding argument. More... | |
constexpr | quat (const vec4< T > &xyzw) noexcept |
Explicitly casts a vec4 to a quat . More... | |
template<typename U > | |
constexpr | quat (const quat< U > &q) noexcept |
Explicitly casts another quat to a new component type. More... | |
template<typename U > | |
constexpr | operator quat< U > () const noexcept |
Implicitly casts this quat to a new component type. More... | |
static constexpr quat< T > | identity () noexcept |
Returns a quat with the fourth component set to 1 and all other components set to 0 . More... | |
Public Member Functions | |
template<typename I > | |
constexpr const T & | operator[] (const I &i) const noexcept |
Returns a reference to the component at the given index. More... | |
template<typename I > | |
T & | operator[] (const I &i) noexcept |
Returns a reference to the component at the given index. More... | |
const T * | data () const noexcept |
Returns a pointer to this quat 's underlying component array. More... | |
T * | data () noexcept |
Returns a pointer to this quat 's underlying component array. More... | |
constexpr T | x () const noexcept |
Returns a copy of this quat 's first component. More... | |
constexpr T | y () const noexcept |
Returns a copy of this quat 's second component. More... | |
constexpr T | z () const noexcept |
Returns a copy of this quat 's third component. More... | |
constexpr T | w () const noexcept |
Returns a copy of this quat 's fourth component. More... | |
constexpr vec3< T > | xyz () const noexcept |
Returns a copy of this quat 's first three components. More... | |
constexpr vec4< T > | xyzw () const noexcept |
Returns a copy of this quat 's four components. More... | |
void | set_x (const T &x) noexcept |
Sets this quat 's first component. More... | |
void | set_y (const T &y) noexcept |
Sets this quat 's second component. More... | |
void | set_z (const T &z) noexcept |
Sets this quat 's third component. More... | |
void | set_w (const T &w) noexcept |
Sets this quat 's fourth component. More... | |
void | set_xyz (const T &x, const T &y, const T &z) noexcept |
Sets this quat 's first three components. More... | |
void | set_xyz (const vec3< T > &xyz) noexcept |
Sets this quat 's first three components. More... | |
void | set_xyzw (const T &x, const T &y, const T &z, const T &w) noexcept |
Sets this quat 's four components. More... | |
void | set_xyzw (const vec3< T > &xyz, const T &w) noexcept |
Sets this quat 's four components. More... | |
void | set_xyzw (const vec4< T > &xyzw) noexcept |
Sets this quat 's four components. More... | |
constexpr vec3< T > | v () const noexcept |
Returns a copy of this quat 's first three components. More... | |
constexpr T | s () const noexcept |
Returns a copy of this quat 's fourth component. More... | |
void | set_v (const T &x, const T &y, const T &z) noexcept |
Sets this quat 's first three components. More... | |
void | set_v (const vec3< T > &v) noexcept |
Sets this quat 's first three components. More... | |
void | set_s (const T &s) noexcept |
Sets this quat 's fourth component. More... | |
template<typename U > | |
quat< T > & | operator*= (const quat< U > &q) noexcept |
Rotates this quat by q . More... | |
using tue::quat< T >::component_type = T |
This quat
type's component type.
|
static |
This quat
type's component count.
|
inlinenoexcept |
Constructs each component with the value of the corresponding argument.
x | The value to construct the first component with. |
y | The value to construct the second component with. |
z | The value to construct the third component with. |
w | The value to construct the fourth component with. |
|
inlinenoexcept |
Constructs each component with the value of the corresponding argument.
xyz | The values to construct the first three components with. |
w | The value to construct the fourth component with. |
|
inlineexplicitnoexcept |
Explicitly casts a vec4
to a quat
.
xyzw | The vec to cast from. |
|
inlineexplicitnoexcept |
Explicitly casts another quat
to a new component type.
U | The component type of q . |
q | The quat to cast from. |
|
inlinenoexcept |
Implicitly casts this quat
to a new component type.
U | The new component type. |
quat
with the new component type. Returns a quat
with the fourth component set to 1
and all other components set to 0
.
quat
with the fourth component set to 1
and all other components set to 0
.
|
inlinenoexcept |
Returns a reference to the component at the given index.
No bounds checking is performed.
I | The index type. |
i | The index. |
|
inlinenoexcept |
Returns a reference to the component at the given index.
No bounds checking is performed.
I | The index type. |
i | The index. |
|
inlinenoexcept |
Returns a pointer to this quat
's underlying component array.
quat
's underlying component array.
|
inlinenoexcept |
Returns a pointer to this quat
's underlying component array.
quat
's underlying component array.
|
inlinenoexcept |
Returns a copy of this quat
's first component.
quat
's first component.
|
inlinenoexcept |
Returns a copy of this quat
's second component.
quat
's second component.
|
inlinenoexcept |
Returns a copy of this quat
's third component.
quat
's third component.
|
inlinenoexcept |
Returns a copy of this quat
's fourth component.
quat
's fourth component. Returns a copy of this quat
's first three components.
quat
's first three components. Returns a copy of this quat
's four components.
quat
's four components.
|
inlinenoexcept |
Sets this quat
's first component.
x | The new value for the first component. |
|
inlinenoexcept |
Sets this quat
's second component.
y | The new value for the second component. |
|
inlinenoexcept |
Sets this quat
's third component.
z | The new value for the third component. |
|
inlinenoexcept |
Sets this quat
's fourth component.
w | The new value for the fourth component. |
|
inlinenoexcept |
Sets this quat
's first three components.
x | The new value for the first component. |
y | The new value for the second component. |
z | The new value for the third component. |
Sets this quat
's first three components.
xyz | The new values for the first three components. |
|
inlinenoexcept |
Sets this quat
's four components.
x | The new value for the first component. |
y | The new value for the second component. |
z | The new value for the third component. |
w | The new value for the fourth component. |
|
inlinenoexcept |
Sets this quat
's four components.
xyz | The new values for the first three components. |
w | The new value for the fourth component. |
Sets this quat
's four components.
xyzw | The new values for the four components. |
Returns a copy of this quat
's first three components.
quat
's first three components.
|
inlinenoexcept |
Returns a copy of this quat
's fourth component.
quat
's fourth component.
|
inlinenoexcept |
Sets this quat
's first three components.
x | The new value for the first component. |
y | The new value for the second component. |
z | The new value for the third component. |
Sets this quat
's first three components.
v | The new values for the first three components. |
|
inlinenoexcept |
Sets this quat
's fourth component.
s | The new value for the fourth component. |
|
inlinenoexcept |
Rotates this quat
by q
.
The operand order might be the opposite of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.
U | The component type of q . |
q | A rotation quat . |
quat
. using tue::fquat = typedef quat<float> |
A quaternion with float
components.
using tue::dquat = typedef quat<double> |
A quaternion with double
components.
|
inlinenoexcept |
Computes a copy of lhs
rotated by rhs
.
The operand order might be the opposite of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.
T | The component type of lhs . |
U | The component type of rhs . |
lhs | The left-hand side operand. |
rhs | The right-hand side operand. |
lhs
rotated by rhs
.
|
inlinenoexcept |
Computes a copy of lhs
rotated by rhs
.
The operand order might be the opposite of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.
T | The component type of lhs . |
U | The component type of rhs . |
lhs | The left-hand side operand. |
rhs | The right-hand side operand. |
lhs
rotated by rhs
.
|
inlinenoexcept |
Determines whether or not two quat
's compare equal.
T | The component type of lhs . |
U | The component type of rhs . |
lhs | The left-hand side operand. |
rhs | The right-hand side operand. |
true
if all the corresponding pairs of components compare equal and false
otherwise.
|
inlinenoexcept |
Determines whether or not two quat
's compare not equal.
T | The component type of lhs . |
U | The component type of rhs . |
lhs | The left-hand side operand. |
rhs | The right-hand side operand. |
true
if at least one of the corresponding pairs of components compares not equal and false
otherwise.
|
inlinenoexcept |
Computes a normalized copy of q
.
T | The component type of q . |
q | A quat . |
q
.
|
inlinenoexcept |
Computes the conjugate of q
.
T | The component type of q . |
q | A quat . |
q
.