A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Kinoko::EGG::Vector3f Struct Reference

#include <Vector.hh>

Description

A 3D float vector.

Definition at line 107 of file Vector.hh.

Public Member Functions

constexpr Vector3f (f32 x_, f32 y_, f32 z_)
 
constexpr void setZero ()
 
constexpr void set (f32 val)
 
constexpr Vector3f operator- () const
 
constexpr Vector3f operator- (const Vector3f &rhs) const
 
constexpr Vector3foperator-= (const Vector3f &rhs)
 
constexpr Vector3f operator+ (const Vector3f &rhs) const
 
constexpr Vector3foperator+= (const Vector3f &rhs)
 
constexpr Vector3f operator+ (f32 val) const
 
constexpr Vector3foperator+= (f32 val)
 
constexpr Vector3f operator* (const Vector3f &rhs) const
 
constexpr Vector3f operator* (f32 scalar) const
 
constexpr Vector3foperator*= (f32 scalar)
 
constexpr Vector3f operator/ (f32 scalar) const
 
constexpr Vector3foperator/= (f32 scalar)
 
constexpr bool operator== (const Vector3f &rhs) const
 
constexpr bool operator!= (const Vector3f &rhs) const
 
 operator std::string () const
 Allows for copy construction from a vector to a string.
 
constexpr Vector3f cross (const Vector3f &rhs) const
 
constexpr f32 squaredLength () const
 The dot product between the vector and itself.
 
constexpr f32 dot (const Vector3f &rhs) const
 The dot product between two vectors.
 
constexpr f32 length () const
 The square root of the vector's dot product.
 
constexpr f32 ps_length () const
 
constexpr Vector3f proj (const Vector3f &rhs) const
 The projection of this vector onto rhs.
 
constexpr Vector3f rej (const Vector3f &rhs) const
 The rejection of this vector onto rhs.
 
constexpr std::pair< Vector3f, Vector3fprojAndRej (const Vector3f &rhs) const
 
constexpr Vector3f abs () const
 Returns the absolute value of each element of the vector.
 
constexpr f32 sqDistance (const Vector3f &rhs) const
 The square of the distance between two vectors.
 
constexpr EGG::Vector3f multInv (f32 val) const
 Multiplies a vector by the inverse of val.
 
constexpr f32 ps_dot () const
 Paired-singles dot product implementation.
 
constexpr f32 ps_dot (const Vector3f &rhs) const
 Paired-singles dot product implementation.
 
constexpr f32 ps_squareMag () const
 Differs from ps_dot due to variation in which operands are fused.
 
constexpr f32 normalise ()
 Normalizes the vector and returns the original length.
 
constexpr EGG::Vector3f ps_normalize () const
 
constexpr std::pair< f32, EGG::Vector3fps_normalized ()
 
constexpr void normalise2 ()
 
constexpr Vector3f maximize (const Vector3f &rhs) const
 Returns a vector whose elements are the max of the elements of both vectors.
 
constexpr Vector3f minimize (const Vector3f &rhs) const
 Returns a vector whose elements are the min of the elements of both vectors.
 
constexpr f32 ps_sqDistance (const Vector3f &rhs) const
 Paired-singles impl. of sqDistance.
 
constexpr Vector3f perpInPlane (const EGG::Vector3f &rhs, bool normalise) const
 Calculates the orthogonal vector, based on the plane defined by this vector and rhs.
 
void read (Stream &stream)
 Initializes a Vector3f by reading 12 bytes from the stream.
 

Public Attributes

f32 x
 
f32 y
 
f32 z
 

Static Public Attributes

static const Vector3f zero = Vector3f(0.0f, 0.0f, 0.0f)
 
static const Vector3f unit = Vector3f(1.0f, 1.0f, 1.0f)
 
static const Vector3f ex = Vector3f(1.0f, 0.0f, 0.0f)
 
static const Vector3f ey = Vector3f(0.0f, 1.0f, 0.0f)
 
static const Vector3f ez = Vector3f(0.0f, 0.0f, 1.0f)
 
static const Vector3f inf
 

Constructor & Destructor Documentation

◆ Vector3f()

Kinoko::EGG::Vector3f::Vector3f ( f32 x_,
f32 y_,
f32 z_ )
inlineconstexpr

Definition at line 116 of file Vector.hh.

Member Function Documentation

◆ abs()

Vector3f Kinoko::EGG::Vector3f::abs ( ) const
inlinenodiscardconstexpr

Returns the absolute value of each element of the vector.

Definition at line 239 of file Vector.hh.

◆ cross()

Vector3f Kinoko::EGG::Vector3f::cross ( const Vector3f & rhs) const
inlinenodiscardconstexpr0x80214968

Definition at line 196 of file Vector.hh.

◆ dot()

f32 Kinoko::EGG::Vector3f::dot ( const Vector3f & rhs) const
inlinenodiscardconstexpr

The dot product between two vectors.

Definition at line 206 of file Vector.hh.

◆ length()

