Blender V5.3
blender::VecBase< T, Size > Struct Template Reference

#include <BLI_math_vector_types.hh>

Inherits blender::blender::vec_struct_base< T, Size, std::is_trivial_v< T > >.

Public Types

using base_type = T

Public Member Functions

 BLI_STATIC_ASSERT (alignof(T)<=sizeof(T), "VecBase is not compatible with aligned type for now.")
 VecBase ()=default
VecBase & operator= (const VecBase &) &=default
 VecBase (T value)
template<typename U>
requires (std::is_convertible_v<U, T>)
 VecBase (U value)
constexpr VecBase (T _x)
constexpr VecBase (T _x, T _y)
constexpr VecBase (T _x, T _y, T _z)
constexpr VecBase (T _x, T _y, T _z, T _w)
template<typename U>
requires (Size == 3)
constexpr VecBase (const VecBase< U, 2 > &xy, T z)
template<typename U>
requires (Size == 3)
constexpr VecBase (T x, const VecBase< U, 2 > &yz)
template<typename U>
requires (Size == 4)
 VecBase (VecBase< U, 3 > xyz, T w)
template<typename U>
requires (Size == 4)
 VecBase (T x, VecBase< U, 3 > yzw)
template<typename U, typename V>
requires (Size == 4)
 VecBase (VecBase< U, 2 > xy, VecBase< V, 2 > zw)
template<typename U>
requires (Size == 4)
 VecBase (VecBase< U, 2 > xy, T z, T w)
template<typename U>
requires (Size == 4)
 VecBase (T x, VecBase< U, 2 > yz, T w)
template<typename U>
requires (Size == 4)
 VecBase (T x, T y, VecBase< U, 2 > zw)
template<typename U, int OtherSize>
requires (OtherSize < Size)
 VecBase (const VecBase< U, OtherSize > &other)=delete
template<typename U, int OtherSize>
requires (OtherSize > Size)
 VecBase (const VecBase< U, OtherSize > &other)
 VecBase (const T *ptr)
template<typename U>
requires (std::is_convertible_v<U, T>)
 VecBase (const U *ptr)
 VecBase (const T(*ptr)[Size])
template<typename U>
 VecBase (const VecBase< U, Size > &vec)
 operator const T * () const
 operator T* ()
const T & operator[] (int index) const
T & operator[] (int index)
VecBase & operator+= (const VecBase &b) &
VecBase & operator+= (const T &b) &
VecBase & operator-= (const VecBase &b) &
VecBase & operator-= (const T &b) &
VecBase & operator*= (T b) &
VecBase & operator*= (const VecBase &b) &
VecBase & operator/= (T b) &
VecBase & operator/= (const VecBase &b) &
VecBase & operator&= (T b) &
VecBase & operator&= (const VecBase &b) &
VecBase & operator|= (T b) &
VecBase & operator|= (const VecBase &b) &
VecBase & operator^= (T b) &
VecBase & operator^= (const VecBase &b) &
VecBase & operator<<= (T b) &
VecBase & operator<<= (const VecBase &b) &
VecBase & operator>>= (T b) &
VecBase & operator>>= (const VecBase &b) &
constexpr uint64_t hash () const
void hash_unique (UniqueHashBytes &hash) const

Static Public Attributes

static constexpr int type_length = Size

Friends

