OpenWalnut
1.2.5
|
Implements an orthogonal grid transformation. More...
#include <WGridTransformOrtho.h>
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 |
Implements an orthogonal grid transformation.
Definition at line 38 of file WGridTransformOrtho.h.
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.
scaleX | The scale in the x-direction. |
scaleY | The scale in the y-direction. |
scaleZ | The 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.
mat | The 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.
Destructor.
Definition at line 68 of file WGridTransformOrtho.cpp.
WVector3d WGridTransformOrtho::directionToGridSpace | ( | WVector3d const & | direction | ) | const |
Transforms a direction from world space to grid space.
direction | The position in world 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.
direction | The direction in grid 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.
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.
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.
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.
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.
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.
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.
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.
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().
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().
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().
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.
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.
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.
position | The position in world 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.
position | The position in grid 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().
void WGridTransformOrtho::scale | ( | VecType const & | scale | ) |
Scale the transform.
scale | A vector of scaling coeffs for the 3 directions. |
Definition at line 224 of file WGridTransformOrtho.h.
References m_scaling.
void WGridTransformOrtho::translate | ( | VecType const & | vec | ) |
Translate by a vector.
vec | The vector. |
Definition at line 216 of file WGridTransformOrtho.h.
References m_origin.
WVector3d WGridTransformOrtho::m_directionX [private] |
normalized direction of the grid's x-axis in world coordinates
Definition at line 200 of file WGridTransformOrtho.h.
Referenced by directionToGridSpace(), directionToWorldSpace(), getDirectionX(), getTransformationMatrix(), getUnitDirectionX(), isNotRotated(), operator WMatrix4d(), positionToGridSpace(), positionToWorldSpace(), and WGridTransformOrtho().
WVector3d WGridTransformOrtho::m_directionY [private] |
normalized direction of the grid's y-axis in world coordinates
Definition at line 203 of file WGridTransformOrtho.h.
Referenced by directionToGridSpace(), directionToWorldSpace(), getDirectionY(), getTransformationMatrix(), getUnitDirectionY(), isNotRotated(), operator WMatrix4d(), positionToGridSpace(), positionToWorldSpace(), and WGridTransformOrtho().
WVector3d WGridTransformOrtho::m_directionZ [private] |
normalized direction of the grid's z-axis in world coordinates
Definition at line 206 of file WGridTransformOrtho.h.
Referenced by directionToGridSpace(), directionToWorldSpace(), getDirectionZ(), getTransformationMatrix(), getUnitDirectionZ(), isNotRotated(), operator WMatrix4d(), positionToGridSpace(), positionToWorldSpace(), and WGridTransformOrtho().
WVector3d WGridTransformOrtho::m_origin [private] |
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().
WVector3d WGridTransformOrtho::m_scaling [private] |
the scaling factors for the 3 axes, i.e. the distance between samples
Definition at line 209 of file WGridTransformOrtho.h.
Referenced by directionToGridSpace(), directionToWorldSpace(), getDirectionX(), getDirectionY(), getDirectionZ(), getOffsetX(), getOffsetY(), getOffsetZ(), getTransformationMatrix(), operator WMatrix4d(), positionToGridSpace(), positionToWorldSpace(), scale(), and WGridTransformOrtho().