f32 Kinoko::EGG::Vector3f::length ( ) const
inlinenodiscardconstexpr

The square root of the vector's dot product.

Definition at line 211 of file Vector.hh.

◆ maximize()

Vector3f Kinoko::EGG::Vector3f::maximize ( const Vector3f & rhs) const
inlinenodiscardconstexpr0x80085580

Returns a vector whose elements are the max of the elements of both vectors.

Definition at line 315 of file Vector.hh.

◆ minimize()

Vector3f Kinoko::EGG::Vector3f::minimize ( const Vector3f & rhs) const
inlinenodiscardconstexpr0x800855C0

Returns a vector whose elements are the min of the elements of both vectors.

Definition at line 327 of file Vector.hh.

◆ multInv()

EGG::Vector3f Kinoko::EGG::Vector3f::multInv ( f32 val) const
inlinenodiscardconstexpr0x806A62A4

Multiplies a vector by the inverse of val.

Definition at line 251 of file Vector.hh.

◆ normalise()

f32 Kinoko::EGG::Vector3f::normalise ( )
inlineconstexpr0x80243ADC

Normalizes the vector and returns the original length.

Returns
(optional) The length of the vector before normalisation.

Definition at line 278 of file Vector.hh.

◆ normalise2()

void Kinoko::EGG::Vector3f::normalise2 ( )
inlineconstexpr0x80243B6C

Definition at line 306 of file Vector.hh.

◆ operator std::string()

Kinoko::EGG::Vector3f::operator std::string ( ) const
inlineexplicitnodiscard

Allows for copy construction from a vector to a string.

Definition at line 190 of file Vector.hh.

◆ operator!=()

bool Kinoko::EGG::Vector3f::operator!= ( const Vector3f & rhs) const
inlinenodiscardconstexpr

Definition at line 185 of file Vector.hh.

◆ operator*() [1/2]

Vector3f Kinoko::EGG::Vector3f::operator* ( const Vector3f & rhs) const
inlinenodiscardconstexpr

Definition at line 157 of file Vector.hh.

◆ operator*() [2/2]

Vector3f Kinoko::EGG::Vector3f::operator* ( f32 scalar) const
inlinenodiscardconstexpr

Definition at line 161 of file Vector.hh.

◆ operator*=()

Vector3f & Kinoko::EGG::Vector3f::operator*= ( f32 scalar)
inlineconstexpr

Definition at line 169 of file Vector.hh.

◆ operator+() [1/2]

Vector3f Kinoko::EGG::Vector3f::operator+ ( const Vector3f & rhs) const
inlinenodiscardconstexpr

Definition at line 141 of file Vector.hh.

◆ operator+() [2/2]

Vector3f Kinoko::EGG::Vector3f::operator+ ( f32 val) const
inlinenodiscardconstexpr

Definition at line 149 of file Vector.hh.

◆ operator+=() [1/2]

Vector3f & Kinoko::EGG::Vector3f::operator+= ( const Vector3f & rhs)
inlineconstexpr

Definition at line 145 of file Vector.hh.

◆ operator+=() [2/2]

Vector3f & Kinoko::EGG::Vector3f::operator+= ( f32 val)
inlineconstexpr

Definition at line 153 of file Vector.hh.

◆ operator-() [1/2]

Vector3f Kinoko::EGG::Vector3f::operator- ( ) const
inlinenodiscardconstexpr

Definition at line 129 of file Vector.hh.

◆ operator-() [2/2]

Vector3f Kinoko::EGG::Vector3f::operator- ( const Vector3f & rhs) const
inlinenodiscardconstexpr

Definition at line 133 of file Vector.hh.

◆ operator-=()

Vector3f & Kinoko::EGG::Vector3f::operator-= ( const Vector3f & rhs)
inlineconstexpr

Definition at line 137 of file Vector.hh.

◆ operator/()

Vector3f Kinoko::EGG::Vector3f::operator/ ( f32 scalar) const
inlinenodiscardconstexpr

Definition at line 173 of file Vector.hh.

◆ operator/=()

Vector3f & Kinoko::EGG::Vector3f::operator/= ( f32 scalar)
inlineconstexpr

Definition at line 177 of file Vector.hh.

◆ operator==()

bool Kinoko::EGG::Vector3f::operator== ( const Vector3f & rhs) const
inlinenodiscardconstexpr

Definition at line 181 of file Vector.hh.

◆ perpInPlane()

Vector3f Kinoko::EGG::Vector3f::perpInPlane ( const EGG::Vector3f & rhs,
bool normalise ) const
inlinenodiscardconstexpr0x805AE9EC

Calculates the orthogonal vector, based on the plane defined by this vector and rhs.

Definition at line 346 of file Vector.hh.

◆ proj()

Vector3f Kinoko::EGG::Vector3f::proj ( const Vector3f & rhs) const
inlinenodiscardconstexpr0x805AEB88

The projection of this vector onto rhs.

Definition at line 223 of file Vector.hh.