VecBase operator+ (const VecBase &a, const VecBase &b)
VecBase operator+ (const VecBase &a, const T &b)
VecBase operator+ (const T &a, const VecBase &b)
VecBase operator- (const VecBase &a)
VecBase operator- (const VecBase &a, const VecBase &b)
VecBase operator- (const VecBase &a, const T &b)
VecBase operator- (const T &a, const VecBase &b)
VecBase operator* (const VecBase &a, const VecBase &b)
template<typename FactorT>
VecBase operator* (const VecBase &a, FactorT b)
VecBase operator* (T a, const VecBase &b)
VecBase operator/ (const VecBase &a, const VecBase &b)
VecBase operator/ (const VecBase &a, T b)
VecBase operator/ (T a, const VecBase &b)
VecBase operator& (const VecBase &a, const VecBase &b)
VecBase operator& (const VecBase &a, T b)
VecBase operator& (T a, const VecBase &b)
VecBase operator| (const VecBase &a, const VecBase &b)
VecBase operator| (const VecBase &a, T b)
VecBase operator| (T a, const VecBase &b)
VecBase operator^ (const VecBase &a, const VecBase &b)
VecBase operator^ (const VecBase &a, T b)
VecBase operator^ (T a, const VecBase &b)
VecBase operator~ (const VecBase &a)
VecBase operator<< (const VecBase &a, const VecBase &b)
VecBase operator<< (const VecBase &a, T b)
VecBase operator>> (const VecBase &a, const VecBase &b)
VecBase operator>> (const VecBase &a, T b)
VecBase operator% (const VecBase &a, const VecBase &b)
VecBase operator% (const VecBase &a, T b)
VecBase operator% (T a, const VecBase &b)
bool operator== (const VecBase &a, const VecBase &b)
bool operator!= (const VecBase &a, const VecBase &b)
std::ostream & operator<< (std::ostream &stream, const VecBase &v)

Additional Inherited Members

Public Attributes inherited from blender::blender::vec_struct_base< T, Size, std::is_trivial_v< T > >
std::array< T, Size > values

Detailed Description

template<typename T, int Size>
struct blender::VecBase< T, Size >

Definition at line 201 of file BLI_math_vector_types.hh.

Member Typedef Documentation

◆ base_type

template<typename T, int Size>
using blender::VecBase< T, Size >::base_type = T

Definition at line 208 of file BLI_math_vector_types.hh.

Constructor & Destructor Documentation

◆ VecBase() [1/21]

