Open CASCADE Technology  6.9.1
Public Member Functions | Static Public Member Functions | Friends
NCollection_Vec3< Element_t > Class Template Reference

Generic 3-components vector. To be used as RGB color pixel or XYZ 3D-point. The main target for this class - to handle raw low-level arrays (from/to graphic driver etc.). More...

#include <NCollection_Vec3.hxx>

Public Member Functions

 NCollection_Vec3 ()
 Empty constructor. Construct the zero vector. More...
 
 NCollection_Vec3 (Element_t theValue)
 Initialize ALL components of vector within specified value. More...
 
 NCollection_Vec3 (const Element_t theX, const Element_t theY, const Element_t theZ)
 Per-component constructor. More...
 
 NCollection_Vec3 (const NCollection_Vec2< Element_t > &theVec2)
 Constructor from 2-components vector. More...
 
 NCollection_Vec3 (const NCollection_Vec3 &theVec3)
 Copy constructor. More...
 
const NCollection_Vec3operator= (const NCollection_Vec3 &theVec3)
 Assignment operator. More...
 
Element_t x () const
 Alias to 1st component as X coordinate in XYZ. More...
 
Element_t r () const
 Alias to 1st component as RED channel in RGB. More...
 
Element_t y () const
 Alias to 2nd component as Y coordinate in XYZ. More...
 
Element_t g () const
 Alias to 2nd component as GREEN channel in RGB. More...
 
Element_t z () const
 Alias to 3rd component as Z coordinate in XYZ. More...
 
Element_t b () const
 Alias to 3rd component as BLUE channel in RGB. More...
 
Element_t & x ()
 Alias to 1st component as X coordinate in XYZ. More...
 
Element_t & r ()
 Alias to 1st component as RED channel in RGB. More...
 
Element_t & y ()
 Alias to 2nd component as Y coordinate in XYZ. More...
 
Element_t & g ()
 Alias to 2nd component as GREEN channel in RGB. More...
 
Element_t & z ()
 Alias to 3rd component as Z coordinate in XYZ. More...
 
Element_t & b ()
 Alias to 3rd component as BLUE channel in RGB. More...
 
NCollection_Vec2< Element_t > & xy ()
 
NCollection_Vec2< Element_t > & yz ()
 
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_Vec3operator+= (const NCollection_Vec3 &theAdd)
 Compute per-component summary. More...
 
NCollection_Vec3 operator- () const
 Unary -. More...
 
NCollection_Vec3operator-= (const NCollection_Vec3 &theDec)
 Compute per-component subtraction. More...
 
void Multiply (const Element_t theFactor)
 Compute per-component multiplication by scale factor. More...
 
NCollection_Vec3operator*= (const NCollection_Vec3 &theRight)
 Compute per-component multiplication. More...
 
NCollection_Vec3operator*= (const Element_t theFactor)
 Compute per-component multiplication by scale factor. More...
 
NCollection_Vec3 operator* (const Element_t theFactor) const
 Compute per-component multiplication by scale factor. More...
 
NCollection_Vec3 Multiplied (const Element_t theFactor) const
 Compute per-component multiplication by scale factor. More...
 
NCollection_Vec3 cwiseMin (const NCollection_Vec3 &theVec) const
 Compute component-wise minimum of two vectors. More...
 
NCollection_Vec3 cwiseMax (const NCollection_Vec3 &theVec) const
 Compute component-wise maximum of two vectors. More...
 
NCollection_Vec3 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...
 
NCollection_Vec3operator/= (const Element_t theInvFactor)
 Compute per-component division by scale factor. More...
 
NCollection_Vec3 operator/ (const Element_t theInvFactor)
 Compute per-component division by scale factor. More...
 
Element_t Dot (const NCollection_Vec3 &theOther) const
 Computes the dot product. More...
 
Element_t Modulus () const
 Computes the vector modulus (magnitude, length). More...
 
Element_t SquareModulus () const
 Computes the square of vector modulus (magnitude, length). This method may be used for performance tricks. More...
 
void Normalize ()
 Normalize the vector. More...
 
NCollection_Vec3 Normalized () const
 Normalize the vector. More...
 
template<>
NCollection_Vec3< float > & operator/= (const float theInvFactor)
 Optimized concretization for float type. More...
 
template<>
NCollection_Vec3< double > & operator/= (const double theInvFactor)
 Optimized concretization for double type. More...
 

Static Public Member Functions

static int Length ()
 Returns the number of components. More...
 
static NCollection_Vec3 Cross (const NCollection_Vec3 &theVec1, const NCollection_Vec3 &theVec2)
 Computes the cross product. More...
 
static NCollection_Vec3 GetLERP (const NCollection_Vec3 &theFrom, const NCollection_Vec3 &theTo, const Element_t theT)
 Compute linear interpolation between to vectors. More...
 
static NCollection_Vec3 DX ()
 Constuct DX unit vector. More...
 
