Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
mirtk::VectorND< N, T > Struct Template Reference

#include <VectorND.h>

Collaboration diagram for mirtk::VectorND< N, T >:
Collaboration graph

Public Member Functions

double DotProduct (const VectorND &) const
 Dot-product with other vector.
 
double Length () const
 Compute length of vector.
 
void Normalize ()
 Normalize vector to length one.
 
 operator const T * () const
 Cast to C array pointer.
 
 operator T* ()
 Cast to C array pointer.
 
bool operator!= (int) const
 Element-wise inequality comparison with inegral-valued scalar.
 
bool operator!= (double) const
 Element-wise inequality comparison with real-valued scalar.
 
template<typename T2 >
bool operator!= (const VectorND< N, T2 > &) const
 Operator for testing non-equality of two vector.
 
T & operator() (int)
 Set/get vector component at index.
 
operator() (int) const
 Get vector component at index.
 
VectorND operator* (int) const
 Multiply vector by integral valued scalar.
 
VectorND operator* (double) const
 Multiply vector by real valued scalar.
 
template<typename T2 >
VectorND operator* (const VectorND< N, T2 > &) const
 Element-wise multiplication of two vectors.
 
VectorNDoperator*= (int)
 Multiply by integral valued scalar.
 
VectorNDoperator*= (double)
 Multiply by real valued scalar.
 
template<typename T2 >
VectorNDoperator*= (const VectorND< N, T2 > &)
 Element-wise multiplication with other vector.
 
VectorND operator+ (int) const
 Add integral valued scalar to vector.
 
VectorND operator+ (double) const
 Add real valued scalar to vector.
 
template<typename T2 >
VectorND operator+ (const VectorND< N, T2 > &) const
 Addition of two vectors.
 
VectorNDoperator+= (int)
 Add integral valued scalar.
 
VectorNDoperator+= (double)
 Add real valued scalar.
 
template<typename T2 >
VectorNDoperator+= (const VectorND< N, T2 > &)
 Addition of other vector.
 
VectorND operator- (int) const
 Subtract integral valued scalar to vector.
 
VectorND operator- (double) const
 Subtract real valued scalar to vector.
 
VectorND operator- () const
 Unary negation operator.
 
template<typename T2 >
VectorND operator- (const VectorND< N, T2 > &) const
 Subtraction of two vectors.
 
VectorNDoperator-= (int)
 Subtract integral valued scalar.
 
VectorNDoperator-= (double)
 Subtract real valued scalar.
 
template<typename T2 >
VectorNDoperator-= (const VectorND< N, T2 > &)
 Subtraction of other vector.
 
VectorND operator/ (int) const
 Divide vector by integral valued scalar.
 
VectorND operator/ (double) const
 Divide vector by real valued scalar.
 
template<typename T2 >
VectorND operator/ (const VectorND< N, T2 > &) const
 Element-wise division of two vectors.
 
VectorNDoperator/= (int)
 Divide by integral valued scalar.
 
VectorNDoperator/= (double)
 Divide by real valued scalar.
 
template<typename T2 >
VectorNDoperator/= (const VectorND< N, T2 > &)
 Element-wise division by other vector.
 
bool operator< (int) const
 Element-wise less than comparison to inegral-valued scalar.
 
bool operator< (double) const
 Element-wise less than comparison to real-valued scalar.
 
template<typename T2 >
bool operator< (const VectorND< N, T2 > &) const
 Operator for ordering vectors.
 
bool operator<= (int) const
 Element-wise less or equal than comparison to inegral-valued scalar.
 
bool operator<= (double) const
 Element-wise less or equal than comparison to real-valued scalar.
 
template<typename T2 >
bool operator<= (const VectorND< N, T2 > &) const
 Operator for ordering vectors.
 
VectorNDoperator= (int)
 Assign integral valued scalar.
 
VectorNDoperator= (double)
 Assign real valued scalar.
 
template<typename T2 >
VectorNDoperator= (const VectorND< N, T2 > &)
 Assignment from other vector.
 
bool operator== (int) const
 Element-wise equality comparison with inegral-valued scalar.
 
bool operator== (double) const
 Element-wise equality comparison with real-valued scalar.
 
template<typename T2 >
bool operator== (const VectorND< N, T2 > &) const
 Operator for testing equality of two vectors.
 
bool operator> (int) const
 Element-wise greater than comparison to inegral-valued scalar.
 
bool operator> (double) const
 Element-wise greater than comparison to real-valued scalar.
 
template<typename T2 >
bool operator> (const VectorND< N, T2 > &) const
 Operator for ordering vectors.
 
bool operator>= (int) const
 Element-wise greater or equal than comparison to inegral-valued scalar.
 
bool operator>= (double) const
 Element-wise greater or equal than comparison to real-valued scalar.
 
template<typename T2 >
bool operator>= (const VectorND< N, T2 > &) const
 Operator for ordering vectors.
 
double SquaredLength () const
 Compute squared length of vector.
 
 VectorND (T=T(0))
 Construct from scalar.
 
 VectorND (const T[N])
 Construct from C array.
 
 VectorND (const Vector &)
 Construct from variable size vector type.
 
template<typename T2 >
 VectorND (const VectorND< N, T2 > &)
 Copy constructor.
 

Static Public Member Functions

static int Rows ()
 Number of vector components.
 

Public Attributes

_v [N]
 Vector components.
 

Detailed Description

template<int N, typename T>
struct mirtk::VectorND< N, T >

Represents a n-D vector of fixed dimensions

Must be a primitive type which can be treated as an array of n values of type T such that sizeof(VectorND<n, T>) == n * sizeof(T). Thus, this primitive vector type may not have any other data members besides the n vector components. This is required especially when VectorND is used as voxel type of an image and further an externally allocated continuous block of n * sizeof(T) bytes used internally by the image instance which only reinterprets the memory as consecutive VectorND<n, T> instances, i.e.,

const int X = 256;
const int Y = 256;
const int Z = 128;
const int num = X * Y * Z;
const int dim = 9;
double *data = new double[dim * num];
GenericImage<VectorND<dim, double> > image(X, Y, Z, data);

Definition at line 52 of file VectorND.h.


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