88 const float&
w()
const {
97 for(
size_t i = 0;
i < 4; ++
i)
98 elems[
i] += other.elems[
i];
126 for(
size_t i = 0;
i < 4; ++
i)
136 float n = mgx::util::normsq(*
this);
152 for(
size_t i = 0;
i < 4; ++
i)
238 #endif // QUATERNION_HPP
Quaternion operator+(const Quaternion &other) const
Quaternion addition.
Definition: Quaternion.hpp:105
Quaternion & operator/=(float v)
Division of a quaternion by a real number.
Definition: Quaternion.hpp:150
Quaternion inverse() const
Return the quaternion corresponding to the inverse transform.
Definition: Quaternion.hpp:134
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:696
Quaternion operator*(const Quaternion &other) const
Quaternion multiplication.
CU_HOST_DEVICE float & i()
Short access to the first element.
Definition: Vector.hpp:796
float & w()
Accessing the real part of the quaternion.
Definition: Quaternion.hpp:82
Quaternion(float x, float y, float z, float w)
Creates a quaternion specified by its components.
Definition: Quaternion.hpp:33
CU_HOST_DEVICE float & x()
Short access to the first element.
Definition: Vector.hpp:687
Quaternion conjugate() const
Return the conjugate of the current quaternion.
Definition: Quaternion.hpp:143
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:88
Common definitions and utilities for all geometry algorithms This file is shared by cuda...
Quaternion & operator+=(const Quaternion &other)
Quaternion in-place addition.
Definition: Quaternion.hpp:95
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:124
Quaternion & operator=(const Quaternion &other)
Assignment operator for quaternions.
Implements the quaternion operations.
Definition: Quaternion.hpp:19
CU_HOST_DEVICE float & z()
Short access to the third element.
Definition: Vector.hpp:705
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:34
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:41
Quaternion()
Default constructor.
Definition: Quaternion.hpp:25
Quaternion operator/(float v) const
Division of a quaternion by a real number.
Definition: Quaternion.hpp:160
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...