SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
sourcepp::math::Vec< S_, P > Struct Template Reference

#include <Math.h>

Collaboration diagram for sourcepp::math::Vec< S_, P >:

Public Types

using value_type = P

Public Member Functions

constexpr Vec ()=default
template<std::convertible_to< P >... Vals>
constexpr Vec (Vals... vals)
constexpr const P * data () const
constexpr P * data ()
constexpr uint8_t size () const
constexpr P & operator[] (uint8_t index)
constexpr P operator[] (uint8_t index) const
constexpr Vec operator+ () const
constexpr Vec operator+ (Arithmetic auto scalar) const
template<uint8_t SO, Arithmetic PO>
constexpr Vec operator+ (const Vec< SO, PO > &other) const
constexpr void operator+= (Arithmetic auto scalar) const
template<uint8_t SO, Arithmetic PO>
constexpr void operator+= (const Vec< SO, PO > &other)
constexpr Vec operator- () const
constexpr Vec operator- (Arithmetic auto scalar) const
template<uint8_t SO, Arithmetic PO>
constexpr Vec operator- (const Vec< SO, PO > &other) const
constexpr void operator-= (Arithmetic auto scalar) const
template<uint8_t SO, Arithmetic PO>
constexpr void operator-= (const Vec< SO, PO > &other)
constexpr Vec operator* (Arithmetic auto scalar) const
constexpr void operator*= (Arithmetic auto scalar)
constexpr Vec operator/ (Arithmetic auto scalar) const
constexpr void operator/= (Arithmetic auto scalar)
constexpr Vec operator% (Arithmetic auto scalar) const
constexpr void operator%= (Arithmetic auto scalar)
template<uint8_t SO, Arithmetic PO>
constexpr bool operator== (const Vec< SO, PO > &other) const
template<uint8_t SO, Arithmetic PO = P>
constexpr Vec< SO, PO > to () const
template<uint8_t SO, Arithmetic PO>
constexpr Vec mul (const Vec< SO, PO > &other) const
template<uint8_t SO, Arithmetic PO>
constexpr Vec div (const Vec< SO, PO > &other) const
template<uint8_t SO, Arithmetic PO>
constexpr Vec mod (const Vec< SO, PO > &other) const
constexpr float magf () const
constexpr double mag () const
constexpr P sum () const
template<Arithmetic PO>
constexpr Vec scale (const Vec< S, PO > &other) const
template<Arithmetic PO>
constexpr P dot (const Vec< S, PO > &other) const
constexpr Vec abs () const
constexpr bool isZero () const

Static Public Member Functions

static constexpr Vec zero ()

Public Attributes

values [S]

Static Public Attributes

static constexpr uint8_t S = S_

Detailed Description

template<uint8_t S_, Arithmetic P>
struct sourcepp::math::Vec< S_, P >

Definition at line 72 of file Math.h.

Member Typedef Documentation

◆ value_type

template<uint8_t S_, Arithmetic P>
using sourcepp::math::Vec< S_, P >::value_type = P

Definition at line 76 of file Math.h.

Constructor & Destructor Documentation

◆ Vec() [1/2]

template<uint8_t S_, Arithmetic P>
sourcepp::math::Vec< S_, P >::Vec ( )
constexprdefault

◆ Vec() [2/2]

template<uint8_t S_, Arithmetic P>
template<std::convertible_to< P >... Vals>
sourcepp::math::Vec< S_, P >::Vec ( Vals... vals)
inlineconstexpr

Definition at line 85 of file Math.h.

Member Function Documentation

◆ abs()

template<uint8_t S_, Arithmetic P>
Vec sourcepp::math::Vec< S_, P >::abs ( ) const
inlinenodiscardconstexpr

Definition at line 320 of file Math.h.

◆ data() [1/2]

template<uint8_t S_, Arithmetic P>
P * sourcepp::math::Vec< S_, P >::data ( )
inlinenodiscardconstexpr

