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

Vec3 is a template class to handle a 3D vector. More...

#include <Vec3.h>

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

Public Member Functions

 Vec3 (const T &aX=0, const T &aY=0, const T &aZ=0)
 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...
 
void setZ (const T &aValue)
 Set the position along the z-axis. More...
 
getX () const
 Accessor on the position along the x-axis. More...
 
getY () const
 Accessor on the position along the y-axis. More...
 
getZ () const
 Accessor on the position along the z-axis. More...
 
double length () const
 Get the length of the vector. More...
 
Vec3 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 Vec3 &aVector) const
 Get the dot product between the current vector and a given vector. More...
 
Vec3 crossProduct (const Vec3 &aVector) const
 
double distance (const Vec3 &aVector) const
 
Vec3< T > elementWiseProduct (const Vec3 &aVector) const
 Element-wise product. More...
 
Vec3 operator+ (const Vec3 &aVector) const
 Operator +. More...
 
Vec3operator+= (const Vec3 &aVector)
 Operator +=. More...
 
Vec3 operator- (const Vec3 &aVector) const
 Operator -. More...
 
Vec3operator-= (const Vec3 &aVector)
 Operator -=. More...
 
Vec3 operator* (const double &aValue) const
 Operator * to multiply each component of the vector by a given value. More...
 
Vec3operator*= (const double &aValue)
 
Vec3 operator* (const float &aValue) const
 Operator * to multiply each component of the vector by a given value. More...
 
Vec3operator*= (const float &aValue)
 
Vec3 operator/ (const double &aValue) const
 Operator / to divide each component of the vector by a given value. More...
 
Vec3operator/= (const double &aValue)
 Operator -=. More...
 
Vec3 operator/ (const float &aValue) const
 Operator / to divide each component of the vector by a given value. More...
 
Vec3operator/= (const float &aValue)
 Operator -=. More...
 
Vec3 operator^ (const Vec3 &aVector) const
 
Vec3 operator- () const
 Operator - to get the opposite vector. More...
 
bool operator== (const Vec3 &aVector) const
 Operator ==. More...
 
bool operator!= (const Vec3 &aVector) const
 Operator !=. 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...
 
m_z
 the position along the z-axi More...
 

Detailed Description

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

Vec3 is a template class to handle a 3D vector.

Definition at line 88 of file Vec3.h.

Constructor & Destructor Documentation

◆ Vec3()

template<typename T>
gVirtualXRay::Vec3< T >::Vec3 ( const T &  aX = 0,
const T &  aY = 0,
const T &  aZ = 0 
)

Default Constructor.

Parameters
aXthe position along the x-axis (default value is 0)
aYthe position along the y-axis (default value is 0)
aZthe position along the z-axis (default value is 0)

Definition at line 82 of file Vec3.inl.

Member Function Documentation

◆ crossProduct()

template<typename T >
Vec3< T > gVirtualXRay::Vec3< T >::crossProduct ( const Vec3< T > &  aVector) const

Cross product between the current vector and a given vector.

Parameters
aVectorthe other vector
Returns
the cross product

Definition at line 182 of file Vec3.inl.

◆ distance()

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

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

Parameters
aVectorthe other vector
Returns
the distance

Definition at line 209 of file Vec3.inl.

◆ dotProduct()

template<typename T >
double gVirtualXRay::Vec3< T >::dotProduct ( const Vec3< 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 174 of file Vec3.inl.

◆ elementWiseProduct()

template<typename T >
Vec3< T > gVirtualXRay::Vec3< T >::elementWiseProduct ( const Vec3< T > &  aVector) const

Element-wise product.

Operator * to compute the dot product between the current vector and a given vector.


Parameters
aVectorthe other vector
Returns
the dot product
Parameters
aVectorthe other vector
Returns
the new vector resulting of the element-wise product

Definition at line 201 of file Vec3.inl.

◆ getX()

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

Accessor on the position along the x-axis.

Returns
the position along the x-axis

Definition at line 115 of file Vec3.inl.

◆ getY()

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

Accessor on the position along the y-axis.

Returns
the position along the y-axis

Definition at line 123 of file Vec3.inl.

◆ getZ()

template<typename T >
T gVirtualXRay::Vec3< T >::getZ ( ) const

Accessor on the position along the z-axis.

Returns
the position along the z-axis

Definition at line 131 of file Vec3.inl.

◆ length()

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

Get the length of the vector.

Returns
the length of the vector

Definition at line 139 of file Vec3.inl.

◆ normal()

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

Get the unit vector corresponding to the normed current vector.

Returns
the unit vector

Definition at line 147 of file Vec3.inl.

◆ normalise()

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

Normalise the current vector so that its length is 1.

Definition at line 166 of file Vec3.inl.

◆ normalize()

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

Normalize the current vector so that its length is 1.

Definition at line 155 of file Vec3.inl.

◆ operator!=()

template<typename T >
bool gVirtualXRay::Vec3< T >::operator!= ( const Vec3< T > &  aVector) const

Operator !=.

Parameters
aVectorthe vector to compare the current vector with
Returns
true if the two vectors are different, false if the two vectors are the same

Definition at line 371 of file Vec3.inl.

◆ operator()() [1/2]

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

Definition at line 384 of file Vec3.inl.

◆ operator()() [2/2]

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

Definition at line 407 of file Vec3.inl.

◆ operator*() [1/2]

template<typename T >
Vec3< T > gVirtualXRay::Vec3< 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 262 of file Vec3.inl.

◆ operator*() [2/2]

template<typename T >
Vec3< T > gVirtualXRay::Vec3< 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 282 of file Vec3.inl.

◆ operator*=() [1/2]

template<typename T >
Vec3< T > & gVirtualXRay::Vec3< 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 270 of file Vec3.inl.

◆ operator*=() [2/2]

template<typename T >
Vec3< T > & gVirtualXRay::Vec3< 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 290 of file Vec3.inl.

◆ operator+()

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

Operator +.

Parameters
aVectorthe other vector
Returns
the dot product

Definition at line 222 of file Vec3.inl.

◆ operator+=()

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

Operator +=.

Parameters
aVectorthe other vector
Returns
the modified vector

Definition at line 230 of file Vec3.inl.

◆ operator-() [1/2]

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

Operator -.

Parameters
aVectorthe other vector
Returns
the modified vector

Definition at line 242 of file Vec3.inl.

◆ operator-() [2/2]

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

Operator - to get the opposite vector.

Returns
the opposite vector

Definition at line 350 of file Vec3.inl.

◆ operator-=()

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

Operator -=.

Parameters
aVectorthe other vector
Returns
the modified vector

Definition at line 250 of file Vec3.inl.

◆ operator/() [1/2]

template<typename T >
Vec3< T > gVirtualXRay::Vec3< 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 302 of file Vec3.inl.

◆ operator/() [2/2]

template<typename T >
Vec3< T > gVirtualXRay::Vec3< 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 322 of file Vec3.inl.

◆ operator/=() [1/2]

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

Operator -=.

Parameters
aValuethe other vector
Returns
the modified vector

Definition at line 310 of file Vec3.inl.

◆ operator/=() [2/2]

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

Operator -=.

Parameters
aValuethe other vector
Returns
the modified vector

Definition at line 330 of file Vec3.inl.

◆ operator==()

template<typename T >
bool gVirtualXRay::Vec3< T >::operator== ( const Vec3< T > &  aVector) const

Operator ==.

Parameters
aVectorthe vector to compare the current vector with
Returns
true if the two vectors are the same, false if the two vectors are different

Definition at line 358 of file Vec3.inl.

◆ operator[]() [1/2]

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

Definition at line 430 of file Vec3.inl.

◆ operator[]() [2/2]

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

Definition at line 453 of file Vec3.inl.

◆ operator^()

template<typename T >
Vec3< T > gVirtualXRay::Vec3< T >::operator^ ( const Vec3< T > &  aVector) const

Operator ^ to compute the cross product between the current vector and a given vector.

Parameters
aVectorthe other vector
Returns
the cross product

Definition at line 342 of file Vec3.inl.

◆ setX()

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

Set the position along the x-axis.

Parameters
aValuethe position along the x-axis

Definition at line 91 of file Vec3.inl.

◆ setY()

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

Set the position along the y-axis.

Parameters
aValuethe position along the y-axis

Definition at line 99 of file Vec3.inl.

◆ setZ()

template<typename T>
void gVirtualXRay::Vec3< T >::setZ ( const T &  aValue)

Set the position along the z-axis.

Parameters
aValuethe position along the z-axis

Definition at line 107 of file Vec3.inl.

Field Documentation

◆ m_x

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

the position along the x-axis

Definition at line 431 of file Vec3.h.

◆ m_y

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

the position along the y-axi

Definition at line 432 of file Vec3.h.

◆ m_z

template<typename T>
T gVirtualXRay::Vec3< T >::m_z
protected

the position along the z-axi

Definition at line 433 of file Vec3.h.


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