open_iA 2024.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
iAVec3T< T > Class Template Reference

Class representing a 3-dimensional vector. More...

#include <iAVec3.h>

Public Member Functions

 iAVec3T ()
 initialize empty vector (all components =0)
 
template<typename ParamType >
 iAVec3T (const iAVec3T< ParamType > &v)
 initialize vector components from another vector
 
 iAVec3T (T const data[3])
 initialize vector components from an array
 
 iAVec3T (T px, T py, T pz)
 initialize vector from three values (of potentially different type)
 
 iAVec3T (T val)
 initialize all vector components to the same value
 
T * data ()
 access to the raw array of size 3 holding the components
 
T const * data () const
 access to the raw array of size 3 holding the components (const version)
 
template<typename ParamType >
iAVec3T< T > & fill (ParamType d)
 assign a single value to all components
 
length () const
 get the length of the vector, alias for magnitude()
 
magnitude () const
 get the length of the vector
 
void normalize ()
 make this vector normalized, i.e. set the length to 1 but keep direction
 
iAVec3T< T > normalized () const
 get a normalize vector, i.e., a vector of length=1 pointing in the same direction
 
template<typename ParamType >
iAVec3T< T > & operator*= (const iAVec3T< ParamType > &v)
 multiply another vector with this
 
template<typename ParamType >
iAVec3T< T > & operator*= (ParamType f)
 multiply a constant to every component of this
 
iAVec3T< T > operator+ () const
 unary + operator. Note: this is not handling the addition of two vectors! It just allows to write " +someVectorVariable" as an expression, it returns the vector itself
 
template<typename ParamType >
iAVec3T< T > & operator+= (const iAVec3T< ParamType > &v)
 add another vector to this
 
iAVec3T< T > operator- () const
 unary - operator. Writing "-someVectorVariable" returns a vector with all components of someVectorVariable multiplied by -1
 
template<typename ParamType >
iAVec3T< T > & operator-= (const iAVec3T< ParamType > &v)
 subtract another vector from this
 
template<typename ParamType >
iAVec3T< T > & operator/= (const iAVec3T< ParamType > &v)
 divide all components of this vector by the respective components of another vector
 
template<typename ParamType >
iAVec3T< T > & operator= (const iAVec3T< ParamType > &v)
 assign another vector
 
T & operator[] (size_t index)
 indexed read&write access to the components of this vector; index=0 -> x, index=1 -> y index=2 -> z
 
const T & operator[] (size_t index) const
 constant indexed access to the components of this vector; index=0 -> x, index=1 -> y index=2 -> z
 
sqrMagnitude () const
 get the squared length of the vector
 
sum () const
 get the sum of all vector components
 
QString toString () const
 
x () const
 access the x component of the vector
 
y () const
 access the y component of the vector
 
z () const
 access the z component of the vector
 

Detailed Description

template<typename T>
class iAVec3T< T >

Class representing a 3-dimensional vector.

Constructor & Destructor Documentation

◆ iAVec3T() [1/5]

template<typename T >
iAVec3T< T >::iAVec3T ( )

initialize empty vector (all components =0)

◆ iAVec3T() [2/5]

template<typename T >
iAVec3T< T >::iAVec3T ( T val)
explicit

initialize all vector components to the same value

◆ iAVec3T() [3/5]

template<typename T >
iAVec3T< T >::iAVec3T ( T px,
T py,
T pz )
explicit

initialize vector from three values (of potentially different type)

◆ iAVec3T() [4/5]

template<typename T >
iAVec3T< T >::iAVec3T ( T const data[3])
explicit

initialize vector components from an array

◆ iAVec3T() [5/5]

template<typename T >
template<typename ParamType >
iAVec3T< T >::iAVec3T ( const iAVec3T< ParamType > & v)

initialize vector components from another vector

Member Function Documentation

◆ data() [1/2]

template<typename T >
T * iAVec3T< T >::data ( )

access to the raw array of size 3 holding the components

◆ data() [2/2]

template<typename T >
T const * iAVec3T< T >::data ( ) const

access to the raw array of size 3 holding the components (const version)

◆ fill()

template<typename T >
template<typename ParamType >
iAVec3T< T > & iAVec3T< T >::fill ( ParamType d)

assign a single value to all components

◆ length()

template<typename T >
T iAVec3T< T >::length ( ) const

get the length of the vector, alias for magnitude()

◆ magnitude()

template<typename T >
T iAVec3T< T >::magnitude ( ) const

get the length of the vector

◆ normalize()

template<typename T >
void iAVec3T< T >::normalize ( )

make this vector normalized, i.e. set the length to 1 but keep direction

◆ normalized()

template<typename T >
iAVec3T< T > iAVec3T< T >::normalized ( ) const

get a normalize vector, i.e., a vector of length=1 pointing in the same direction

◆ operator*=() [1/2]

template<typename T >
template<typename ParamType >
iAVec3T< T > & iAVec3T< T >::operator*= ( const iAVec3T< ParamType > & v)

multiply another vector with this

◆ operator*=() [2/2]

template<typename T >
template<typename ParamType >
iAVec3T< T > & iAVec3T< T >::operator*= ( ParamType f)

multiply a constant to every component of this

◆ operator+()

template<typename T >
iAVec3T< T > iAVec3T< T >::operator+ ( ) const

unary + operator. Note: this is not handling the addition of two vectors! It just allows to write " +someVectorVariable" as an expression, it returns the vector itself

◆ operator+=()

template<typename T >
template<typename ParamType >
iAVec3T< T > & iAVec3T< T >::operator+= ( const iAVec3T< ParamType > & v)

add another vector to this

◆ operator-()

template<typename T >
iAVec3T< T > iAVec3T< T >::operator- ( ) const

unary - operator. Writing "-someVectorVariable" returns a vector with all components of someVectorVariable multiplied by -1

◆ operator-=()

template<typename T >
template<typename ParamType >
iAVec3T< T > & iAVec3T< T >::operator-= ( const iAVec3T< ParamType > & v)

subtract another vector from this

◆ operator/=()

template<typename T >
template<typename ParamType >
iAVec3T< T > & iAVec3T< T >::operator/= ( const iAVec3T< ParamType > & v)

divide all components of this vector by the respective components of another vector

◆ operator=()

template<typename T >
template<typename ParamType >
iAVec3T< T > & iAVec3T< T >::operator= ( const iAVec3T< ParamType > & v)

assign another vector

◆ operator[]() [1/2]

template<typename T >
T & iAVec3T< T >::operator[] ( size_t index)

indexed read&write access to the components of this vector; index=0 -> x, index=1 -> y index=2 -> z

◆ operator[]() [2/2]

template<typename T >
const T & iAVec3T< T >::operator[] ( size_t index) const

constant indexed access to the components of this vector; index=0 -> x, index=1 -> y index=2 -> z

◆ sqrMagnitude()

template<typename T >
T iAVec3T< T >::sqrMagnitude ( ) const

get the squared length of the vector

◆ sum()

template<typename T >
T iAVec3T< T >::sum ( ) const

get the sum of all vector components

◆ toString()

template<typename T >
QString iAVec3T< T >::toString ( ) const

◆ x()

template<typename T >
T iAVec3T< T >::x ( ) const
inline

access the x component of the vector

◆ y()

template<typename T >
T iAVec3T< T >::y ( ) const
inline

access the y component of the vector

◆ z()

template<typename T >
T iAVec3T< T >::z ( ) const
inline

access the z component of the vector


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