Definition at line 92 of file Math.h.

◆ data() [2/2]

template<uint8_t S_, Arithmetic P>
const P * sourcepp::math::Vec< S_, P >::data ( ) const
inlinenodiscardconstexpr

Definition at line 88 of file Math.h.

◆ div()

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
Vec sourcepp::math::Vec< S_, P >::div ( const Vec< SO, PO > & other) const
inlinenodiscardconstexpr

Definition at line 261 of file Math.h.

◆ dot()

template<uint8_t S_, Arithmetic P>
template<Arithmetic PO>
P sourcepp::math::Vec< S_, P >::dot ( const Vec< S, PO > & other) const
inlinenodiscardconstexpr

Definition at line 316 of file Math.h.

◆ isZero()

template<uint8_t S_, Arithmetic P>
bool sourcepp::math::Vec< S_, P >::isZero ( ) const
inlinenodiscardconstexpr

Definition at line 332 of file Math.h.

◆ mag()

template<uint8_t S_, Arithmetic P>
double sourcepp::math::Vec< S_, P >::mag ( ) const
inlinenodiscardconstexpr

Definition at line 290 of file Math.h.

◆ magf()

template<uint8_t S_, Arithmetic P>
float sourcepp::math::Vec< S_, P >::magf ( ) const
inlinenodiscardconstexpr

Definition at line 282 of file Math.h.

◆ mod()

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
Vec sourcepp::math::Vec< S_, P >::mod ( const Vec< SO, PO > & other) const
inlinenodiscardconstexpr

Definition at line 270 of file Math.h.

◆ mul()

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
Vec sourcepp::math::Vec< S_, P >::mul ( const Vec< SO, PO > & other) const
inlinenodiscardconstexpr

Definition at line 252 of file Math.h.

◆ operator%()

template<uint8_t S_, Arithmetic P>
Vec sourcepp::math::Vec< S_, P >::operator% ( Arithmetic auto scalar) const
inlinenodiscardconstexpr

Definition at line 214 of file Math.h.

◆ operator%=()

template<uint8_t S_, Arithmetic P>
void sourcepp::math::Vec< S_, P >::operator%= ( Arithmetic auto scalar)
inlineconstexpr

Definition at line 222 of file Math.h.

◆ operator*()

template<uint8_t S_, Arithmetic P>
Vec sourcepp::math::Vec< S_, P >::operator* ( Arithmetic auto scalar) const
inlinenodiscardconstexpr

Definition at line 186 of file Math.h.

◆ operator*=()

template<uint8_t S_, Arithmetic P>
void sourcepp::math::Vec< S_, P >::operator*= ( Arithmetic auto scalar)
inlineconstexpr

Definition at line 194 of file Math.h.

◆ operator+() [1/3]

template<uint8_t S_, Arithmetic P>
Vec sourcepp::math::Vec< S_, P >::operator+ ( ) const
inlinenodiscardconstexpr

Definition at line 114 of file Math.h.

◆ operator+() [2/3]

template<uint8_t S_, Arithmetic P>
Vec sourcepp::math::Vec< S_, P >::operator+ ( Arithmetic auto scalar) const
inlinenodiscardconstexpr

Definition at line 118 of file Math.h.

◆ operator+() [3/3]

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
Vec sourcepp::math::Vec< S_, P >::operator+ ( const Vec< SO, PO > & other) const
inlinenodiscardconstexpr

Definition at line 127 of file Math.h.

◆ operator+=() [1/2]

template<uint8_t S_, Arithmetic P>
void sourcepp::math::Vec< S_, P >::operator+= ( Arithmetic auto scalar) const
inlineconstexpr

Definition at line 135 of file Math.h.

◆ operator+=() [2/2]

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
void sourcepp::math::Vec< S_, P >::operator+= ( const Vec< SO, PO > & other)
inlineconstexpr

Definition at line 142 of file Math.h.

