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

#include <Vector3D.h>

Collaboration diagram for mirtk::Vector3D< T >:
Collaboration graph

Public Member Functions

Vector3D CrossProduct (const Vector3D &) const
 Cross-product with other vector.
 
double DotProduct (const Vector3D &) 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 Vector3D< T2 > &) const
 
T & operator() (int)
 Set/get vector component at index 0: _x, 1: _y, or 2: _z.
 
operator() (int) const
 Get vector component at index 0: _x, 1: _y, or 2: _z.
 
Vector3D operator* (int) const
 Multiply vector by integral valued scalar.
 
Vector3D operator* (double) const
 Multiply vector by real valued scalar.
 
template<typename T2 >
Vector3D operator* (const Vector3D< T2 > &) const
 Element-wise multiplication of two vectors.
 
Vector3Doperator*= (int)
 Multiply by integral valued scalar.
 
Vector3Doperator*= (double)
 Multiply by real valued scalar.
 
template<typename T2 >
Vector3Doperator*= (const Vector3D< T2 > &)
 Element-wise multiplication with other vector.
 
Vector3D operator+ (int) const
 Add integral valued scalar to vector.
 
Vector3D operator+ (double) const
 Add real valued scalar to vector.
 
template<typename T2 >
Vector3D operator+ (const Vector3D< T2 > &) const
 Addition of two vectors.
 
Vector3Doperator+= (int)
 Add integral valued scalar.
 
Vector3Doperator+= (double)
 Add real valued scalar.
 
template<typename T2 >
Vector3Doperator+= (const Vector3D< T2 > &)
 Addition of other vector.
 
Vector3D operator- (int) const
 Subtract integral valued scalar to vector.
 
Vector3D operator- (double) const
 Subtract real valued scalar to vector.
 
Vector3D operator- () const
 Unary negation operator.
 
template<typename T2 >
Vector3D operator- (const Vector3D< T2 > &) const
 Subtraction of two vectors.
 
Vector3Doperator-= (int)
 Subtract integral valued scalar.
 
Vector3Doperator-= (double)
 Subtract real valued scalar.
 
template<typename T2 >
Vector3Doperator-= (const Vector3D< T2 > &)
 Subtraction of other vector.
 
Vector3D operator/ (int) const
 Divide vector by integral valued scalar.
 
Vector3D operator/ (double) const
 Divide vector by real valued scalar.
 
template<typename T2 >
Vector3D operator/ (const Vector3D< T2 > &) const
 Element-wise division of two vectors.
 
Vector3Doperator/= (int)
 Divide by integral valued scalar.
 
Vector3Doperator/= (double)
 Divide by real valued scalar.
 
template<typename T2 >
Vector3Doperator/= (const Vector3D< 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 Vector3D< T2 > &) const
 
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 Vector3D< T2 > &) const
 
Vector3Doperator= (const Vector3D &)
 Assignment operator.
 
Vector3Doperator= (const Point &)
 Assignment operator.
 
Vector3Doperator= (int)
 Assign integral valued scalar.
 
Vector3Doperator= (double)
 Assign real valued scalar.
 
template<typename T2 >
Vector3Doperator= (const Vector3D< 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 Vector3D< T2 > &) const
 
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 Vector3D< T2 > &) const
 
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 Vector3D< T2 > &) const
 
double SquaredLength () const
 Compute squared length of vector.
 
 Vector3D ()
 Default constructor.
 
 Vector3D (T)
 Construct from scalar.
 
 Vector3D (T, T, T)
 Construct from vector components.
 
 Vector3D (const T [3])
 Construct from C array.
 
 Vector3D (const Vector3 &)
 Construct from non-template 3D vector type.
 
 Vector3D (const Point &)
 Construct from 3D point.
 
template<typename T2 >
 Vector3D (const Vector3D< T2 > &)
 Copy constructor.
 

Static Public Member Functions

static Vector3D CrossProduct (const Vector3D &, const Vector3D &)
 
static double DotProduct (const Vector3D &, const Vector3D &)
 
static int Rows ()
 Number of vector components.
 

Public Attributes

_x
 The x component.
 
_y
 The y component.
 
_z
 The z component.
 

Detailed Description

template<typename T>
struct mirtk::Vector3D< T >

Represents a 3D vector

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

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

Definition at line 37 of file Vector.h.

Member Function Documentation

§ CrossProduct()

template<typename T >
Vector3D< T > mirtk::Vector3D< T >::CrossProduct ( const Vector3D< T > &  v1,
const Vector3D< T > &  v2 
)
inlinestatic

Cross-product of two vectors

Deprecated:
Use v1.CrossProduct(v2) instead which is less to type because it does not require the Vector<T>:: type prefix and further puts the name of the operation in between the arguments.

Definition at line 925 of file Vector3D.h.

§ DotProduct()

template<typename T >
double mirtk::Vector3D< T >::DotProduct ( const Vector3D< T > &  v1,
const Vector3D< T > &  v2 
)
inlinestatic

Dot-product of two vectors

Deprecated:
Use v1.DotProduct(v2) instead which is less to type because it does not require the Vector<T>:: type prefix and further puts the name of the operation in between the arguments.

Definition at line 940 of file Vector3D.h.

§ operator!=()

template<typename T1 >
template<typename T2 >
bool mirtk::Vector3D< T1 >::operator!= ( const Vector3D< T2 > &  v) const
inline

Operator for testing non-equality of two vector.

Definition at line 850 of file Vector3D.h.

§ operator<()

template<typename T1 >
template<typename T2 >
bool mirtk::Vector3D< T1 >::operator< ( const Vector3D< T2 > &  v) const
inline

Operator for comparing sizes of vectors.

Definition at line 857 of file Vector3D.h.

§ operator<=()

template<typename T1 >
template<typename T2 >
bool mirtk::Vector3D< T1 >::operator<= ( const Vector3D< T2 > &  v) const
inline

Operator for comparing sizes of vectors.

Definition at line 875 of file Vector3D.h.

§ operator==()

template<typename T1 >
template<typename T2 >
bool mirtk::Vector3D< T1 >::operator== ( const Vector3D< T2 > &  v) const
inline

Operator for testing equality of two vectors.

Definition at line 843 of file Vector3D.h.

§ operator>()

template<typename T1 >
template<typename T2 >
bool mirtk::Vector3D< T1 >::operator> ( const Vector3D< T2 > &  v) const
inline

Operator for comparing sizes of vectors.

Definition at line 866 of file Vector3D.h.

§ operator>=()

template<typename T1 >
template<typename T2 >
bool mirtk::Vector3D< T1 >::operator>= ( const Vector3D< T2 > &  v) const
inline

Operator for comparing sizes of vectors.

Definition at line 882 of file Vector3D.h.


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