Represents a rotation using (x, y, z, w) and offers common conversions.
More...
#include <spk_quaternion.hpp>
|
|
float | x |
| | X component of the quaternion vector part.
|
|
float | y |
| | Y component of the quaternion vector part.
|
|
float | z |
| | Z component of the quaternion vector part.
|
|
float | w |
| | W component representing the scalar part.
|
|
| std::wostream & | operator<< (std::wostream &p_os, const Quaternion &p_vec) |
| | Streams the quaternion to a wide output stream.
|
| std::ostream & | operator<< (std::ostream &p_os, const Quaternion &p_vec) |
| | Streams the quaternion to a narrow output stream.
|
Represents a rotation using (x, y, z, w) and offers common conversions.
- See also
- Vector3
spk::Vector3 rotated = q.
rotate({1.f, 0.f, 0.f});
Represents a rotation using (x, y, z, w) and offers common conversions.
Definition spk_quaternion.hpp:19
Vector3 rotate(const Vector3 &p_v) const
Rotates a vector by this quaternion.
Definition spk_quaternion.cpp:154
static Quaternion fromEuler(const Vector3 &p_euler)
Builds from Euler angles in degrees.
Definition spk_quaternion.cpp:43
◆ Quaternion()
| spk::Quaternion::Quaternion |
( |
float | p_x, |
|
|
float | p_y, |
|
|
float | p_z, |
|
|
float | p_w ) |
Builds from components.
- Parameters
-
| p_x | X component. |
| p_y | Y component. |
| p_z | Z component. |
| p_w | W component. |
◆ fromAxisAngle()
Builds from axis and angle in degrees.
- Parameters
-
| p_axis | Normalized axis. |
| p_angle | Angle in degrees. |
- Returns
- Quaternion representing the axis-angle rotation.
◆ fromEuler()
Builds from Euler angles in degrees.
- Parameters
-
| p_euler | Pitch/Yaw/Roll in degrees. |
- Returns
- Quaternion representing the rotation.
◆ identity()
Returns the identity quaternion.
- Returns
- Quaternion with vector part zero and scalar part one.
◆ lookAt()
Builds a quaternion looking from eye to target with an up vector.
- Parameters
-
| p_eye | Eye position. |
| p_target | Target position. |
| p_up | Up direction. |
- Returns
- Quaternion aligning forward to the target.
◆ normalize()
Returns a normalized copy.
- Returns
- Unit-length quaternion pointing in the same direction.
◆ operator*() [1/2]
Concatenates two rotations.
- Parameters
-
| p_rhs | Right-hand quaternion. |
- Returns
- Combined rotation.
◆ operator*() [2/2]
Rotates a vector by this quaternion.
- Parameters
-
- Returns
- Rotated vector.
◆ rotate()
Rotates a vector by this quaternion.
- Parameters
-
- Returns
- Rotated vector.
◆ toEuler()
| Vector3 spk::Quaternion::toEuler |
( |
| ) |
const |
Converts to Euler angles in degrees.
- Returns
- Pitch/Yaw/Roll.
◆ toString()
| std::string spk::Quaternion::toString |
( |
| ) |
const |
Converts the quaternion to a string.
- Returns
- Components in (x, y, z, w) format.
◆ toWstring()
| std::wstring spk::Quaternion::toWstring |
( |
| ) |
const |
Converts the quaternion to a wide string.
- Returns
- Components in (x, y, z, w) wide format.
◆ operator<< [1/2]
| std::ostream & operator<< |
( |
std::ostream & | p_os, |
|
|
const Quaternion & | p_vec ) |
|
friend |
Streams the quaternion to a narrow output stream.
- Parameters
-
- Returns
- Stream reference after write.
◆ operator<< [2/2]
| std::wostream & operator<< |
( |
std::wostream & | p_os, |
|
|
const Quaternion & | p_vec ) |
|
friend |
Streams the quaternion to a wide output stream.
- Parameters
-
- Returns
- Stream reference after write.
The documentation for this class was generated from the following files: