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>
requires (sizeof...(Vals) == S)
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
 
template<uint8_t SO, Arithmetic PO>
constexpr Vec operator+ (const Vec< SO, PO > &other) const
 
template<uint8_t SO, Arithmetic PO>
constexpr void operator+= (const Vec< SO, PO > &other)
 
constexpr Vec operator- () const
 
template<uint8_t SO, Arithmetic PO>
constexpr Vec operator- (const Vec< SO, PO > &other) 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]
 

Detailed Description

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

Definition at line 65 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 80 of file Math.h.

Constructor & Destructor Documentation

◆ Vec() [1/2]

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

◆ Vec() [2/2]

template<uint8_t S, Arithmetic P>
template<std::convertible_to< P >... Vals>
requires (sizeof...(Vals) == S)
constexpr sourcepp::math::Vec< S, P >::Vec ( Vals...  vals)
inlineconstexpr

Definition at line 76 of file Math.h.

Member Function Documentation

◆ abs()

template<uint8_t S, Arithmetic P>
constexpr Vec sourcepp::math::Vec< S, P >::abs ( ) const
inlineconstexpr

Definition at line 286 of file Math.h.

◆ data() [1/2]

template<uint8_t S, Arithmetic P>
constexpr P * sourcepp::math::Vec< S, P >::data ( )
inlineconstexpr

Definition at line 86 of file Math.h.

◆ data() [2/2]

template<uint8_t S, Arithmetic P>
constexpr const P * sourcepp::math::Vec< S, P >::data ( ) const
inlineconstexpr

Definition at line 82 of file Math.h.

◆ div()

template<uint8_t S, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
constexpr Vec sourcepp::math::Vec< S, P >::div ( const Vec< SO, PO > &  other) const
inlineconstexpr

Definition at line 227 of file Math.h.

◆ dot()

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

Definition at line 282 of file Math.h.

◆ isZero()

template<uint8_t S, Arithmetic P>
constexpr bool sourcepp::math::Vec< S, P >::isZero ( ) const
inlineconstexpr

Definition at line 298 of file Math.h.

◆ mag()

template<uint8_t S, Arithmetic P>
constexpr double sourcepp::math::Vec< S, P >::mag ( ) const
inlineconstexpr

Definition at line 256 of file Math.h.

◆ magf()

template<uint8_t S, Arithmetic P>
constexpr float sourcepp::math::Vec< S, P >::magf ( ) const
inlineconstexpr

Definition at line 248 of file Math.h.

◆ mod()

template<uint8_t S, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
constexpr Vec sourcepp::math::Vec< S, P >::mod ( const Vec< SO, PO > &  other) const
inlineconstexpr

Definition at line 236 of file Math.h.

◆ mul()

template<uint8_t S, Arithmetic P>
template<uint8_t SO, Arithmetic PO>
constexpr Vec sourcepp::math::Vec< S, P >::mul ( const Vec< SO, PO > &  other) const
inlineconstexpr

Definition at line 218 of file Math.h.

◆ operator%()

template<uint8_t S, Arithmetic P>
constexpr Vec sourcepp::math::Vec< S, P >::operator% ( Arithmetic auto  scalar) const
inlineconstexpr

Definition at line 180 of file Math.h.

◆ operator%=()

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

Definition at line 188 of file Math.h.

◆ operator*()

template<uint8_t S, Arithmetic P>
constexpr Vec sourcepp::math::Vec< S, P >::operator* ( Arithmetic auto  scalar) const
inlineconstexpr

Definition at line 152 of file Math.h.

◆ operator*=()

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

Definition at line 160 of file Math.h.

◆ operator+() [1/2]

template<uint8_t S, Arithmetic P>
constexpr Vec sourcepp::math::Vec< S, P >::operator+ ( ) const
inlineconstexpr

Definition at line 108 of file Math.h.

◆ operator+() [2/2]

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

Definition at line 113 of file Math.h.

◆ operator+=()

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

Definition at line 122 of file Math.h.

◆ operator-() [1/2]

template<uint8_t S, Arithmetic P>
constexpr Vec sourcepp::math::Vec< S, P >::operator- ( ) const
inlineconstexpr

Definition at line 128 of file Math.h.

◆ operator-() [2/2]

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

Definition at line 137 of file Math.h.

◆ operator-=()

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

Definition at line 146 of file Math.h.

◆ operator/()

template<uint8_t S, Arithmetic P>
constexpr Vec sourcepp::math::Vec< S, P >::operator/ ( Arithmetic auto  scalar) const
inlineconstexpr

Definition at line 166 of file Math.h.

◆ operator/=()

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

Definition at line 174 of file Math.h.

◆ operator==()

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

Definition at line 195 of file Math.h.

◆ operator[]() [1/2]

template<uint8_t S, Arithmetic P>
constexpr P & sourcepp::math::Vec< S, P >::operator[] ( uint8_t  index)
inlineconstexpr

Definition at line 94 of file Math.h.

◆ operator[]() [2/2]

template<uint8_t S, Arithmetic P>
constexpr P sourcepp::math::Vec< S, P >::operator[] ( uint8_t  index) const
inlineconstexpr

Definition at line 101 of file Math.h.

◆ scale()

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

Definition at line 273 of file Math.h.

◆ size()

template<uint8_t S, Arithmetic P>
constexpr uint8_t sourcepp::math::Vec< S, P >::size ( ) const
inlineconstexpr

Definition at line 90 of file Math.h.

◆ sum()

template<uint8_t S, Arithmetic P>
constexpr P sourcepp::math::Vec< S, P >::sum ( ) const
inlineconstexpr

Definition at line 264 of file Math.h.

◆ to()

template<uint8_t S, Arithmetic P>
template<uint8_t SO, Arithmetic PO = P>
constexpr Vec< SO, PO > sourcepp::math::Vec< S, P >::to ( ) const
inlineconstexpr

Definition at line 209 of file Math.h.

◆ zero()

template<uint8_t S, Arithmetic P>
static constexpr Vec sourcepp::math::Vec< S, P >::zero ( )
inlinestaticconstexpr

Definition at line 294 of file Math.h.

Member Data Documentation

◆ values

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

Definition at line 68 of file Math.h.


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