Math::Vector3 struct

A vector of 3 float values (x, y, z).

Public static variables

static const Vector3 ZERO

Public static functions

static auto OrientedAngle(const Vector3& v1, const Vector3& v2, const Vector3& orientationAxis) -> float
Returns the oriented angle between the vectors v1 and v2, in the range [0, 2pi).

Constructors, destructors, conversion operators

Vector3()
Vector3(float x, float y, float z)

Public functions

auto Length() const -> float
Returns the length of the vector, computed as the square root of then sum of its components squared.
auto SquaredLength() const -> float
Similar to Length(), but without applying the square root.
auto Normalized() const -> Vector3
Returns a normalized version of this vector. Being normalized means it has a length of 1.0.
auto Dot(const Vector3& other) const -> float
Computes the dot product between this vector and other.
auto Cross(const Vector3& other) const -> Vector3
Computes the cross product between this vector and other.
auto AngleTo(const Vector3& other) const -> float
Returns the angle between two vectors in radians, in the range [0, PI].
auto operator+=(const Vector3&) -> Vector3&
VECTOR 3.
auto operator+=(float) -> Vector3&
auto operator-=(const Vector3&) -> Vector3&
auto operator-=(float) -> Vector3&
auto operator*=(float) -> Vector3&
auto operator/=(float) -> Vector3&
auto operator==(const Vector3& b) const -> bool
auto operator!=(const Vector3& b) const -> bool

Public variables

float x
float y
float z

Function documentation

static float Math::Vector3::OrientedAngle(const Vector3& v1, const Vector3& v2, const Vector3& orientationAxis)

Returns the oriented angle between the vectors v1 and v2, in the range [0, 2pi).

Parameters
v1
v2
orientationAxis

An additional vector must be passed to determine which is the orientation (i.e. whether a positive angle moves from v1 to v2 or the other way around), following the "right hand rule".

float Math::Vector3::Dot(const Vector3& other) const

Computes the dot product between this vector and other.

Parameters
other

The dot product is computed as a.x * b.x + a.y * b.y + a.z * b.z

Vector3 Math::Vector3::Cross(const Vector3& other) const

Computes the cross product between this vector and other.

Parameters
other

This will return a vector that is perpendicular to both vectors.

float Math::Vector3::AngleTo(const Vector3& other) const

Returns the angle between two vectors in radians, in the range [0, PI].

Parameters
other