Quat¶
The Quat
class template represents a quaterion
rotation/orientation, with predefined typedefs for float
and
double
.
Example:
#include <Imath/ImathQuat.h>
void
quat_example()
{
Imath::Quatf q (2.0f, 3.0f, 4.0f, 5.0f);
assert (q.r == 2.0f && q.v == Imath::V3f (3.0f, 4.0f, 5.0f));
Imath::Quatf r (1.0f, 0.0f, 0.0f, 1.0f);
assert (r.inverse() == Imath::Quatf (0.5f, 0.0f, 0.0f, -0.5f));
}
-
template <class T>
classQuat
¶ The Quat class implements the quaternion numerical type you will probably want to use this class to represent orientations in R3 and to convert between various euler angle reps.
You should probably use Imath::Euler<> for that.
Constructors
-
constexpr
Quat
()¶ Default constructor is the identity quat.
-
template <class S>
constexprQuat
(const Quat<S> &q)¶ Construct from a quaternion of a another base type.
-
constexpr
Quat
(T s, T i, T j, T k)¶ Initialize with real part
s
and imaginary vector 1(i,j,k)`.
-
~Quat
()¶ Destructor.
Basic Algebra
Note that the operator return values are NOT normalized
-
constexpr const Quat<T> &
operator*=
(T t)¶ Scalar multiplication: multiply both real and imaginary parts by the given scalar.
Query
-
constexpr T
length
() const¶ Return the R4 length.
-
constexpr T
angle
() const¶ Return the angle of the axis/angle representation.
-
constexpr Matrix33<T>
toMatrix33
() const¶ Return a 3x3 rotation matrix.
-
constexpr Matrix44<T>
toMatrix44
() const¶ Return a 4x4 rotation matrix.
Utility Methods
-
constexpr Vec3<T>
rotateVector
(const Vec3<T> &original) const¶ Rotate the given point by the quaterion.
Public Types
-
typedef T
BaseType
¶ The base type: In templates that accept a parameter
V
, you can refer toT
asV::BaseType
-
constexpr
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<<” with arguments (std::ostream& s, const Quat<T>& q) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- std::ostream &operator<<(std::ostream&, Imath::half)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Color4<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Euler<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Interval<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Line3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix22<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix33<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix44<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Plane3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Quat<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Shear6<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec2<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec4<T>&)