◆ VecBase() [2/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( T value)
inlineexplicit

Definition at line 224 of file BLI_math_vector_types.hh.

◆ VecBase() [3/21]

template<typename T, int Size>
template<typename U>
requires (std::is_convertible_v<U, T>)
blender::VecBase< T, Size >::VecBase ( U value)
inlineexplicit

Definition at line 233 of file BLI_math_vector_types.hh.

◆ VecBase() [4/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( T _x)
inlineconstexpr

Definition at line 239 of file BLI_math_vector_types.hh.

◆ VecBase() [5/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( T _x,
T _y )
inlineconstexpr

Definition at line 245 of file BLI_math_vector_types.hh.

◆ VecBase() [6/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( T _x,
T _y,
T _z )
inlineconstexpr

Definition at line 252 of file BLI_math_vector_types.hh.

◆ VecBase() [7/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( T _x,
T _y,
T _z,
T _w )
inlineconstexpr

Definition at line 260 of file BLI_math_vector_types.hh.

◆ VecBase() [8/21]

template<typename T, int Size>
template<typename U>
requires (Size == 3)
blender::VecBase< T, Size >::VecBase ( const VecBase< U, 2 > & xy,
T z )
inlineconstexpr

Mixed scalar-vector constructors.

Definition at line 272 of file BLI_math_vector_types.hh.

◆ VecBase() [9/21]

template<typename T, int Size>
template<typename U>
requires (Size == 3)
blender::VecBase< T, Size >::VecBase ( T x,
const VecBase< U, 2 > & yz )
inlineconstexpr

Definition at line 279 of file BLI_math_vector_types.hh.

◆ VecBase() [10/21]

template<typename T, int Size>
template<typename U>
requires (Size == 4)
blender::VecBase< T, Size >::VecBase ( VecBase< U, 3 > xyz,
T w )
inline

Definition at line 286 of file BLI_math_vector_types.hh.

◆ VecBase() [11/21]

template<typename T, int Size>
template<typename U>
requires (Size == 4)
blender::VecBase< T, Size >::VecBase ( T x,
VecBase< U, 3 > yzw )
inline

Definition at line 293 of file BLI_math_vector_types.hh.

◆ VecBase() [12/21]

template<typename T, int Size>
template<typename U, typename V>
requires (Size == 4)
blender::VecBase< T, Size >::VecBase ( VecBase< U, 2 > xy,
VecBase< V, 2 > zw )
inline

Definition at line 300 of file BLI_math_vector_types.hh.

◆ VecBase() [13/21]

template<typename T, int Size>
template<typename U>
requires (Size == 4)
blender::VecBase< T, Size >::VecBase ( VecBase< U, 2 > xy,
T z,
T w )
inline

Definition at line 307 of file BLI_math_vector_types.hh.

◆ VecBase() [14/21]

template<typename T, int Size>
template<typename U>
requires (Size == 4)
blender::VecBase< T, Size >::VecBase ( T x,
VecBase< U, 2 > yz,
T w )
inline

Definition at line 314 of file BLI_math_vector_types.hh.

◆ VecBase() [15/21]

template<typename T, int Size>
template<typename U>
requires (Size == 4)
blender::VecBase< T, Size >::VecBase ( T x,
T y,
VecBase< U, 2 > zw )
inline

Definition at line 321 of file BLI_math_vector_types.hh.

◆ VecBase() [16/21]

template<typename T, int Size>
template<typename U, int OtherSize>
requires (OtherSize < Size)
blender::VecBase< T, Size >::VecBase ( const VecBase< U, OtherSize > & other)
delete

Prevent up-cast of dimensions (creating a bigger vector initialized with data from a smaller one) by deleting all copy constructors accepting smaller vectors as source.

◆ VecBase() [17/21]

template<typename T, int Size>
template<typename U, int OtherSize>
requires (OtherSize > Size)
blender::VecBase< T, Size >::VecBase ( const VecBase< U, OtherSize > & other)
inlineexplicit

Masking.

Definition at line 340 of file BLI_math_vector_types.hh.

◆ VecBase() [18/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( const T * ptr)
inline

Conversion from pointers (from C-style vectors).

Definition at line 358 of file BLI_math_vector_types.hh.

◆ VecBase() [19/21]

template<typename T, int Size>
template<typename U>
requires (std::is_convertible_v<U, T>)
blender::VecBase< T, Size >::VecBase ( const U * ptr)
inlineexplicit

Definition at line 364 of file BLI_math_vector_types.hh.

◆ VecBase() [20/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( const T(*) ptr[Size])
inline

Definition at line 370 of file BLI_math_vector_types.hh.

◆ VecBase() [21/21]

template<typename T, int Size>
template<typename U>
blender::VecBase< T, Size >::VecBase ( const VecBase< U, Size > & vec)
inlineexplicit

Conversion from other vector types.

Definition at line 378 of file BLI_math_vector_types.hh.

Member Function Documentation

◆ BLI_STATIC_ASSERT()

template<typename T, int Size>
blender::VecBase< T, Size >::BLI_STATIC_ASSERT ( alignof(T)<=sizeof(T) ,
"VecBase< T, Size > is not compatible with aligned type for now."  )

◆ hash()

template<typename T, int Size>
uint64_t blender::VecBase< T, Size >::hash ( ) const
inlineconstexpr

◆ hash_unique()

template<typename T, int Size>
void blender::VecBase< T, Size >::hash_unique ( UniqueHashBytes & hash) const
inline

◆ operator const T *()

template<typename T, int Size>
blender::VecBase< T, Size >::operator const T * ( ) const
inline

C-style pointer dereference.

Definition at line 385 of file BLI_math_vector_types.hh.

◆ operator T*()

template<typename T, int Size>
blender::VecBase< T, Size >::operator T* ( )
inline

Definition at line 390 of file BLI_math_vector_types.hh.

◆ operator&=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator&= ( const VecBase< T, Size > & b) &
inline

Definition at line 555 of file BLI_math_vector_types.hh.

◆ operator&=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator&= ( T b) &
inline

Definition at line 549 of file BLI_math_vector_types.hh.

◆ operator*=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator*= ( const VecBase< T, Size > & b) &
inline

Definition at line 488 of file BLI_math_vector_types.hh.

◆ operator*=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator*= ( T b) &
inline

Definition at line 483 of file BLI_math_vector_types.hh.

◆ operator+=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator+= ( const T & b) &
inline

Definition at line 433 of file BLI_math_vector_types.hh.

◆ operator+=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator+= ( const VecBase< T, Size > & b) &
inline

Definition at line 428 of file BLI_math_vector_types.hh.

◆ operator-=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator-= ( const T & b) &
inline

Definition at line 463 of file BLI_math_vector_types.hh.

◆ operator-=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator-= ( const VecBase< T, Size > & b) &
inline

Definition at line 458 of file BLI_math_vector_types.hh.

◆ operator/=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator/= ( const VecBase< T, Size > & b) &
inline

Definition at line 521 of file BLI_math_vector_types.hh.

◆ operator/=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator/= ( T b) &
inline

Definition at line 515 of file BLI_math_vector_types.hh.

◆ operator<<=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator<<= ( const VecBase< T, Size > & b) &
inline

Definition at line 647 of file BLI_math_vector_types.hh.

◆ operator<<=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator<<= ( T b) &
inline

Definition at line 641 of file BLI_math_vector_types.hh.

◆ operator=()

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator= ( const VecBase< T, Size > & ) &
default

Make assignment on swizzle result an error.

◆ operator>>=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator>>= ( const VecBase< T, Size > & b) &
inline

Definition at line 671 of file BLI_math_vector_types.hh.

◆ operator>>=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator>>= ( T b) &
inline

Definition at line 665 of file BLI_math_vector_types.hh.

◆ operator[]() [1/2]

template<typename T, int Size>
T & blender::VecBase< T, Size >::operator[] ( int index)
inline

Definition at line 404 of file BLI_math_vector_types.hh.

◆ operator[]() [2/2]

template<typename T, int Size>
const T & blender::VecBase< T, Size >::operator[] ( int index) const
inline

Array access.

Definition at line 397 of file BLI_math_vector_types.hh.

◆ operator^=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator^= ( const VecBase< T, Size > & b) &
inline

Definition at line 615 of file BLI_math_vector_types.hh.

◆ operator^=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator^= ( T b) &
inline

Definition at line 609 of file BLI_math_vector_types.hh.

◆ operator|=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator|= ( const VecBase< T, Size > & b) &
inline

Definition at line 585 of file BLI_math_vector_types.hh.

◆ operator|=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator|= ( T b) &
inline

Definition at line 579 of file BLI_math_vector_types.hh.

◆ operator!=

template<typename T, int Size>
bool operator!= ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 716 of file BLI_math_vector_types.hh.

◆ operator% [1/3]

template<typename T, int Size>
VecBase operator% ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Modulo operators.

Definition at line 679 of file BLI_math_vector_types.hh.

◆ operator% [2/3]

template<typename T, int Size>
VecBase operator% ( const VecBase< T, Size > & a,
T b )
friend

Definition at line 688 of file BLI_math_vector_types.hh.

◆ operator% [3/3]

template<typename T, int Size>
VecBase operator% ( T a,
const VecBase< T, Size > & b )
friend

Definition at line 695 of file BLI_math_vector_types.hh.

◆ operator& [1/3]

template<typename T, int Size>
VecBase operator& ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Binary operators.

Definition at line 531 of file BLI_math_vector_types.hh.

◆ operator& [2/3]

template<typename T, int Size>
VecBase operator& ( const VecBase< T, Size > & a,
T b )
friend

Definition at line 537 of file BLI_math_vector_types.hh.

◆ operator& [3/3]

template<typename T, int Size>
VecBase operator& ( T a,
const VecBase< T, Size > & b )
friend

Definition at line 543 of file BLI_math_vector_types.hh.

◆ operator* [1/3]

template<typename T, int Size>
VecBase operator* ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 468 of file BLI_math_vector_types.hh.

◆ operator* [2/3]

template<typename T, int Size>
template<typename FactorT>
VecBase operator* ( const VecBase< T, Size > & a,
FactorT b )
friend

Definition at line 473 of file BLI_math_vector_types.hh.

◆ operator* [3/3]

template<typename T, int Size>
VecBase operator* ( T a,
const VecBase< T, Size > & b )
friend

Definition at line 478 of file BLI_math_vector_types.hh.

◆ operator+ [1/3]

template<typename T, int Size>
VecBase operator+ ( const T & a,
const VecBase< T, Size > & b )
friend

Definition at line 423 of file BLI_math_vector_types.hh.

◆ operator+ [2/3]

template<typename T, int Size>
VecBase operator+ ( const VecBase< T, Size > & a,
const T & b )
friend

Definition at line 418 of file BLI_math_vector_types.hh.

◆ operator+ [3/3]

template<typename T, int Size>
VecBase operator+ ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Arithmetic operators.

Definition at line 413 of file BLI_math_vector_types.hh.

◆ operator- [1/4]

template<typename T, int Size>
VecBase operator- ( const T & a,
const VecBase< T, Size > & b )
friend

Definition at line 453 of file BLI_math_vector_types.hh.

◆ operator- [2/4]

template<typename T, int Size>
VecBase operator- ( const VecBase< T, Size > & a)
friend

Definition at line 438 of file BLI_math_vector_types.hh.

◆ operator- [3/4]

template<typename T, int Size>
VecBase operator- ( const VecBase< T, Size > & a,
const T & b )
friend

Definition at line 448 of file BLI_math_vector_types.hh.

◆ operator- [4/4]

template<typename T, int Size>
VecBase operator- ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 443 of file BLI_math_vector_types.hh.

◆ operator/ [1/3]

template<typename T, int Size>
VecBase operator/ ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 493 of file BLI_math_vector_types.hh.

◆ operator/ [2/3]

template<typename T, int Size>
VecBase operator/ ( const VecBase< T, Size > & a,
T b )
friend

Definition at line 501 of file BLI_math_vector_types.hh.

◆ operator/ [3/3]

template<typename T, int Size>
VecBase operator/ ( T a,
const VecBase< T, Size > & b )
friend

Definition at line 507 of file BLI_math_vector_types.hh.

◆ operator<< [1/3]

template<typename T, int Size>
VecBase operator<< ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Bit-shift operators.

Definition at line 629 of file BLI_math_vector_types.hh.

◆ operator<< [2/3]

template<typename T, int Size>
VecBase operator<< ( const VecBase< T, Size > & a,
T b )
friend

Definition at line 635 of file BLI_math_vector_types.hh.

◆ operator<< [3/3]

template<typename T, int Size>
std::ostream & operator<< ( std::ostream & stream,
const VecBase< T, Size > & v )
friend

Definition at line 736 of file BLI_math_vector_types.hh.

◆ operator==

template<typename T, int Size>
bool operator== ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Compare.

Definition at line 706 of file BLI_math_vector_types.hh.

◆ operator>> [1/2]

template<typename T, int Size>
VecBase operator>> ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 653 of file BLI_math_vector_types.hh.

◆ operator>> [2/2]

template<typename T, int Size>
VecBase operator>> ( const VecBase< T, Size > & a,
T b )
friend

Definition at line 659 of file BLI_math_vector_types.hh.

◆ operator^ [1/3]

template<typename T, int Size>
VecBase operator^ ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 591 of file BLI_math_vector_types.hh.

◆ operator^ [2/3]

template<typename T, int Size>
VecBase operator^ ( const VecBase< T, Size > & a,
T b )
friend

Definition at line 597 of file BLI_math_vector_types.hh.

◆ operator^ [3/3]

template<typename T, int Size>
VecBase operator^ ( T a,
const VecBase< T, Size > & b )
friend

Definition at line 603 of file BLI_math_vector_types.hh.

◆ operator| [1/3]

template<typename T, int Size>
VecBase operator| ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 561 of file BLI_math_vector_types.hh.

◆ operator| [2/3]

template<typename T, int Size>
VecBase operator| ( const VecBase< T, Size > & a,
T b )
friend

Definition at line 567 of file BLI_math_vector_types.hh.

◆ operator| [3/3]

template<typename T, int Size>
VecBase operator| ( T a,
const VecBase< T, Size > & b )
friend

Definition at line 573 of file BLI_math_vector_types.hh.

◆ operator~

template<typename T, int Size>
VecBase operator~ ( const VecBase< T, Size > & a)
friend

Definition at line 621 of file BLI_math_vector_types.hh.

Member Data Documentation

◆ type_length

template<typename T, int Size>
int blender::VecBase< T, Size >::type_length = Size
staticconstexpr

Definition at line 206 of file BLI_math_vector_types.hh.


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