Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CVector Class Reference

Common vector and quaternion math helpers. More...

#include <Utils/CVector.h>

Static Public Member Functions

static core::vector3df lerp (const core::vector3df &a, const core::vector3df &b, float t)
 Linearly interpolate between two vectors.
static core::vector3df slerp (const core::vector3df &a, const core::vector3df &b, float t)
 Spherically interpolate between two direction vectors.
static core::vector3df reflect (const core::vector3df &inDirection, const core::vector3df &normal)
 Reflect a direction vector around a normal.
static float angle (const core::vector3df &a, const core::vector3df &b)
 Calculate the angle between two vectors in radians.
static core::vector3df project (const core::vector3df &vector, const core::vector3df &onNormal)
 Project a vector onto another vector.
static core::vector3df projectOnPlane (const core::vector3df &vector, const core::vector3df &planeNormal)
 Project a vector onto a plane.
static bool isParallel (const core::vector3df &a, const core::vector3df &b)
 Test whether two vectors are parallel or anti-parallel.
static core::vector3df quaternionToEuler (const core::quaternion &q)
 Convert a quaternion to Euler angles.
static core::quaternion getQuaternionFromAxes (const core::vector3df &xAxis, const core::vector3df &yAxis, const core::vector3df &zAxis)
 Build a quaternion from three orthogonal basis axes.

Detailed Description

Common vector and quaternion math helpers.

Member Function Documentation

◆ angle()

float Skylicht::CVector::angle ( const core::vector3df & a,
const core::vector3df & b )
static

Calculate the angle between two vectors in radians.

Parameters
aFirst vector.
bSecond vector.
Returns
Angle in radians, or 0 when either vector is too small.

◆ getQuaternionFromAxes()

core::quaternion Skylicht::CVector::getQuaternionFromAxes ( const core::vector3df & xAxis,
const core::vector3df & yAxis,
const core::vector3df & zAxis )
static

Build a quaternion from three orthogonal basis axes.

Parameters
xAxisLocal X axis.
yAxisLocal Y axis.
zAxisLocal Z axis.
Returns
Quaternion representing the basis orientation.

◆ isParallel()

bool Skylicht::CVector::isParallel ( const core::vector3df & a,
const core::vector3df & b )
static

Test whether two vectors are parallel or anti-parallel.

Parameters
aFirst vector.
bSecond vector.
Returns
True when the normalized dot product is approximately +/-1.

◆ lerp()

core::vector3df Skylicht::CVector::lerp ( const core::vector3df & a,
const core::vector3df & b,
float t )
static

Linearly interpolate between two vectors.

Parameters
aStart vector.
bEnd vector.
tInterpolation factor clamped to [0, 1].
Returns
Interpolated vector.

◆ project()

core::vector3df Skylicht::CVector::project ( const core::vector3df & vector,
const core::vector3df & onNormal )
static

Project a vector onto another vector.

Parameters
vectorVector to project.
onNormalTarget direction.
Returns
Projection of vector on onNormal, or zero if onNormal is too small.

◆ projectOnPlane()

core::vector3df Skylicht::CVector::projectOnPlane ( const core::vector3df & vector,
const core::vector3df & planeNormal )
static

Project a vector onto a plane.

Parameters
vectorVector to project.
planeNormalPlane normal.
Returns
Projection of vector onto the plane, or zero if the normal is too small.

◆ quaternionToEuler()

core::vector3df Skylicht::CVector::quaternionToEuler ( const core::quaternion & q)
static

Convert a quaternion to Euler angles.

Parameters
qQuaternion to convert.
Returns
Euler angles in radians.

◆ reflect()

core::vector3df Skylicht::CVector::reflect ( const core::vector3df & inDirection,
const core::vector3df & normal )
static

Reflect a direction vector around a normal.

Parameters
inDirectionIncoming direction.
normalSurface normal.
Returns
Reflected direction.

◆ slerp()

core::vector3df Skylicht::CVector::slerp ( const core::vector3df & a,
const core::vector3df & b,
float t )
static

Spherically interpolate between two direction vectors.

Parameters
aStart direction.
bEnd direction.
tInterpolation factor.
Returns
Spherically interpolated vector.

The documentation for this class was generated from the following file: