Open CASCADE Technology  7.2.0
Public Member Functions | Static Public Member Functions | Friends

NCollection_Vec4< Element_t > Class Template Reference

Generic 4-components vector. To be used as RGBA color vector or XYZW 3D-point with special W-component for operations with projection / model view matrices. Use this class for 3D-points carefully because declared W-component may results in incorrect results if used without matrices. More...

#include <NCollection_Vec4.hxx>

Public Member Functions

 NCollection_Vec4 ()
 Empty constructor. Construct the zero vector. More...
 
 NCollection_Vec4 (const Element_t theValue)
 Initialize ALL components of vector within specified value. More...
 
 NCollection_Vec4 (const Element_t theX, const Element_t theY, const Element_t theZ, const Element_t theW)
 Per-component constructor. More...
 
 NCollection_Vec4 (const NCollection_Vec2< Element_t > &theVec2)
 Constructor from 2-components vector. More...
 
 NCollection_Vec4 (const NCollection_Vec3< Element_t > &theVec3)
 Constructor from 3-components vector. More...
 
 NCollection_Vec4 (const NCollection_Vec3< Element_t > &theVec3, const Element_t theAlpha)
 Constructor from 3-components vector + alpha value. More...
 
void SetValues (const Element_t theX, const Element_t theY, const Element_t theZ, const Element_t theW)
 Assign new values to the vector. More...
 
Element_t x () const
 Alias to 1st component as X coordinate in XYZW. More...
 
Element_t r () const
 Alias to 1st component as RED channel in RGBA. More...
 
Element_t y () const
 Alias to 2nd component as Y coordinate in XYZW. More...
 
Element_t g () const
 Alias to 2nd component as GREEN channel in RGBA. More...
 
Element_t z () const
 Alias to 3rd component as Z coordinate in XYZW. More...
 
Element_t b () const
 Alias to 3rd component as BLUE channel in RGBA. More...
 
Element_t w () const
 Alias to 4th component as W coordinate in XYZW. More...
 
Element_t a () const
 Alias to 4th component as ALPHA channel in RGBA. More...
 
Element_t & x ()
 Alias to 1st component as X coordinate in XYZW. More...
 
Element_t & r ()
 Alias to 1st component as RED channel in RGBA. More...
 
Element_t & y ()
 Alias to 2nd component as Y coordinate in XYZW. More...
 
Element_t & g ()
 Alias to 2nd component as GREEN channel in RGBA. More...
 
Element_t & z ()
 Alias to 3rd component as Z coordinate in XYZW. More...
 
Element_t & b ()
 Alias to 3rd component as BLUE channel in RGBA. More...
 
Element_t & w ()
 Alias to 4th component as W coordinate in XYZW. More...
 
Element_t & a ()
 Alias to 4th component as ALPHA channel in RGBA. More...
 
NCollection_Vec2< Element_t > & xy ()
 
NCollection_Vec2< Element_t > & yz ()
 
NCollection_Vec2< Element_t > & zw ()
 
NCollection_Vec3< Element_t > & xyz ()
 
NCollection_Vec3< Element_t > & yzw ()
 
bool IsEqual (const NCollection_Vec4 &theOther) const
 Check this vector with another vector for equality (without tolerance!). More...
 
bool operator== (const NCollection_Vec4 &theOther)
 Check this vector with another vector for equality (without tolerance!). More...
 
bool operator== (const NCollection_Vec4 &theOther) const
 
bool operator!= (const NCollection_Vec4 &theOther)
 Check this vector with another vector for non-equality (without tolerance!). More...
 
bool operator!= (const NCollection_Vec4 &theOther) const
 
const Element_t * GetData () const
 Raw access to the data (for OpenGL exchange). More...
 
Element_t * ChangeData ()
 
 operator const Element_t * () const
 
 operator Element_t * ()
 
NCollection_Vec4operator+= (const NCollection_Vec4 &theAdd)
 Compute per-component summary. More...
 
NCollection_Vec4 operator- () const
 Unary -. More...
 
NCollection_Vec4operator-= (const NCollection_Vec4 &theDec)
 Compute per-component subtraction. More...
 
NCollection_Vec4operator*= (const NCollection_Vec4 &theRight)
 Compute per-component multiplication. More...
 
void Multiply (const Element_t theFactor)
 Compute per-component multiplication. More...
 
NCollection_Vec4operator*= (const Element_t theFactor)
 Compute per-component multiplication. More...
 
NCollection_Vec4 operator* (const Element_t theFactor) const
 Compute per-component multiplication. More...
 
NCollection_Vec4 Multiplied (const Element_t theFactor) const
 Compute per-component multiplication. More...
 
NCollection_Vec4 cwiseMin (const NCollection_Vec4 &theVec) const
 Compute component-wise minimum of two vectors. More...
 
NCollection_Vec4 cwiseMax (const NCollection_Vec4 &theVec) const
 Compute component-wise maximum of two vectors. More...
 
NCollection_Vec4 cwiseAbs () const
 Compute component-wise modulus of the vector. More...
 
Element_t maxComp () const
 Compute maximum component of the vector. More...
 
Element_t minComp () const
 Compute minimum component of the vector. More...
 
Element_t Dot (const NCollection_Vec4 &theOther) const
 Computes the dot product. More...
 
NCollection_Vec4operator/= (const Element_t theInvFactor)
 Compute per-component division by scale factor. More...
 
NCollection_Vec4 operator/ (const Element_t theInvFactor)
 Compute per-component division by scale factor. More...
 
template<>
NCollection_Vec4< float > & operator/= (const float theInvFactor)
 Optimized concretization for float type. More...
 
template<>
NCollection_Vec4< double > & operator/= (const double theInvFactor)
 Optimized concretization for double type. More...
 

Static Public Member Functions

static int Length ()
 Returns the number of components. More...
 

Friends

NCollection_Vec4 operator+ (const NCollection_Vec4 &theLeft, const NCollection_Vec4 &theRight)
 Compute per-component summary. More...
 
NCollection_Vec4 operator- (const NCollection_Vec4 &theLeft, const NCollection_Vec4 &theRight)
 Compute per-component subtraction. More...
 
NCollection_Vec4 operator* (const NCollection_Vec4 &theLeft, const NCollection_Vec4 &theRight)
 Compute per-component multiplication. More...
 

Detailed Description

template<typename Element_t>
class NCollection_Vec4< Element_t >

Generic 4-components vector. To be used as RGBA color vector or XYZW 3D-point with special W-component for operations with projection / model view matrices. Use this class for 3D-points carefully because declared W-component may results in incorrect results if used without matrices.

Constructor & Destructor Documentation

◆ NCollection_Vec4() [1/6]

template<typename Element_t>
NCollection_Vec4< Element_t >::NCollection_Vec4 ( )
inline

Empty constructor. Construct the zero vector.

◆ NCollection_Vec4() [2/6]

template<typename Element_t>
NCollection_Vec4< Element_t >::NCollection_Vec4 ( const Element_t  theValue)
inlineexplicit

Initialize ALL components of vector within specified value.

◆ NCollection_Vec4() [3/6]

template<typename Element_t>
NCollection_Vec4< Element_t >::NCollection_Vec4 ( const Element_t  theX,
const Element_t  theY,
const Element_t  theZ,
const Element_t  theW 
)
inlineexplicit

Per-component constructor.

◆ NCollection_Vec4() [4/6]

template<typename Element_t>
NCollection_Vec4< Element_t >::NCollection_Vec4 ( const NCollection_Vec2< Element_t > &  theVec2)
inlineexplicit

Constructor from 2-components vector.

◆ NCollection_Vec4() [5/6]

template<typename Element_t>
NCollection_Vec4< Element_t >::NCollection_Vec4 ( const NCollection_Vec3< Element_t > &  theVec3)
inlineexplicit

Constructor from 3-components vector.

◆ NCollection_Vec4() [6/6]

template<typename Element_t>
NCollection_Vec4< Element_t >::NCollection_Vec4 ( const NCollection_Vec3< Element_t > &  theVec3,
const Element_t  theAlpha 
)
inlineexplicit

Constructor from 3-components vector + alpha value.

Member Function Documentation

◆ a() [1/2]

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::a ( ) const
inline

Alias to 4th component as ALPHA channel in RGBA.

◆ a() [2/2]

template<typename Element_t>
Element_t& NCollection_Vec4< Element_t >::a ( )
inline

Alias to 4th component as ALPHA channel in RGBA.

◆ b() [1/2]

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::b ( ) const
inline

Alias to 3rd component as BLUE channel in RGBA.

◆ b() [2/2]

template<typename Element_t>
Element_t& NCollection_Vec4< Element_t >::b ( )
inline

Alias to 3rd component as BLUE channel in RGBA.

◆ ChangeData()

template<typename Element_t>
Element_t* NCollection_Vec4< Element_t >::ChangeData ( )
inline

◆ cwiseAbs()

template<typename Element_t>
NCollection_Vec4 NCollection_Vec4< Element_t >::cwiseAbs ( ) const
inline

Compute component-wise modulus of the vector.

◆ cwiseMax()

template<typename Element_t>
NCollection_Vec4 NCollection_Vec4< Element_t >::cwiseMax ( const NCollection_Vec4< Element_t > &  theVec) const
inline

Compute component-wise maximum of two vectors.

◆ cwiseMin()

template<typename Element_t>
NCollection_Vec4 NCollection_Vec4< Element_t >::cwiseMin ( const NCollection_Vec4< Element_t > &  theVec) const
inline

Compute component-wise minimum of two vectors.

◆ Dot()

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::Dot ( const NCollection_Vec4< Element_t > &  theOther) const
inline

Computes the dot product.

◆ g() [1/2]

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::g ( ) const
inline

Alias to 2nd component as GREEN channel in RGBA.

◆ g() [2/2]

template<typename Element_t>
Element_t& NCollection_Vec4< Element_t >::g ( )
inline

Alias to 2nd component as GREEN channel in RGBA.

◆ GetData()

template<typename Element_t>
const Element_t* NCollection_Vec4< Element_t >::GetData ( ) const
inline

Raw access to the data (for OpenGL exchange).

◆ IsEqual()

template<typename Element_t>
bool NCollection_Vec4< Element_t >::IsEqual ( const NCollection_Vec4< Element_t > &  theOther) const
inline

Check this vector with another vector for equality (without tolerance!).

◆ Length()

template<typename Element_t>
static int NCollection_Vec4< Element_t >::Length ( void  )
inlinestatic

Returns the number of components.

◆ maxComp()

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::maxComp ( ) const
inline

Compute maximum component of the vector.

◆ minComp()

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::minComp ( ) const
inline

Compute minimum component of the vector.

◆ Multiplied()

template<typename Element_t>
NCollection_Vec4 NCollection_Vec4< Element_t >::Multiplied ( const Element_t  theFactor) const
inline

Compute per-component multiplication.

◆ Multiply()

template<typename Element_t>
void NCollection_Vec4< Element_t >::Multiply ( const Element_t  theFactor)
inline

Compute per-component multiplication.

◆ operator const Element_t *()

template<typename Element_t>
NCollection_Vec4< Element_t >::operator const Element_t * ( ) const
inline

◆ operator Element_t *()

template<typename Element_t>
NCollection_Vec4< Element_t >::operator Element_t * ( )
inline

◆ operator!=() [1/2]

template<typename Element_t>
bool NCollection_Vec4< Element_t >::operator!= ( const NCollection_Vec4< Element_t > &  theOther)
inline

Check this vector with another vector for non-equality (without tolerance!).

◆ operator!=() [2/2]

template<typename Element_t>
bool NCollection_Vec4< Element_t >::operator!= ( const NCollection_Vec4< Element_t > &  theOther) const
inline

◆ operator*()

template<typename Element_t>
NCollection_Vec4 NCollection_Vec4< Element_t >::operator* ( const Element_t  theFactor) const
inline

Compute per-component multiplication.

◆ operator*=() [1/2]

template<typename Element_t>
NCollection_Vec4& NCollection_Vec4< Element_t >::operator*= ( const NCollection_Vec4< Element_t > &  theRight)
inline

Compute per-component multiplication.

◆ operator*=() [2/2]

template<typename Element_t>
NCollection_Vec4& NCollection_Vec4< Element_t >::operator*= ( const Element_t  theFactor)
inline

Compute per-component multiplication.

◆ operator+=()

template<typename Element_t>
NCollection_Vec4& NCollection_Vec4< Element_t >::operator+= ( const NCollection_Vec4< Element_t > &  theAdd)
inline

Compute per-component summary.

◆ operator-()

template<typename Element_t>
NCollection_Vec4 NCollection_Vec4< Element_t >::operator- ( ) const
inline

Unary -.

◆ operator-=()

template<typename Element_t>
NCollection_Vec4& NCollection_Vec4< Element_t >::operator-= ( const NCollection_Vec4< Element_t > &  theDec)
inline

Compute per-component subtraction.

◆ operator/()

template<typename Element_t>
NCollection_Vec4 NCollection_Vec4< Element_t >::operator/ ( const Element_t  theInvFactor)
inline

Compute per-component division by scale factor.

◆ operator/=() [1/3]

template<typename Element_t>
NCollection_Vec4& NCollection_Vec4< Element_t >::operator/= ( const Element_t  theInvFactor)
inline

Compute per-component division by scale factor.

◆ operator/=() [2/3]

template<>
NCollection_Vec4< float > & NCollection_Vec4< float >::operator/= ( const float  theInvFactor)
inline

Optimized concretization for float type.

◆ operator/=() [3/3]

template<>
NCollection_Vec4< double > & NCollection_Vec4< double >::operator/= ( const double  theInvFactor)
inline

Optimized concretization for double type.

◆ operator==() [1/2]

template<typename Element_t>
bool NCollection_Vec4< Element_t >::operator== ( const NCollection_Vec4< Element_t > &  theOther)
inline

Check this vector with another vector for equality (without tolerance!).

◆ operator==() [2/2]

template<typename Element_t>
bool NCollection_Vec4< Element_t >::operator== ( const NCollection_Vec4< Element_t > &  theOther) const
inline

◆ r() [1/2]

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::r ( ) const
inline

Alias to 1st component as RED channel in RGBA.

◆ r() [2/2]

template<typename Element_t>
Element_t& NCollection_Vec4< Element_t >::r ( )
inline

Alias to 1st component as RED channel in RGBA.

◆ SetValues()

template<typename Element_t>
void NCollection_Vec4< Element_t >::SetValues ( const Element_t  theX,
const Element_t  theY,
const Element_t  theZ,
const Element_t  theW 
)
inline

Assign new values to the vector.

◆ w() [1/2]

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::w ( ) const
inline

Alias to 4th component as W coordinate in XYZW.

◆ w() [2/2]

template<typename Element_t>
Element_t& NCollection_Vec4< Element_t >::w ( )
inline

Alias to 4th component as W coordinate in XYZW.

◆ x() [1/2]

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::x ( ) const
inline

Alias to 1st component as X coordinate in XYZW.

◆ x() [2/2]

template<typename Element_t>
Element_t& NCollection_Vec4< Element_t >::x ( )
inline

Alias to 1st component as X coordinate in XYZW.

Returns
2 of XYZW components in specified order as vector in GLSL-style
3 of XYZW components in specified order as vector in GLSL-style
RGB components as vector

◆ xy()

template<typename Element_t>
NCollection_Vec2<Element_t>& NCollection_Vec4< Element_t >::xy ( )
inline
Returns
XY-components modifiable vector

◆ xyz()

template<typename Element_t>
NCollection_Vec3<Element_t>& NCollection_Vec4< Element_t >::xyz ( )
inline
Returns
XYZ-components modifiable vector

◆ y() [1/2]

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::y ( ) const
inline

Alias to 2nd component as Y coordinate in XYZW.

◆ y() [2/2]

template<typename Element_t>
Element_t& NCollection_Vec4< Element_t >::y ( )
inline

Alias to 2nd component as Y coordinate in XYZW.

◆ yz()

template<typename Element_t>
NCollection_Vec2<Element_t>& NCollection_Vec4< Element_t >::yz ( )
inline
Returns
YZ-components modifiable vector

◆ yzw()

template<typename Element_t>
NCollection_Vec3<Element_t>& NCollection_Vec4< Element_t >::yzw ( )
inline
Returns
YZW-components modifiable vector

◆ z() [1/2]

template<typename Element_t>
Element_t NCollection_Vec4< Element_t >::z ( ) const
inline

Alias to 3rd component as Z coordinate in XYZW.

◆ z() [2/2]

template<typename Element_t>
Element_t& NCollection_Vec4< Element_t >::z ( )
inline

Alias to 3rd component as Z coordinate in XYZW.

◆ zw()

template<typename Element_t>
NCollection_Vec2<Element_t>& NCollection_Vec4< Element_t >::zw ( )
inline
Returns
YZ-components modifiable vector

Friends And Related Function Documentation

◆ operator*

template<typename Element_t>
NCollection_Vec4 operator* ( const NCollection_Vec4< Element_t > &  theLeft,
const NCollection_Vec4< Element_t > &  theRight 
)
friend

Compute per-component multiplication.

◆ operator+

template<typename Element_t>
NCollection_Vec4 operator+ ( const NCollection_Vec4< Element_t > &  theLeft,
const NCollection_Vec4< Element_t > &  theRight 
)
friend

Compute per-component summary.

◆ operator-

template<typename Element_t>
NCollection_Vec4 operator- ( const NCollection_Vec4< Element_t > &  theLeft,
const NCollection_Vec4< Element_t > &  theRight 
)
friend

Compute per-component subtraction.


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