OpenWalnut 1.2.5
Public Member Functions | Private Attributes
WGridTransformOrtho Class Reference

Implements an orthogonal grid transformation. More...

#include <WGridTransformOrtho.h>

List of all members.

Public Member Functions

 WGridTransformOrtho ()
 Constructs an identity transform.
 WGridTransformOrtho (double scaleX, double scaleY, double scaleZ)
 Construct a transformation that scales the grid space.
 WGridTransformOrtho (WMatrix< double > const &mat)
 Construct a transformation from a transformation matrix.
 ~WGridTransformOrtho ()
 Destructor.
WVector3d positionToWorldSpace (WVector3d const &position) const
 Transforms a position from grid space to world space.
WVector3d positionToGridSpace (WVector3d const &position) const
 Transforms a position from world space to grid space.
WVector3d directionToWorldSpace (WVector3d const &direction) const
 Transforms a direction from grid space to world space.
WVector3d directionToGridSpace (WVector3d const &direction) const
 Transforms a direction from world space to grid space.
double getOffsetX () const
 Returns the distance between samples in x direction.
double getOffsetY () const
 Returns the distance between samples in y direction.
double getOffsetZ () const
 Returns the distance between samples in z direction.
WVector3d getDirectionX () const
 Returns the vector determining the direction of samples in x direction.
WVector3d getDirectionY () const
 Returns the vector determining the direction of samples in y direction.
WVector3d getDirectionZ () const
 Returns the vector determining the direction of samples in z direction.
WVector3d getUnitDirectionX () const
 Returns the vector determining the unit (normalized) direction of samples in x direction.
WVector3d getUnitDirectionY () const
 Returns the vector determining the unit (normalized) direction of samples in y direction.
WVector3d getUnitDirectionZ () const
 Returns the vector determining the unit (normalized) direction of samples in z direction.
WPosition getOrigin () const
 Returns the position of the origin of the grid.
WMatrix< double > getTransformationMatrix () const
 Returns a 4x4 matrix that represents the grid's transformaion.
 operator WMatrix4d () const
 Cast the transformation to the corresponding 4x4 matrix.
bool isNotRotated () const
 Check if this transform does not include a rotation.
template<typename VecType >
void translate (VecType const &vec)
 Translate by a vector.
template<typename VecType >
void scale (VecType const &scale)
 Scale the transform.

Private Attributes

WVector3d m_directionX
 normalized direction of the grid's x-axis in world coordinates
WVector3d m_directionY
 normalized direction of the grid's y-axis in world coordinates
WVector3d m_directionZ
 normalized direction of the grid's z-axis in world coordinates
WVector3d m_scaling
 the scaling factors for the 3 axes, i.e. the distance between samples
WVector3d m_origin
 the origin of the grid in world coordinates

Detailed Description

Implements an orthogonal grid transformation.

Definition at line 38 of file WGridTransformOrtho.h.


Constructor & Destructor Documentation

WGridTransformOrtho::WGridTransformOrtho ( )

Constructs an identity transform.

Definition at line 29 of file WGridTransformOrtho.cpp.

WGridTransformOrtho::WGridTransformOrtho ( double  scaleX,
double  scaleY,
double  scaleZ 
)

Construct a transformation that scales the grid space.

Parameters:
scaleXThe scale in the x-direction.
scaleYThe scale in the y-direction.
scaleZThe scale in the z-direction.

Definition at line 38 of file WGridTransformOrtho.cpp.

References m_scaling.

WGridTransformOrtho::WGridTransformOrtho ( WMatrix< double > const &  mat)

Construct a transformation from a transformation matrix.

The provided matrix represents the transformation from grid to world space.

Parameters:
matThe matrix.

Definition at line 48 of file WGridTransformOrtho.cpp.

References WMatrix< T >::getNbCols(), WMatrix< T >::getNbRows(), m_directionX, m_directionY, m_directionZ, m_origin, and m_scaling.

WGridTransformOrtho::~WGridTransformOrtho ( )

Destructor.

Definition at line 68 of file WGridTransformOrtho.cpp.


Member Function Documentation

WVector3d WGridTransformOrtho::directionToGridSpace ( WVector3d const &  direction) const

Transforms a direction from world space to grid space.

Parameters:
directionThe position in world space.
Returns:
The same position in grid space.

Definition at line 102 of file WGridTransformOrtho.cpp.

References m_directionX, m_directionY, m_directionZ, and m_scaling.

Referenced by WGridTransformTest::testTransformationToGridSpace().

WVector3d WGridTransformOrtho::directionToWorldSpace ( WVector3d const &  direction) const

Transforms a direction from grid space to world space.

Parameters:
directionThe direction in grid space.
Returns:
The same direction in world space.

Definition at line 92 of file WGridTransformOrtho.cpp.

References m_directionX, m_directionY, m_directionZ, and m_scaling.

Referenced by WGridTransformTest::testTransformationToWorldSpace().

WVector3d WGridTransformOrtho::getDirectionX ( ) const

Returns the vector determining the direction of samples in x direction.

Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) x-axis.

Returns:
The vector determining the direction of samples in x direction.

Definition at line 141 of file WGridTransformOrtho.cpp.

References m_directionX, and m_scaling.

Referenced by WGridRegular3D::getDirectionX(), WGridTransformTest::testCompareConstructors(), and WGridTransformTest::testInstantiation().

WVector3d WGridTransformOrtho::getDirectionY ( ) const

Returns the vector determining the direction of samples in y direction.

Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) y-axis.

Returns:
The vector determining the direction of samples in y direction.

Definition at line 146 of file WGridTransformOrtho.cpp.

References m_directionY, and m_scaling.

Referenced by WGridRegular3D::getDirectionY(), WGridTransformTest::testCompareConstructors(), and WGridTransformTest::testInstantiation().

WVector3d WGridTransformOrtho::getDirectionZ ( ) const

Returns the vector determining the direction of samples in z direction.

Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) z-axis.

Returns:
The vector determining the direction of samples in z direction.

Definition at line 151 of file WGridTransformOrtho.cpp.

References m_directionZ, and m_scaling.

Referenced by WGridRegular3D::getDirectionZ(), WGridTransformTest::testCompareConstructors(), and WGridTransformTest::testInstantiation().

double WGridTransformOrtho::getOffsetX ( ) const

Returns the distance between samples in x direction.

Returns:
The distance between samples in x direction.

Definition at line 111 of file WGridTransformOrtho.cpp.

References m_scaling.

Referenced by WGridRegular3D::getOffsetX(), WGridTransformTest::testCompareConstructors(), and WGridTransformTest::testInstantiation().

double WGridTransformOrtho::getOffsetY ( ) const

Returns the distance between samples in y direction.

Returns:
The distance between samples in y direction.

Definition at line 116 of file WGridTransformOrtho.cpp.

References m_scaling.

Referenced by WGridRegular3D::getOffsetY(), WGridTransformTest::testCompareConstructors(), and WGridTransformTest::testInstantiation().

double WGridTransformOrtho::getOffsetZ ( ) const

Returns the distance between samples in z direction.

Returns:
The distance between samples in z direction.

Definition at line 121 of file WGridTransformOrtho.cpp.

References m_scaling.

Referenced by WGridRegular3D::getOffsetZ(), WGridTransformTest::testCompareConstructors(), and WGridTransformTest::testInstantiation().

WPosition WGridTransformOrtho::getOrigin ( ) const

Returns the position of the origin of the grid.

Returns:
The position of the origin of the grid.

Definition at line 156 of file WGridTransformOrtho.cpp.

References m_origin.

Referenced by WGridRegular3D::getOrigin(), WGridTransformTest::testCompareConstructors(), and WGridTransformTest::testInstantiation().

WMatrix< double > WGridTransformOrtho::getTransformationMatrix ( ) const

Returns a 4x4 matrix that represents the grid's transformaion.

Returns:
The grid's transformation.

Definition at line 161 of file WGridTransformOrtho.cpp.