static NCollection_Vec3 DY ()
 Constuct DY unit vector. More...
 
static NCollection_Vec3 DZ ()
 Constuct DZ unit vector. More...
 

Friends

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

Detailed Description

template<typename Element_t>
class NCollection_Vec3< Element_t >

Generic 3-components vector. To be used as RGB color pixel or XYZ 3D-point. The main target for this class - to handle raw low-level arrays (from/to graphic driver etc.).

Constructor & Destructor Documentation

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

Empty constructor. Construct the zero vector.

template<typename Element_t >
NCollection_Vec3< Element_t >::NCollection_Vec3 ( Element_t  theValue)
inlineexplicit

Initialize ALL components of vector within specified value.

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

Per-component constructor.

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

Constructor from 2-components vector.

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

Copy constructor.

Member Function Documentation

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

Alias to 3rd component as BLUE channel in RGB.

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

Alias to 3rd component as BLUE channel in RGB.

template<typename Element_t >
Element_t* NCollection_Vec3< Element_t >::ChangeData ( )
inline
template<typename Element_t >
static NCollection_Vec3 NCollection_Vec3< Element_t >::Cross ( const NCollection_Vec3< Element_t > &  theVec1,
const NCollection_Vec3< Element_t > &  theVec2 
)
inlinestatic

Computes the cross product.

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

Compute component-wise modulus of the vector.

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

Compute component-wise maximum of two vectors.

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

Compute component-wise minimum of two vectors.

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

Computes the dot product.

template<typename Element_t >
static NCollection_Vec3 NCollection_Vec3< Element_t >::DX ( )
inlinestatic

Constuct DX unit vector.

template<typename Element_t >
static NCollection_Vec3 NCollection_Vec3< Element_t >::DY ( )
inlinestatic

Constuct DY unit vector.

template<typename Element_t >
static NCollection_Vec3 NCollection_Vec3< Element_t >::DZ ( )
inlinestatic

Constuct DZ unit vector.

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

Alias to 2nd component as GREEN channel in RGB.

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

Alias to 2nd component as GREEN channel in RGB.

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

Raw access to the data (for OpenGL exchange).

template<typename Element_t >
static NCollection_Vec3 NCollection_Vec3< Element_t >::GetLERP ( const NCollection_Vec3< Element_t > &  theFrom,
const NCollection_Vec3< Element_t > &  theTo,
const Element_t  theT 
)
inlinestatic

Compute linear interpolation between to vectors.

Parameters
theT- interpolation coefficient 0..1;
Returns
interpolation result.
template<typename Element_t >
static int NCollection_Vec3< Element_t >::Length ( void  )
inlinestatic

Returns the number of components.

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

Compute maximum component of the vector.

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

Compute minimum component of the vector.

template<typename Element_t >
Element_t NCollection_Vec3< Element_t >::Modulus ( ) const
inline

Computes the vector modulus (magnitude, length).

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

Compute per-component multiplication by scale factor.

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

Compute per-component multiplication by scale factor.

template<typename Element_t >
void NCollection_Vec3< Element_t >::Normalize ( )
inline

Normalize the vector.

template<typename Element_t >
NCollection_Vec3 NCollection_Vec3< Element_t >::Normalized ( ) const
inline

Normalize the vector.

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

Compute per-component multiplication by scale factor.

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

Compute per-component multiplication.

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

Compute per-component multiplication by scale factor.

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

Compute per-component summary.

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

Unary -.

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

Compute per-component subtraction.

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

Compute per-component division by scale factor.

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

Compute per-component division by scale factor.

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

Optimized concretization for float type.

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

Optimized concretization for double type.

template<typename Element_t >
const NCollection_Vec3& NCollection_Vec3< Element_t >::operator= ( const NCollection_Vec3< Element_t > &  theVec3)
inline

Assignment operator.

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

Alias to 1st component as RED channel in RGB.

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

Alias to 1st component as RED channel in RGB.

template<typename Element_t >
Element_t NCollection_Vec3< Element_t >::SquareModulus ( ) const
inline

Computes the square of vector modulus (magnitude, length). This method may be used for performance tricks.

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

Alias to 1st component as X coordinate in XYZ.

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

Alias to 1st component as X coordinate in XYZ.

Returns
2 components by their names in specified order (in GLSL-style)
3 components by their names in specified order (in GLSL-style)
template<typename Element_t >
NCollection_Vec2<Element_t>& NCollection_Vec3< Element_t >::xy ( )
inline
Returns
XY-components modifiable vector
template<typename Element_t >
Element_t NCollection_Vec3< Element_t >::y ( ) const
inline

Alias to 2nd component as Y coordinate in XYZ.

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

Alias to 2nd component as Y coordinate in XYZ.

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

Alias to 3rd component as Z coordinate in XYZ.

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

Alias to 3rd component as Z coordinate in XYZ.

Friends And Related Function Documentation

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

Compute per-component multiplication.

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

Compute per-component summary.

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

Compute per-component subtraction.


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