◆ operator-() [1/3]

template<uint8_t S_, Arithmetic P>
Vec sourcepp::math::Vec< S_, P >::operator- ( ) const
inlinenodiscardconstexpr

Definition at line 148 of file Math.h.

◆ operator-() [2/3]

template<uint8_t S_, Arithmetic P>
Vec sourcepp::math::Vec< S_, P >::operator- ( Arithmetic auto scalar) const
inlinenodiscardconstexpr

Definition at line 156 of file Math.h.

◆ operator-() [3/3]

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
Vec sourcepp::math::Vec< S_, P >::operator- ( const Vec< SO, PO > & other) const
inlinenodiscardconstexpr

Definition at line 165 of file Math.h.

◆ operator-=() [1/2]

template<uint8_t S_, Arithmetic P>
void sourcepp::math::Vec< S_, P >::operator-= ( Arithmetic auto scalar) const
inlineconstexpr

Definition at line 173 of file Math.h.

◆ operator-=() [2/2]

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
void sourcepp::math::Vec< S_, P >::operator-= ( const Vec< SO, PO > & other)
inlineconstexpr

Definition at line 180 of file Math.h.

◆ operator/()

template<uint8_t S_, Arithmetic P>
Vec sourcepp::math::Vec< S_, P >::operator/ ( Arithmetic auto scalar) const
inlinenodiscardconstexpr

Definition at line 200 of file Math.h.

◆ operator/=()

template<uint8_t S_, Arithmetic P>
void sourcepp::math::Vec< S_, P >::operator/= ( Arithmetic auto scalar)
inlineconstexpr

Definition at line 208 of file Math.h.

◆ operator==()

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
bool sourcepp::math::Vec< S_, P >::operator== ( const Vec< SO, PO > & other) const
inlinenodiscardconstexpr

Definition at line 229 of file Math.h.

◆ operator[]() [1/2]

template<uint8_t S_, Arithmetic P>
P & sourcepp::math::Vec< S_, P >::operator[] ( uint8_t index)
inlinenodiscardconstexpr

Definition at line 100 of file Math.h.

◆ operator[]() [2/2]

template<uint8_t S_, Arithmetic P>
P sourcepp::math::Vec< S_, P >::operator[] ( uint8_t index) const
inlinenodiscardconstexpr

Definition at line 107 of file Math.h.

◆ scale()

template<uint8_t S_, Arithmetic P>
template<Arithmetic PO>
Vec sourcepp::math::Vec< S_, P >::scale ( const Vec< S, PO > & other) const
inlinenodiscardconstexpr

Definition at line 307 of file Math.h.

◆ size()

template<uint8_t S_, Arithmetic P>
uint8_t sourcepp::math::Vec< S_, P >::size ( ) const
inlinenodiscardconstexpr

Definition at line 96 of file Math.h.

◆ sum()

template<uint8_t S_, Arithmetic P>
P sourcepp::math::Vec< S_, P >::sum ( ) const
inlinenodiscardconstexpr

Definition at line 298 of file Math.h.

◆ to()

template<uint8_t S_, Arithmetic P>
template<uint8_t SO, Arithmetic PO = P>
Vec< SO, PO > sourcepp::math::Vec< S_, P >::to ( ) const
inlinenodiscardconstexpr

Definition at line 243 of file Math.h.

◆ zero()

template<uint8_t S_, Arithmetic P>
constexpr Vec sourcepp::math::Vec< S_, P >::zero ( )
inlinestaticnodiscardconstexpr

Definition at line 328 of file Math.h.

Member Data Documentation

◆ S

template<uint8_t S_, Arithmetic P>
uint8_t sourcepp::math::Vec< S_, P >::S = S_
staticconstexpr

Definition at line 73 of file Math.h.

◆ values

template<uint8_t S_, Arithmetic P>
P sourcepp::math::Vec< S_, P >::values[S]

Definition at line 78 of file Math.h.


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