11 #ifndef QUATERNION_HPP 12 #define QUATERNION_HPP 98 const float&
w()
const {
107 for(
size_t i = 0;
i < 4; ++
i)
108 elems[
i] += other.elems[
i];
136 for(
size_t i = 0;
i < 4; ++
i)
146 float n = mgx::util::normsq(*
this);
162 for(
size_t i = 0;
i < 4; ++
i)
248 #endif // QUATERNION_HPP Quaternion operator+(const Quaternion &other) const
Quaternion addition.
Definition: Quaternion.hpp:115
Quaternion & operator/=(float v)
Division of a quaternion by a real number.
Definition: Quaternion.hpp:160
Quaternion inverse() const
Return the quaternion corresponding to the inverse transform.
Definition: Quaternion.hpp:144
Point3f axis() const
Returns the axis of the rotation corresponding to this quaternion.
CU_HOST_DEVICE float & y()
Short access to the second element.
Definition: Vector.hpp:706
Quaternion operator*(const Quaternion &other) const
Quaternion multiplication.
CU_HOST_DEVICE float & t()
Short access to the fourth element.
Definition: Vector.hpp:724
CU_HOST_DEVICE float & i()
Short access to the first element.
Definition: Vector.hpp:806
float & w()
Accessing the real part of the quaternion.
Definition: Quaternion.hpp:92
Quaternion(float x, float y, float z, float w)
Creates a quaternion specified by its components.
Definition: Quaternion.hpp:43
CU_HOST_DEVICE float & x()
Short access to the first element.
Definition: Vector.hpp:697
Quaternion conjugate() const
Return the conjugate of the current quaternion.
Definition: Quaternion.hpp:153
Point3f inverseRotate(const Point3f &v) const
Apply the inverse of the rotation contained in this quaternion on the vector.
const float & w() const
Accessing the real part of the quaternion.
Definition: Quaternion.hpp:98
Common definitions and utilities for all geometry algorithms This file is shared by cuda...
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
Quaternion & operator+=(const Quaternion &other)
Quaternion in-place addition.
Definition: Quaternion.hpp:105
float angle() const
Returns the angle of the rotation corresponding to this quaternion.
Quaternion & operator*=(float s)
In-place multiplication of a quaternion by a scalar.
Definition: Quaternion.hpp:134
Quaternion & operator=(const Quaternion &other)
Assignment operator for quaternions.
Implements the quaternion operations.
Definition: Quaternion.hpp:29
CU_HOST_DEVICE float & z()
Short access to the third element.
Definition: Vector.hpp:715
Point3f rotate(const Point3f &v) const
Apply the rotation contained in this quaternion on the vector.
Class representing a fixed-size matrix.
Definition: Matrix.hpp:44
void setMatrix(Matrix3f &m) const
Fill the matrix as argument from the quaternion.
void setAxisAngle(const Point3f &axis, float angle)
Set the quaternion to the described rotation.
Defines the Matrix class template This file is shared by cuda, do not include headers that nvcc can't...
Quaternion(const Quaternion &other)
Copy constructor.
Definition: Quaternion.hpp:51
Quaternion()
Default constructor.
Definition: Quaternion.hpp:35
Quaternion operator/(float v) const
Division of a quaternion by a real number.
Definition: Quaternion.hpp:170
Quaternion & operator*=(const Quaternion &other)
Quaternion in-place multiplication.
Defines the Vector class template This file is shared by cuda, do not include headers that nvcc can't...