References m_directionX, m_directionY, m_directionZ, m_origin, m_scaling, and WMatrix< T >::makeIdentity().

Referenced by WGridRegular3D::getTransformationMatrix().

WVector3d WGridTransformOrtho::getUnitDirectionX ( ) const

Returns the vector determining the unit (normalized) direction of samples in x direction.

Returns:
The vector determining the unit (normalized) direction of samples in x direction.

Definition at line 126 of file WGridTransformOrtho.cpp.

References m_directionX.

Referenced by WGridRegular3D::getUnitDirectionX(), and WGridTransformTest::testInstantiation().

WVector3d WGridTransformOrtho::getUnitDirectionY ( ) const

Returns the vector determining the unit (normalized) direction of samples in y direction.

Returns:
The vector determining the unit (normalized) direction of samples in y direction.

Definition at line 131 of file WGridTransformOrtho.cpp.

References m_directionY.

Referenced by WGridRegular3D::getUnitDirectionY(), and WGridTransformTest::testInstantiation().

WVector3d WGridTransformOrtho::getUnitDirectionZ ( ) const

Returns the vector determining the unit (normalized) direction of samples in z direction.

Returns:
The vector determining the unit (normalized) direction of samples in z direction.

Definition at line 136 of file WGridTransformOrtho.cpp.

References m_directionZ.

Referenced by WGridRegular3D::getUnitDirectionZ(), and WGridTransformTest::testInstantiation().

bool WGridTransformOrtho::isNotRotated ( ) const

Check if this transform does not include a rotation.

Returns:
True, if this transform only scales and translates.

Definition at line 180 of file WGridTransformOrtho.cpp.

References m_directionX, m_directionY, and m_directionZ.

Referenced by WGridRegular3D::isNotRotated().

WGridTransformOrtho::operator WMatrix4d ( ) const

Cast the transformation to the corresponding 4x4 matrix.

Returns:
the matrix representing the transform

Definition at line 187 of file WGridTransformOrtho.cpp.

References WMatrixFixed< double, 4, 4 >::identity(), m_directionX, m_directionY, m_directionZ, m_origin, and m_scaling.

WVector3d WGridTransformOrtho::positionToGridSpace ( WVector3d const &  position) const

Transforms a position from world space to grid space.

Parameters:
positionThe position in world space.
Returns:
The same position in grid space.

Definition at line 82 of file WGridTransformOrtho.cpp.

References m_directionX, m_directionY, m_directionZ, m_origin, and m_scaling.

Referenced by WGridRegular3D::encloses(), WGridRegular3D::getXVoxelCoord(), WGridRegular3D::getYVoxelCoord(), WGridRegular3D::getZVoxelCoord(), WGridTransformTest::testTransformationToGridSpace(), and WGridRegular3D::worldCoordToTexCoord().

WVector3d WGridTransformOrtho::positionToWorldSpace ( WVector3d const &  position) const

Transforms a position from grid space to world space.

Parameters:
positionThe position in grid space.
Returns:
The same position in world space.

Definition at line 72 of file WGridTransformOrtho.cpp.

References m_directionX, m_directionY, m_directionZ, m_origin, and m_scaling.

Referenced by WGridRegular3D::getBoundingBox(), WGridRegular3D::getPosition(), and WGridTransformTest::testTransformationToWorldSpace().

template<typename VecType >
void WGridTransformOrtho::scale ( VecType const &  scale)

Scale the transform.

Parameters:
scaleA vector of scaling coeffs for the 3 directions.

Definition at line 224 of file WGridTransformOrtho.h.

References m_scaling.

template<typename VecType >
void WGridTransformOrtho::translate ( VecType const &  vec)

Translate by a vector.

Parameters:
vecThe vector.

Definition at line 216 of file WGridTransformOrtho.h.

References m_origin.


Member Data Documentation

the origin of the grid in world coordinates

Definition at line 212 of file WGridTransformOrtho.h.

Referenced by getOrigin(), getTransformationMatrix(), operator WMatrix4d(), positionToGridSpace(), positionToWorldSpace(), translate(), and WGridTransformOrtho().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends