gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
Public Member Functions | Protected Attributes
gVirtualXRay::Vec2< T > Class Template Reference

Vec2 is a template class to handle a 2D vector. More...

#include <Vec2.h>

Collaboration diagram for gVirtualXRay::Vec2< T >:
Collaboration graph

Public Member Functions

 Vec2 (const T &aX=0.0f, const T &aY=0.0f)
 Default Constructor. More...
 
void setX (const T &aValue)
 Set the position along the x-axis. More...
 
void setY (const T &aValue)
 Set the position along the y-axis. More...
 
getX () const
 Accessor on the position along the x-axis. More...
 
getY () const
 Accessor on the position along the y-axis. More...
 
double length () const
 Get the length of the vector. More...
 
Vec2 normal () const
 Get the unit vector corresponding to the normed current vector. More...
 
void normalize ()
 Normalize the current vector so that its length is 1. More...
 
void normalise ()
 Normalise the current vector so that its length is 1. More...
 
double dotProduct (const Vec2 &aVector) const
 Get the dot product between the current vector and a given vector. More...
 
double distance (const Vec2 &aVector) const
 
const Vec2 operator+ (const Vec2 &aVector) const
 Operator +. More...
 
Vec2operator+= (const Vec2 &aVector)
 Operator +=. More...
 
const Vec2 operator- (const Vec2 &aVector) const
 Operator -. More...
 
Vec2operator-= (const Vec2 &aVector)
 Operator -=. More...
 
const Vec2 operator* (const double &aValue) const
 Operator * to multiply each component of the vector by a given value. More...
 
Vec2operator*= (const double &aValue)
 
const Vec2 operator* (const float &aValue) const
 Operator * to multiply each component of the vector by a given value. More...
 
Vec2operator*= (const float &aValue)
 
const Vec2 operator/ (const double &aValue) const
 Operator / to divide each component of the vector by a given value. More...
 
Vec2operator/= (const double &aValue)
 
const Vec2 operator/ (const float &aValue) const
 Operator / to divide each component of the vector by a given value. More...
 
Vec2operator/= (const float &aValue)
 
const Vec2 operator- () const
 Operator - to get the opposite vector. More...
 
T & operator() (unsigned int i)
 
const T & operator() (unsigned int i) const
 
T & operator[] (unsigned int i)
 
const T & operator[] (unsigned int i) const
 

Protected Attributes

m_x
 the position along the x-axis More...
 
m_y
 the position along the y-axi More...
 

Detailed Description

template<typename T>
class gVirtualXRay::Vec2< T >

Vec2 is a template class to handle a 2D vector.

Definition at line 83 of file Vec2.h.

Constructor & Destructor Documentation

◆ Vec2()

template<typename T>
gVirtualXRay::Vec2< T >::Vec2 ( const T &  aX = 0.0f,
const T &  aY = 0.0f 
)

Default Constructor.

Parameters
aXthe position along the x-axis
aYthe position along the y-axis

Definition at line 69 of file Vec2.inl.

Member Function Documentation

◆ distance()

template<typename T >
double gVirtualXRay::Vec2< T >::distance ( const Vec2< T > &  aVector) const

Get the distance between the 2D position represented by the current vector and another position.

Parameters
aVectorthe other vector
Returns
the distance

Definition at line 152 of file Vec2.inl.

◆ dotProduct()

template<typename T >
double gVirtualXRay::Vec2< T >::dotProduct ( const Vec2< T > &  aVector) const

Get the dot product between the current vector and a given vector.

Parameters
aVectorthe other vector
Returns
the dot product

Definition at line 144 of file Vec2.inl.

◆ getX()

template<typename T >
T gVirtualXRay::Vec2< T >::getX ( ) const

Accessor on the position along the x-axis.

Returns
the position along the x-axis

Definition at line 94 of file Vec2.inl.

◆ getY()

template<typename T >
T gVirtualXRay::Vec2< T >::getY ( ) const

Accessor on the position along the y-axis.

Returns
the position along the y-axis

Definition at line 102 of file Vec2.inl.

◆ length()

template<typename T >
double gVirtualXRay::Vec2< T >::length ( ) const

Get the length of the vector.

Returns
the length of the vector

Definition at line 110 of file Vec2.inl.

◆ normal()

template<typename T >
Vec2< T > gVirtualXRay::Vec2< T >::normal ( ) const

Get the unit vector corresponding to the normed current vector.

Returns
the unit vector

Definition at line 118 of file Vec2.inl.

◆ normalise()

template<typename T >
void gVirtualXRay::Vec2< T >::normalise ( )

Normalise the current vector so that its length is 1.

Definition at line 136 of file Vec2.inl.

◆ normalize()

template<typename T >
void gVirtualXRay::Vec2< T >::normalize ( )

Normalize the current vector so that its length is 1.

Definition at line 126 of file Vec2.inl.

◆ operator()() [1/2]

template<typename T >
T & gVirtualXRay::Vec2< T >::operator() ( unsigned int  i)

Definition at line 286 of file Vec2.inl.

◆ operator()() [2/2]

template<typename T >
const T & gVirtualXRay::Vec2< T >::operator() ( unsigned int  i) const

