109 w * other.
w -
x * other.
x -
y * other.
y -
z * other.
z,
110 w * other.
x +
x * other.
w +
y * other.
z -
z * other.
y,
111 w * other.
y -
x * other.
z +
y * other.
w +
z * other.
x,
112 w * other.
z +
x * other.
y -
y * other.
x +
z * other.
w
123 return (
w == other.
w &&
x == other.
x &&
y == other.
y &&
z == other.
z);
133 return !(*
this == other);
173 float magSquared =
w *
w +
x *
x +
y *
y +
z *
z;
174 if (magSquared == 0) {
178 return conjugate() * (1.0f / magSquared);
201 float halfAngle = angle * 0.5f;
202 float sinHalfAngle =
EU::sin(halfAngle);
205 axis.
x * sinHalfAngle,
206 axis.
y * sinHalfAngle,
207 axis.
z * sinHalfAngle
Declara la API de EngineMath dentro del subsistema Utilities.
Declara la API de Vector3 dentro del subsistema Math.
bool operator!=(const Quaternion &other) const
Inequality operator.
Quaternion operator*(float scalar) const
Multiplies this quaternion by a scalar.
Quaternion normalize() const
Normalizes the quaternion.
Quaternion operator-(const Quaternion &other) const
Subtracts another quaternion from this quaternion.
float x
The i component of the quaternion.
Quaternion conjugate() const
Returns the conjugate of the quaternion.
bool operator==(const Quaternion &other) const
Equality operator.
Quaternion()
Default constructor.
float y
The j component of the quaternion.
float z
The k component of the quaternion.
Quaternion(float w, float x, float y, float z)
Parameterized constructor.
float w
The real part of the quaternion.
const float * data() const
Returns a pointer to the quaternion's data.
Quaternion inverse() const
Returns the inverse of the quaternion.
float magnitude() const
Calculates the magnitude (length) of the quaternion.
Quaternion operator*(const Quaternion &other) const
Multiplies this quaternion by another quaternion.
Vector3 rotate(const Vector3 &v) const
Rotates a vector by this quaternion.
static Quaternion fromAxisAngle(const Vector3 &axis, float angle)
Constructs a quaternion from an axis and an angle (in radians).
Quaternion operator+(const Quaternion &other) const
Adds another quaternion to this quaternion.
float x
The x-coordinate of the vector.
float z
The z-coordinate of the vector.
float y
The y-coordinate of the vector.
float sqrt(float value)
Computes the square root using the Newton-Raphson method.
float sin(float angle)
Calcula el seno de un ángulo en radianes.
float cos(float angle)
Calcula el coseno de un ángulo en radianes.