Open CASCADE Technology  7.5.0
Public Member Functions | Static Public Member Functions | Friends
NCollection_Vec2< Element_t > Class Template Reference

Defines the 2D-vector template. The main target for this class - to handle raw low-level arrays (from/to graphic driver etc.). More...

#include <NCollection_Vec2.hxx>

Public Member Functions

 NCollection_Vec2 ()
 Empty constructor. Construct the zero vector. More...
 
 NCollection_Vec2 (const Element_t theXY)
 Initialize ALL components of vector within specified value. More...
 
 NCollection_Vec2 (const Element_t theX, const Element_t theY)
 Per-component constructor. More...
 
template<typename OtherElement_t >
 NCollection_Vec2 (const NCollection_Vec2< OtherElement_t > &theOtherVec2)
 Conversion constructor (explicitly converts some 2-component vector with other element type to a new 2-component vector with the element type Element_t, whose elements are static_cast'ed corresponding elements of theOtherVec2 vector) More...
 
void SetValues (const Element_t theX, const Element_t theY)
 Assign new values to the vector. More...
 
Element_t x () const
 Alias to 1st component as X coordinate in XY. More...
 
Element_t y () const
 Alias to 2nd component as Y coordinate in XY. More...
 
Element_t & x ()
 Alias to 1st component as X coordinate in XY. More...
 
Element_t & y ()
 Alias to 2nd component as Y coordinate in XY. More...
 
bool IsEqual (const NCollection_Vec2 &theOther) const
 Check this vector with another vector for equality (without tolerance!). More...
 
bool operator== (const NCollection_Vec2 &theOther)
 Check this vector with another vector for equality (without tolerance!). More...
 
bool operator== (const NCollection_Vec2 &theOther) const
 
bool operator!= (const NCollection_Vec2 &theOther)
 Check this vector with another vector for non-equality (without tolerance!). More...
 
bool operator!= (const NCollection_Vec2 &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_Vec2operator+= (const NCollection_Vec2 &theAdd)
 Compute per-component summary. More...
 
NCollection_Vec2operator-= (const NCollection_Vec2 &theDec)
 Compute per-component subtraction. More...
 
NCollection_Vec2 operator- () const
 Unary -. More...
 
NCollection_Vec2operator*= (const NCollection_Vec2 &theRight)
 Compute per-component multiplication. More...
 
void Multiply (const Element_t theFactor)
 Compute per-component multiplication by scale factor. More...
 
NCollection_Vec2 Multiplied (const Element_t theFactor) const
 Compute per-component multiplication by scale factor. More...
 
NCollection_Vec2 cwiseMin (const NCollection_Vec2 &theVec) const
 Compute component-wise minimum of two vectors. More...
 
NCollection_Vec2 cwiseMax (const NCollection_Vec2 &theVec) const
 Compute component-wise maximum of two vectors. More...
 
NCollection_Vec2 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_Vec2operator*= (const Element_t theFactor)
 Compute per-component multiplication by scale factor. More...
 
NCollection_Vec2operator/= (const Element_t theInvFactor)
 Compute per-component division by scale factor. More...
 
NCollection_Vec2operator/= (const NCollection_Vec2 &theRight)
 Compute per-component division. More...
 
NCollection_Vec2 operator* (const Element_t theFactor) const
 Compute per-component multiplication by scale factor. More...
 
NCollection_Vec2 operator/ (const Element_t theInvFactor) const
 Compute per-component division by scale factor. More...
 
Element_t Dot (const NCollection_Vec2 &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 DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const
 Dumps the content of me into the stream. More...
 

Static Public Member Functions

static int Length ()
 Returns the number of components. More...
 
static NCollection_Vec2 DX ()
 Constuct DX unit vector. More...
 
static NCollection_Vec2 DY ()
 Constuct DY unit vector. More...
 

Friends

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

Detailed Description

template<typename Element_t>
class NCollection_Vec2< Element_t >

Defines the 2D-vector template. The main target for this class - to handle raw low-level arrays (from/to graphic driver etc.).

Constructor & Destructor Documentation

◆ NCollection_Vec2() [1/4]

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

Empty constructor. Construct the zero vector.

◆ NCollection_Vec2() [2/4]

template<typename Element_t>
NCollection_Vec2< Element_t >::NCollection_Vec2 ( const Element_t  theXY)
inlineexplicit

Initialize ALL components of vector within specified value.

◆ NCollection_Vec2() [3/4]

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

Per-component constructor.

◆ NCollection_Vec2() [4/4]

template<typename Element_t>
template<typename OtherElement_t >
NCollection_Vec2< Element_t >::NCollection_Vec2 ( const NCollection_Vec2< OtherElement_t > &  theOtherVec2)
inlineexplicit

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

Template Parameters
OtherElement_tthe element type of the other 2-component vector theOtherVec2
Parameters
theOtherVec2the 2-component vector that needs to be converted

Member Function Documentation

◆ ChangeData()

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

◆ cwiseAbs()

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

Compute component-wise modulus of the vector.

◆ cwiseMax()

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

Compute component-wise maximum of two vectors.

◆ cwiseMin()

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

Compute component-wise minimum of two vectors.

◆ Dot()

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

Computes the dot product.

◆ DumpJson()

template<typename Element_t>
void NCollection_Vec2< Element_t >::DumpJson ( Standard_OStream theOStream,
Standard_Integer  theDepth = -1 
) const
inline

Dumps the content of me into the stream.

◆ DX()

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

Constuct DX unit vector.

◆ DY()

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

Constuct DY unit vector.

◆ GetData()

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

Raw access to the data (for OpenGL exchange).

◆ IsEqual()

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

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

◆ Length()

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

Returns the number of components.

◆ maxComp()

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

Compute maximum component of the vector.

◆ minComp()

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

Compute minimum component of the vector.

◆ Modulus()

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

Computes the vector modulus (magnitude, length).

◆ Multiplied()

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

Compute per-component multiplication by scale factor.

◆ Multiply()

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

Compute per-component multiplication by scale factor.

◆ operator const Element_t *()

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

◆ operator Element_t *()

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

◆ operator!=() [1/2]

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

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

◆ operator!=() [2/2]

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

◆ operator*()

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

Compute per-component multiplication by scale factor.

◆ operator*=() [1/2]

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

Compute per-component multiplication.

◆ operator*=() [2/2]

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

Compute per-component multiplication by scale factor.

◆ operator+=()

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

Compute per-component summary.

◆ operator-()

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

Unary -.

◆ operator-=()

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

Compute per-component subtraction.

◆ operator/()

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

Compute per-component division by scale factor.

◆ operator/=() [1/2]

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

Compute per-component division by scale factor.

◆ operator/=() [2/2]

template<typename Element_t>
NCollection_Vec2& NCollection_Vec2< Element_t >::operator/= ( const NCollection_Vec2< Element_t > &  theRight)
inline

Compute per-component division.

◆ operator==() [1/2]

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

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

◆ operator==() [2/2]

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

◆ SetValues()

template<typename Element_t>
void NCollection_Vec2< Element_t >::SetValues ( const Element_t  theX,
const Element_t  theY 
)
inline

Assign new values to the vector.

◆ SquareModulus()

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

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

◆ x() [1/2]

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

Alias to 1st component as X coordinate in XY.

◆ x() [2/2]

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

Alias to 1st component as X coordinate in XY.

Returns
2 components by their names in specified order (in GLSL-style)

◆ y() [1/2]

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

Alias to 2nd component as Y coordinate in XY.

◆ y() [2/2]

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

Alias to 2nd component as Y coordinate in XY.

Friends And Related Function Documentation

◆ operator*

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

Compute per-component multiplication.

◆ operator+

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

Compute per-component summary.

◆ operator-

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

Compute per-component subtraction.

◆ operator/

template<typename Element_t>
NCollection_Vec2 operator/ ( const NCollection_Vec2< Element_t > &  theLeft,
const NCollection_Vec2< Element_t > &  theRight 
)
friend

Compute per-component division.


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