Definition at line 305 of file Vec2.inl.

◆ operator*() [1/2]

template<typename T >
const Vec2< T > gVirtualXRay::Vec2< T >::operator* ( const double &  aValue) const

Operator * to multiply each component of the vector by a given value.

Parameters
aValuethe multiplicative value
Returns
the modified vector

Definition at line 202 of file Vec2.inl.

◆ operator*() [2/2]

template<typename T >
const Vec2< T > gVirtualXRay::Vec2< T >::operator* ( const float &  aValue) const

Operator * to multiply each component of the vector by a given value.

Parameters
aValuethe multiplicative value
Returns
the modified vector

Definition at line 221 of file Vec2.inl.

◆ operator*=() [1/2]

template<typename T >
Vec2< T > & gVirtualXRay::Vec2< T >::operator*= ( const double &  aValue)

Operator *= to multiply each component of the vector by a given value, and modify the current vector.

Parameters
aValuethe multiplicative value
Returns
the modified vector

Definition at line 210 of file Vec2.inl.

◆ operator*=() [2/2]

template<typename T >
Vec2< T > & gVirtualXRay::Vec2< T >::operator*= ( const float &  aValue)

Operator *= to multiply each component of the vector by a given value, and modify the current vector.

Parameters
aValuethe multiplicative value
Returns
the modified vector

Definition at line 229 of file Vec2.inl.

◆ operator+()

template<typename T >
const Vec2< T > gVirtualXRay::Vec2< T >::operator+ ( const Vec2< T > &  aVector) const

Operator +.

Parameters
aVectorthe other vector
Returns
the modified vector

Definition at line 164 of file Vec2.inl.

◆ operator+=()

template<typename T >
Vec2< T > & gVirtualXRay::Vec2< T >::operator+= ( const Vec2< T > &  aVector)

Operator +=.

Parameters
aVectorthe other vector
Returns
the modified vector

Definition at line 172 of file Vec2.inl.

◆ operator-() [1/2]

template<typename T >
const Vec2< T > gVirtualXRay::Vec2< T >::operator- ( const Vec2< T > &  aVector) const

Operator -.

Parameters
aVectorthe other vector
Returns
the modified vector

Definition at line 183 of file Vec2.inl.

◆ operator-() [2/2]

template<typename T >
const Vec2< T > gVirtualXRay::Vec2< T >::operator- ( ) const

Operator - to get the opposite vector.

Returns
the opposite vector

Definition at line 278 of file Vec2.inl.

◆ operator-=()

template<typename T >
Vec2< T > & gVirtualXRay::Vec2< T >::operator-= ( const Vec2< T > &  aVector)

Operator -=.

Parameters
aVectorthe other vector
Returns
the modified vector

Definition at line 191 of file Vec2.inl.

◆ operator/() [1/2]

template<typename T >
const Vec2< T > gVirtualXRay::Vec2< T >::operator/ ( const double &  aValue) const

Operator / to divide each component of the vector by a given value.

Parameters
aValuethe value
Returns
the modified vector

Definition at line 240 of file Vec2.inl.

◆ operator/() [2/2]

template<typename T >
const Vec2< T > gVirtualXRay::Vec2< T >::operator/ ( const float &  aValue) const

Operator / to divide each component of the vector by a given value.

Parameters
aValuethe value
Returns
the modified vector

Definition at line 259 of file Vec2.inl.

◆ operator/=() [1/2]

template<typename T >
Vec2< T > & gVirtualXRay::Vec2< T >::operator/= ( const double &  aValue)

Operator /= to divide each component of the vector by a given value, and modify the current vector.

Parameters
aValuethe value
Returns
the modified vector

Definition at line 248 of file Vec2.inl.

◆ operator/=() [2/2]

template<typename T >
Vec2< T > & gVirtualXRay::Vec2< T >::operator/= ( const float &  aValue)

Operator /= to divide each component of the vector by a given value, and modify the current vector.

Parameters
aValuethe value
Returns
the modified vector

Definition at line 267 of file Vec2.inl.

◆ operator[]() [1/2]

template<typename T >
T & gVirtualXRay::Vec2< T >::operator[] ( unsigned int  i)

Definition at line 324 of file Vec2.inl.

◆ operator[]() [2/2]

template<typename T >
const T & gVirtualXRay::Vec2< T >::operator[] ( unsigned int  i) const

Definition at line 343 of file Vec2.inl.

◆ setX()

template<typename T>
void gVirtualXRay::Vec2< T >::setX ( const T &  aValue)

Set the position along the x-axis.

Parameters
aValuethe position along the x-axis

Definition at line 78 of file Vec2.inl.

◆ setY()

template<typename T>
void gVirtualXRay::Vec2< T >::setY ( const T &  aValue)

Set the position along the y-axis.

Parameters
aValuethe position along the y-axis

Definition at line 86 of file Vec2.inl.

Field Documentation

◆ m_x

template<typename T>
T gVirtualXRay::Vec2< T >::m_x
protected

the position along the x-axis

Definition at line 349 of file Vec2.h.

◆ m_y

template<typename T>
T gVirtualXRay::Vec2< T >::m_y
protected

the position along the y-axi

Definition at line 350 of file Vec2.h.


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