ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Vector2Tpl< Type > Class Template Reference

2D Vector More...

#include <CVGeom.h>

Inheritance diagram for Vector2Tpl< Type >:

Public Member Functions

std::size_t rows () const
 
std::size_t dimensions () const
 
Type * data ()
 
const Type * data () const
 
 Vector2Tpl (Type s=0)
 Default constructor. More...
 
 Vector2Tpl (Type _x, Type _y)
 Constructor from a couple of coordinates. More...
 
Type norm2 () const
 Returns vector square norm. More...
 
Type norm () const
 Returns vector norm. More...
 
void normalize ()
 Sets vector norm to unity. More...
 
Type dot (const Vector2Tpl &v) const
 Dot product. More...
 
Type cross (const Vector2Tpl &v) const
 Cross product. More...
 
Vector2Tploperator- ()
 Inverse operator. More...
 
Vector2Tploperator+= (const Vector2Tpl &v)
 In-place addition operator. More...
 
Vector2Tploperator-= (const Vector2Tpl &v)
 In-place subtraction operator. More...
 
Vector2Tploperator*= (Type v)
 In-place multiplication (by a scalar) operator. More...
 
Vector2Tploperator/= (Type v)
 In-place division (by a scalar) operator. More...
 
Vector2Tpl operator+ (const Vector2Tpl &v) const
 Addition operator. More...
 
Vector2Tpl operator- (const Vector2Tpl &v) const
 Subtraction operator. More...
 
Vector2Tpl operator* (Type s) const
 Multiplication operator. More...
 
Vector2Tpl operator/ (Type s) const
 Division operator. More...
 
Type & operator[] (unsigned i)
 Direct coordinate access. More...
 
const Type & operator[] (unsigned i) const
 Direct coordinate access (const) More...
 

Public Attributes

union {
   struct {
      Type   x
 
      Type   y
 
   } 
 
   Type   u [2]
 
}; 
 

Detailed Description

template<typename Type>
class Vector2Tpl< Type >

2D Vector

Definition at line 32 of file CVGeom.h.

Constructor & Destructor Documentation

◆ Vector2Tpl() [1/2]

template<typename Type >
Vector2Tpl< Type >::Vector2Tpl ( Type  s = 0)
inlineexplicit

Default constructor.

Inits vector to (0,0).

Parameters
sdefault init value for both coordinates

Definition at line 51 of file CVGeom.h.

Referenced by Vector2Tpl< Type >::operator*(), Vector2Tpl< Type >::operator+(), Vector2Tpl< Type >::operator-(), and Vector2Tpl< Type >::operator/().

◆ Vector2Tpl() [2/2]

template<typename Type >
Vector2Tpl< Type >::Vector2Tpl ( Type  _x,
Type  _y 
)
inline

Constructor from a couple of coordinates.

Inits vector to (x,y).

Parameters
_xx coordinate
_yy coordinate

Definition at line 58 of file CVGeom.h.

Member Function Documentation

◆ cross()

template<typename Type >
Type Vector2Tpl< Type >::cross ( const Vector2Tpl< Type > &  v) const
inline

Cross product.

Returns
a positive value if (u,v) makes a counter-clockwise turn, negative for clockwise turn, and zero if the vectors are parallel

Definition at line 76 of file CVGeom.h.

References Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

Referenced by cloudViewer::PointProjectionTools::segmentIntersect().

◆ data() [1/2]

template<typename Type >
Type* Vector2Tpl< Type >::data ( )
inline

Definition at line 44 of file CVGeom.h.

References Vector2Tpl< Type >::u.

◆ data() [2/2]

template<typename Type >
const Type* Vector2Tpl< Type >::data ( ) const
inline

Definition at line 45 of file CVGeom.h.

References Vector2Tpl< Type >::u.

◆ dimensions()

template<typename Type >
std::size_t Vector2Tpl< Type >::dimensions ( ) const
inline

Definition at line 42 of file CVGeom.h.

Referenced by Vector2Tpl< Type >::rows().

◆ dot()

◆ norm()

template<typename Type >
Type Vector2Tpl< Type >::norm ( ) const
inline

Returns vector norm.

Definition at line 63 of file CVGeom.h.

References Vector2Tpl< Type >::norm2().

Referenced by Classifier::classify2D_checkcondnum(), and cloudViewer::PointProjectionTools::segmentIntersect().

◆ norm2()

template<typename Type >
Type Vector2Tpl< Type >::norm2 ( ) const
inline

◆ normalize()

template<typename Type >
void Vector2Tpl< Type >::normalize ( )
inline

Sets vector norm to unity.

Definition at line 65 of file CVGeom.h.

References Vector2Tpl< Type >::norm2().

Referenced by Classifier::classify2D_checkcondnum(), DilateClassifier(), and qCanupoTools::TrainClassifier().

◆ operator*()

template<typename Type >
Vector2Tpl Vector2Tpl< Type >::operator* ( Type  s) const
inline

Multiplication operator.

Definition at line 117 of file CVGeom.h.

References Vector2Tpl< Type >::Vector2Tpl(), Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator*=()

template<typename Type >
Vector2Tpl& Vector2Tpl< Type >::operator*= ( Type  v)
inline

In-place multiplication (by a scalar) operator.

Definition at line 97 of file CVGeom.h.

References Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator+()

template<typename Type >
Vector2Tpl Vector2Tpl< Type >::operator+ ( const Vector2Tpl< Type > &  v) const
inline

Addition operator.

Definition at line 109 of file CVGeom.h.

References Vector2Tpl< Type >::Vector2Tpl(), Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator+=()

template<typename Type >
Vector2Tpl& Vector2Tpl< Type >::operator+= ( const Vector2Tpl< Type > &  v)
inline

In-place addition operator.

Definition at line 85 of file CVGeom.h.

References Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator-() [1/2]

template<typename Type >
Vector2Tpl& Vector2Tpl< Type >::operator- ( )
inline

Inverse operator.

Definition at line 79 of file CVGeom.h.

References Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator-() [2/2]

template<typename Type >
Vector2Tpl Vector2Tpl< Type >::operator- ( const Vector2Tpl< Type > &  v) const
inline

Subtraction operator.

Definition at line 113 of file CVGeom.h.

References Vector2Tpl< Type >::Vector2Tpl(), Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator-=()

template<typename Type >
Vector2Tpl& Vector2Tpl< Type >::operator-= ( const Vector2Tpl< Type > &  v)
inline

In-place subtraction operator.

Definition at line 91 of file CVGeom.h.

References Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator/()

template<typename Type >
Vector2Tpl Vector2Tpl< Type >::operator/ ( Type  s) const
inline

Division operator.

Definition at line 121 of file CVGeom.h.

References Vector2Tpl< Type >::Vector2Tpl(), Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator/=()

template<typename Type >
Vector2Tpl& Vector2Tpl< Type >::operator/= ( Type  v)
inline

In-place division (by a scalar) operator.

Definition at line 103 of file CVGeom.h.

References Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ operator[]() [1/2]

template<typename Type >
Type& Vector2Tpl< Type >::operator[] ( unsigned  i)
inline

Direct coordinate access.

Definition at line 125 of file CVGeom.h.

References Vector2Tpl< Type >::u.

◆ operator[]() [2/2]

template<typename Type >
const Type& Vector2Tpl< Type >::operator[] ( unsigned  i) const
inline

Direct coordinate access (const)

Definition at line 127 of file CVGeom.h.

References Vector2Tpl< Type >::u.

◆ rows()

template<typename Type >
std::size_t Vector2Tpl< Type >::rows ( ) const
inline

Definition at line 41 of file CVGeom.h.

References Vector2Tpl< Type >::dimensions().

Member Data Documentation

◆ 

union { ... }

◆ u

template<typename Type >
Type Vector2Tpl< Type >::u[2]

◆ x

◆ y


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