198 auto radians = angle * 3.1415927f / 180.0f;
228 array<float, 4> _data;
325 return (array<float, 4>&)
data;
411 auto qInverted =
Quaternion(1.0f / q[0], 1.0f / q[1], 1.0f / q[2], 1.0f / q[3]);
449 auto qInverted =
Quaternion(1.0f / q[0], 1.0f / q[1], 1.0f / q[2], 1.0f / q[3]);
470 return this->
equals(q) ==
false;
497 return (
this == &q) ||
static float sqrt(float value)
Returns the square of given value.
static float cos(float value)
Returns the cosine of an angle.
static constexpr float EPSILON
static int32_t abs(int32_t value)
Returns absolute value.
static float sin(float value)
Returns the sine of an angle.
Quaternion & rotate(const Vector3 &axis, float angle)
Creates a rotation quaternion.
Quaternion & setY(float y)
Set Y.
array< float, 4 > & getArray() const
Returns array data.
bool equals(const Quaternion &q, float tolerance) const
Compares this quaternion with given quaternion.
Quaternion & setZ(float z)
Set Z.
bool equals(const Quaternion &q) const
Compares this quaternion with given quaternion.
Quaternion(const Vector3 &v, float w)
Public constructor.
Quaternion operator+(const Quaternion &q) const
Operator +.
Quaternion & multiply(const Quaternion q)
Multiplies this quaternion with quaternion q.
Quaternion operator*(const float f) const
Operator * (float)
Matrix4x4 computeMatrix() const
Computes a matrix from given.
Quaternion(float x, float y, float z, float w)
Public constructor.
Quaternion operator-(const Quaternion &q) const
Operator -.
Quaternion()
Public constructor.
Quaternion & identity()
Set up quaternion identity.
Quaternion & set(const Vector3 &v, float w)
Set quaternion.
Quaternion & operator/=(Quaternion &q)
Operator /=.
Quaternion & set(float x, float y, float z, float w)
Set up this quaternion by components.
Quaternion & operator*=(Quaternion &q)
Operator *=.
Quaternion & invert()
Inverts this quaternion.
Quaternion operator/(const float f) const
Operator / (f)
Quaternion & operator+=(const Quaternion &q)
Operator +=.
Quaternion(const Quaternion &q)
Public constructor.
const float & operator[](int i) const
Const array access operator.
bool operator!=(const Quaternion &q) const
Non equality comparison operator.
Quaternion & setW(float w)
Set W.
float & operator[](int i)
Array access operator.
Quaternion & set(const Quaternion &q)
Sets up this quaternion by quaternion q.
Quaternion & operator-=(Quaternion &q)
Operator -=.
Quaternion & setX(float x)
Set X.
Quaternion & normalize()
Normalize quaternion.
Quaternion clone() const
Clones the quaternion.
Quaternion & scale(float value)
Scales this quaternion with given value.
bool operator==(const Quaternion &q) const
Equality comparison operator.
Vector3 multiply(const Vector3 &v) const
Multiplies a quaternion with given vector v.
Quaternion & sub(const Quaternion &q)
Subtracts given quaternion q from this quaternion.
Quaternion & add(const Quaternion &q)
Adds given quaternion q to this quaternion.
Vector3 & set(float x, float y, float z)
Set up vector.
Vector3 & add(const Vector3 &v)
Adds a vector.
static Vector3 computeCrossProduct(const Vector3 &v1, const Vector3 &v2)
Compute the cross product of vector v1 and v2.
Vector3 & scale(float scale)
Scale this vector.