Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
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

constexpr NCollection_Vec4 () noexcept
 Empty constructor. Construct the zero vector.
 
constexpr NCollection_Vec4 (const Element_t theValue) noexcept
 Initialize ALL components of vector within specified value.
 
constexpr NCollection_Vec4 (const Element_t theX, const Element_t theY, const Element_t theZ, const Element_t theW) noexcept
 Per-component constructor.
 
constexpr NCollection_Vec4 (const NCollection_Vec2< Element_t > &theVec2) noexcept
 Constructor from 2-components vector.
 
 NCollection_Vec4 (const NCollection_Vec3< Element_t > &theVec3, const Element_t theW=Element_t(0))
 Constructor from 3-components vector + optional 4th value.
 
template<typename OtherElement_t >
constexpr NCollection_Vec4 (const NCollection_Vec4< OtherElement_t > &theOtherVec4) noexcept
 Conversion constructor (explicitly converts some 4-component vector with other element type to a new 4-component vector with the element type Element_t, whose elements are static_cast'ed corresponding elements of theOtherVec4 vector)
 
constexpr void SetValues (const Element_t theX, const Element_t theY, const Element_t theZ, const Element_t theW) noexcept
 Assign new values to the vector.
 
constexpr void SetValues (const NCollection_Vec3< Element_t > &theVec3, const Element_t theW) noexcept
 Assign new values as 3-component vector and a 4-th value.
 
constexpr Element_t x () const noexcept
 Alias to 1st component as X coordinate in XYZW.
 
constexpr Element_t r () const noexcept
 Alias to 1st component as RED channel in RGBA.
 
constexpr Element_t y () const noexcept
 Alias to 2nd component as Y coordinate in XYZW.
 
constexpr Element_t g () const noexcept
 Alias to 2nd component as GREEN channel in RGBA.
 
constexpr Element_t z () const noexcept
 Alias to 3rd component as Z coordinate in XYZW.
 
constexpr Element_t b () const noexcept
 Alias to 3rd component as BLUE channel in RGBA.
 
constexpr Element_t w () const noexcept
 Alias to 4th component as W coordinate in XYZW.
 
constexpr Element_t a () const noexcept
 Alias to 4th component as ALPHA channel in RGBA.
 
constexpr Element_tx () noexcept
 Alias to 1st component as X coordinate in XYZW.
 
constexpr Element_tr () noexcept
 Alias to 1st component as RED channel in RGBA.
 
constexpr Element_ty () noexcept
 Alias to 2nd component as Y coordinate in XYZW.
 
constexpr Element_tg () noexcept
 Alias to 2nd component as GREEN channel in RGBA.
 
constexpr Element_tz () noexcept
 Alias to 3rd component as Z coordinate in XYZW.
 
constexpr Element_tb () noexcept
 Alias to 3rd component as BLUE channel in RGBA.
 
constexpr Element_tw () noexcept
 Alias to 4th component as W coordinate in XYZW.
 
constexpr Element_ta () noexcept
 Alias to 4th component as ALPHA channel in RGBA.
 
constexpr bool IsEqual (const NCollection_Vec4 &theOther) const noexcept
 Check this vector with another vector for equality (without tolerance!).
 
constexpr bool operator== (const NCollection_Vec4 &theOther) const noexcept
 Check this vector with another vector for equality (without tolerance!).
 
constexpr bool operator!= (const NCollection_Vec4 &theOther) const noexcept
 Check this vector with another vector for non-equality (without tolerance!).
 
constexpr const Element_tGetData () const noexcept
 Raw access to the data (for OpenGL exchange).
 
constexpr Element_tChangeData () noexcept
 
constexpr operator const Element_t * () const noexcept
 
constexpr operator Element_t * () noexcept
 
constexpr NCollection_Vec4operator+= (const NCollection_Vec4 &theAdd) noexcept
 Compute per-component summary.
 
constexpr NCollection_Vec4 operator- () const noexcept
 Unary -.
 
constexpr NCollection_Vec4operator-= (const NCollection_Vec4 &theDec) noexcept
 Compute per-component subtraction.
 
constexpr NCollection_Vec4operator*= (const NCollection_Vec4 &theRight) noexcept
 Compute per-component multiplication.
 
constexpr void Multiply (const Element_t theFactor) noexcept
 Compute per-component multiplication.
 
constexpr NCollection_Vec4operator*= (const Element_t theFactor) noexcept
 Compute per-component multiplication.
 
constexpr NCollection_Vec4 operator* (const Element_t theFactor) const noexcept
 Compute per-component multiplication.
 
constexpr NCollection_Vec4 Multiplied (const Element_t theFactor) const noexcept
 Compute per-component multiplication.
 
constexpr NCollection_Vec4 cwiseMin (const NCollection_Vec4 &theVec) const noexcept
 Compute component-wise minimum of two vectors.
 
constexpr NCollection_Vec4 cwiseMax (const NCollection_Vec4 &theVec) const noexcept
 Compute component-wise maximum of two vectors.
 
NCollection_Vec4 cwiseAbs () const noexcept
 Compute component-wise modulus of the vector.
 
constexpr Element_t maxComp () const noexcept
 Compute maximum component of the vector.
 
constexpr Element_t minComp () const noexcept
 Compute minimum component of the vector.
 
constexpr Element_t Dot (const NCollection_Vec4 &theOther) const noexcept
 Computes the dot product.
 
constexpr NCollection_Vec4operator/= (const Element_t theInvFactor)
 Compute per-component division by scale factor.
 
constexpr NCollection_Vec4operator/= (const NCollection_Vec4 &theRight)
 Compute per-component division.
 
constexpr NCollection_Vec4 operator/ (const Element_t theInvFactor) const
 Compute per-component division by scale factor.
 
void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
 Dumps the content of me into the stream.
 

Static Public Member Functions

static constexpr int Length () noexcept
 Returns the number of components.
 

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 >
constexpr NCollection_Vec4< Element_t >::NCollection_Vec4 ( )
inlineconstexprnoexcept

Empty constructor. Construct the zero vector.

◆ NCollection_Vec4() [2/6]

template<typename Element_t >
constexpr NCollection_Vec4< Element_t >::NCollection_Vec4 ( const Element_t theValue)
inlineexplicitconstexprnoexcept

Initialize ALL components of vector within specified value.

◆ NCollection_Vec4() [3/6]

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

Per-component constructor.

◆ NCollection_Vec4() [4/6]

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

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,
const Element_t theW = Element_t(0) )
inlineexplicit

Constructor from 3-components vector + optional 4th value.

◆ NCollection_Vec4() [6/6]

template<typename Element_t >
constexpr NCollection_Vec4< Element_t >::NCollection_Vec4 ( const NCollection_Vec4< OtherElement_t > & theOtherVec4)
inlineexplicitconstexprnoexcept

Conversion constructor (explicitly converts some 4-component vector with other element type to a new 4-component vector with the element type Element_t, whose elements are static_cast'ed corresponding elements of theOtherVec4 vector)

Template Parameters
OtherElement_tthe element type of the other 4-component vector theOtherVec4
Parameters
theOtherVec4the 4-component vector that needs to be converted

Member Function Documentation

◆ a() [1/2]

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::a ( ) const
inlineconstexprnoexcept

Alias to 4th component as ALPHA channel in RGBA.

◆ a() [2/2]

template<typename Element_t >
constexpr Element_t & NCollection_Vec4< Element_t >::a ( )
inlineconstexprnoexcept

Alias to 4th component as ALPHA channel in RGBA.

◆ b() [1/2]

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::b ( ) const
inlineconstexprnoexcept

Alias to 3rd component as BLUE channel in RGBA.

◆ b() [2/2]

template<typename Element_t >
constexpr Element_t & NCollection_Vec4< Element_t >::b ( )
inlineconstexprnoexcept

Alias to 3rd component as BLUE channel in RGBA.

◆ ChangeData()

template<typename Element_t >
constexpr Element_t * NCollection_Vec4< Element_t >::ChangeData ( )
inlineconstexprnoexcept

◆ cwiseAbs()

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

Compute component-wise modulus of the vector.

◆ cwiseMax()

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

Compute component-wise maximum of two vectors.

◆ cwiseMin()

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

Compute component-wise minimum of two vectors.

◆ Dot()

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

Computes the dot product.

◆ DumpJson()

template<typename Element_t >
void NCollection_Vec4< Element_t >::DumpJson ( Standard_OStream & theOStream,
int theDepth = -1 ) const
inline

Dumps the content of me into the stream.

◆ g() [1/2]

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::g ( ) const
inlineconstexprnoexcept

Alias to 2nd component as GREEN channel in RGBA.

◆ g() [2/2]

template<typename Element_t >
constexpr Element_t & NCollection_Vec4< Element_t >::g ( )
inlineconstexprnoexcept

Alias to 2nd component as GREEN channel in RGBA.

◆ GetData()

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

Raw access to the data (for OpenGL exchange).

◆ IsEqual()

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

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

◆ Length()

template<typename Element_t >
static constexpr int NCollection_Vec4< Element_t >::Length ( )
inlinestaticconstexprnoexcept

Returns the number of components.

◆ maxComp()

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::maxComp ( ) const
inlineconstexprnoexcept

Compute maximum component of the vector.

◆ minComp()

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::minComp ( ) const
inlineconstexprnoexcept

Compute minimum component of the vector.

◆ Multiplied()

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

Compute per-component multiplication.

◆ Multiply()

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

Compute per-component multiplication.

◆ operator const Element_t *()

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

◆ operator Element_t *()

template<typename Element_t >
constexpr NCollection_Vec4< Element_t >::operator Element_t * ( )
inlineconstexprnoexcept

◆ operator!=()

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

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

◆ operator*()

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

Compute per-component multiplication.

◆ operator*=() [1/2]

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

Compute per-component multiplication.

◆ operator*=() [2/2]

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

Compute per-component multiplication.

◆ operator+=()

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

Compute per-component summary.

◆ operator-()

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

Unary -.

◆ operator-=()

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

Compute per-component subtraction.

◆ operator/()

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

Compute per-component division by scale factor.

◆ operator/=() [1/2]

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

Compute per-component division by scale factor.

◆ operator/=() [2/2]

Compute per-component division.

◆ operator==()

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

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

◆ r() [1/2]

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::r ( ) const
inlineconstexprnoexcept

Alias to 1st component as RED channel in RGBA.

◆ r() [2/2]

template<typename Element_t >
constexpr Element_t & NCollection_Vec4< Element_t >::r ( )
inlineconstexprnoexcept

Alias to 1st component as RED channel in RGBA.

◆ SetValues() [1/2]

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

Assign new values to the vector.

◆ SetValues() [2/2]

template<typename Element_t >
constexpr void NCollection_Vec4< Element_t >::SetValues ( const NCollection_Vec3< Element_t > & theVec3,
const Element_t theW )
inlineconstexprnoexcept

Assign new values as 3-component vector and a 4-th value.

◆ w() [1/2]

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::w ( ) const
inlineconstexprnoexcept

Alias to 4th component as W coordinate in XYZW.

◆ w() [2/2]

template<typename Element_t >
constexpr Element_t & NCollection_Vec4< Element_t >::w ( )
inlineconstexprnoexcept

Alias to 4th component as W coordinate in XYZW.

◆ x() [1/2]

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::x ( ) const
inlineconstexprnoexcept

Alias to 1st component as X coordinate in XYZW.

◆ x() [2/2]

template<typename Element_t >
constexpr Element_t & NCollection_Vec4< Element_t >::x ( )
inlineconstexprnoexcept

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

◆ y() [1/2]

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::y ( ) const
inlineconstexprnoexcept

Alias to 2nd component as Y coordinate in XYZW.

◆ y() [2/2]

template<typename Element_t >
constexpr Element_t & NCollection_Vec4< Element_t >::y ( )
inlineconstexprnoexcept

Alias to 2nd component as Y coordinate in XYZW.

◆ z() [1/2]

template<typename Element_t >
constexpr Element_t NCollection_Vec4< Element_t >::z ( ) const
inlineconstexprnoexcept

Alias to 3rd component as Z coordinate in XYZW.

◆ z() [2/2]

template<typename Element_t >
constexpr Element_t & NCollection_Vec4< Element_t >::z ( )
inlineconstexprnoexcept

Alias to 3rd component as Z coordinate in XYZW.


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