soo
3D game math library
Loading...
Searching...
No Matches
soo::Vector3< T > Class Template Reference

3D vector class. More...

#include <vector3.h>

Public Member Functions

 Vector3 (const T value) noexcept
 Vector3 (const T x, const T y, const T z) noexcept
 Vector3 (const Vector3 &other) noexcept
 Vector3 (Vector3 &&other) noexcept
Vector3operator= (const Vector3 &rhs) noexcept
Vector3operator= (Vector3 &&rhs) noexcept
Vector3 operator+ (const Vector3 &rhs) const noexcept
Vector3 operator- (const Vector3 &rhs) const noexcept
Vector3 operator* (const T scalar) const noexcept
Vector3 operator/ (const T scalar) const
Vector3operator+= (const Vector3 &rhs) noexcept
Vector3 operator-= (const Vector3 &rhs) noexcept
Vector3operator*= (const T scalar) noexcept
Vector3operator/= (const T scalar)
bool operator== (const Vector3 &rhs) const
getX () const noexcept
getY () const noexcept
getZ () const noexcept
void setX (const T value) noexcept
void setY (const T value) noexcept
void setZ (const T value) noexcept
std::string toString () const
getMagnitude () const
getMagnitudeSquared () const noexcept
void normalize ()
Vector3 getNormalized () const
dot (const Vector3 &rhs) const noexcept
Vector3 cross (const Vector3 &rhs) const noexcept

Public Attributes

x
y
z

Static Public Attributes

static const Vector3 ZERO

Detailed Description

template<std::floating_point T>
class soo::Vector3< T >

3D vector class.

Template Parameters
TType of the components. Must be a floating-point type.

Member Function Documentation

◆ cross()

template<std::floating_point T>
Vector3 soo::Vector3< T >::cross ( const Vector3< T > & rhs) const
inlinenoexcept
Returns
Cross product of two vectors.

◆ dot()

template<std::floating_point T>
T soo::Vector3< T >::dot ( const Vector3< T > & rhs) const
inlinenoexcept
Returns
Dot product of two vectors.

◆ getMagnitude()

template<std::floating_point T>
T soo::Vector3< T >::getMagnitude ( ) const
inline

Use the squared version if you only need relative comparison to avoid the expensive square root operation.

Returns
Magnitude(length) of the vector.

◆ getMagnitudeSquared()

template<std::floating_point T>
T soo::Vector3< T >::getMagnitudeSquared ( ) const
inlinenoexcept
Returns
Squared magnitude(length) of the vector.

◆ getNormalized()

template<std::floating_point T>
Vector3 soo::Vector3< T >::getNormalized ( ) const
inline
Returns
Normalized vector.

◆ normalize()

template<std::floating_point T>
void soo::Vector3< T >::normalize ( )
inline

Changes the vector's magnitude to 1.

◆ toString()

template<std::floating_point T>
std::string soo::Vector3< T >::toString ( ) const
inline
Returns
String formatted as "[x, y, z]".

Member Data Documentation

◆ ZERO

template<std::floating_point T>
const Vector3 soo::Vector3< T >::ZERO
static

Zero vector.


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