◆ projAndRej()

std::pair< Vector3f, Vector3f > Kinoko::EGG::Vector3f::projAndRej ( const Vector3f & rhs) const
inlinenodiscardconstexpr0x805AEC24

Definition at line 234 of file Vector.hh.

◆ ps_dot() [1/2]

f32 Kinoko::EGG::Vector3f::ps_dot ( ) const
inlinenodiscardconstexpr

Paired-singles dot product implementation.

Definition at line 256 of file Vector.hh.

◆ ps_dot() [2/2]

f32 Kinoko::EGG::Vector3f::ps_dot ( const Vector3f & rhs) const
inlinenodiscardconstexpr0x8019ACAC

Paired-singles dot product implementation.

Definition at line 262 of file Vector.hh.

◆ ps_length()

f32 Kinoko::EGG::Vector3f::ps_length ( ) const
inlinenodiscardconstexpr0x8019AC68

Definition at line 216 of file Vector.hh.

◆ ps_normalize()

EGG::Vector3f Kinoko::EGG::Vector3f::ps_normalize ( ) const
inlinenodiscardconstexpr0x8019AC24

Definition at line 290 of file Vector.hh.

◆ ps_normalized()

std::pair< f32, EGG::Vector3f > Kinoko::EGG::Vector3f::ps_normalized ( )
inlinenodiscardconstexpr0x80793F04

Definition at line 296 of file Vector.hh.

◆ ps_sqDistance()

f32 Kinoko::EGG::Vector3f::ps_sqDistance ( const Vector3f & rhs) const
inlinenodiscardconstexpr0x8019ADE0

Paired-singles impl. of sqDistance.

Definition at line 339 of file Vector.hh.

◆ ps_squareMag()

f32 Kinoko::EGG::Vector3f::ps_squareMag ( ) const
inlinenodiscardconstexpr

Differs from ps_dot due to variation in which operands are fused.

Definition at line 269 of file Vector.hh.

◆ read()

void Kinoko::EGG::Vector3f::read ( Stream & stream)
inline

Initializes a Vector3f by reading 12 bytes from the stream.

Definition at line 365 of file Vector.hh.

◆ rej()

Vector3f Kinoko::EGG::Vector3f::rej ( const Vector3f & rhs) const
inlinenodiscardconstexpr0x805AEBD0

The rejection of this vector onto rhs.

Definition at line 229 of file Vector.hh.

◆ set()

void Kinoko::EGG::Vector3f::set ( f32 val)
inlineconstexpr

Definition at line 125 of file Vector.hh.

◆ setZero()

void Kinoko::EGG::Vector3f::setZero ( )
inlineconstexpr

Definition at line 121 of file Vector.hh.

◆ sqDistance()

f32 Kinoko::EGG::Vector3f::sqDistance ( const Vector3f & rhs) const
inlinenodiscardconstexpr

The square of the distance between two vectors.

Definition at line 244 of file Vector.hh.

◆ squaredLength()

f32 Kinoko::EGG::Vector3f::squaredLength ( ) const
inlinenodiscardconstexpr

The dot product between the vector and itself.

Definition at line 201 of file Vector.hh.

Member Data Documentation

◆ ex

Vector3f Kinoko::EGG::Vector3f::ex = Vector3f(1.0f, 0.0f, 0.0f)
inlinestaticconstexpr0x80384BB8

Definition at line 377 of file Vector.hh.

◆ ey

Vector3f Kinoko::EGG::Vector3f::ey = Vector3f(0.0f, 1.0f, 0.0f)
inlinestaticconstexpr0x80384BD0

Definition at line 377 of file Vector.hh.

◆ ez

Vector3f Kinoko::EGG::Vector3f::ez = Vector3f(0.0f, 0.0f, 1.0f)
inlinestaticconstexpr0x80384BE8

Definition at line 377 of file Vector.hh.

◆ inf

Vector3f Kinoko::EGG::Vector3f::inf
inlinestaticconstexpr0x809C3C04
Initial value:
= Vector3f(std::numeric_limits<f32>::infinity(),
std::numeric_limits<f32>::infinity(), std::numeric_limits<f32>::infinity())

Definition at line 378 of file Vector.hh.

◆ unit

Vector3f Kinoko::EGG::Vector3f::unit = Vector3f(1.0f, 1.0f, 1.0f)
inlinestaticconstexpr

Definition at line 376 of file Vector.hh.

◆ x

f32 Kinoko::EGG::Vector3f::x

Definition at line 371 of file Vector.hh.

◆ y

f32 Kinoko::EGG::Vector3f::y

Definition at line 372 of file Vector.hh.

◆ z

f32 Kinoko::EGG::Vector3f::z

Definition at line 373 of file Vector.hh.

◆ zero

Vector3f Kinoko::EGG::Vector3f::zero = Vector3f(0.0f, 0.0f, 0.0f)
inlinestaticconstexpr0x80384BA0

Definition at line 375 of file Vector.hh.