Transformation for homogenous three dimensional space. More...
#include <transformation.hpp>
Public Member Functions | |
Transformation () | |
Constructor for identity transformation. More... | |
Transformation (double x11, double x12, double x13, double x14, double x21, double x22, double x23, double x24, double x31, double x32, double x33, double x34, double x41, double x42, double x43, double x44) | |
Constructor for preset transformation matrix. More... | |
Transformation (const Transformation &m) | |
Copy constructor. More... | |
Transformation (std::istream &is) | |
Constructor for loading transformation from stream is. More... | |
~Transformation () | |
Destructor. More... | |
double & | operator[] (int i) |
Indexing for transformation matrix. More... | |
const double & | operator[] (int i) const |
Indexing for constant transformation matrix. More... | |
Transformation | transpose (void) const |
Return transpose matrix. More... | |
double | determinant (void) const |
Return determinant of matrix. More... | |
Transformation | inverse (void) const |
Return inverse matrix. More... | |
bool | operator!= (const Transformation &m) const |
Non-equality test. More... | |
const Transformation & | operator*= (double s) |
Multiplication of tranformation matrix by scalar. More... | |
Transformation | operator* (const Transformation &m) const |
Multiplication of transformation matrices for combining transformations. More... | |
Vec4D | operator* (const Vec4D &v) const |
Multiplication of tranformation matrix by vector. More... | |
Vec4D | operator% (const Vec4D &v) const |
Multiplication of the transpose of the tranformation matrix by vector. More... | |
Vec4D | transform (const Vec4D &xin) const |
Transform homogenous vector xin. More... | |
Vec4D | transform_homogenous_point (const Vec3D &xin) const |
Transform point xin to homogenous space. More... | |
Vec3D | transform_point (const Vec3D &xin) const |
Transform point xin. More... | |
Vec3D | inv_transform_point (const Vec3D &xin) const |
Inverse transform point xin. More... | |
Vec3D | transform_vector (const Vec3D &xin) const |
Transform vector xin. More... | |
Vec3D | inv_transform_vector (const Vec3D &xin) const |
Inverse transform vector xin. More... | |
void | reset (void) |
Reset transformation. More... | |
void | translate (const Vec3D &d) |
Translate transformation. More... | |
void | translate_before (const Vec3D &d) |
Translate transformation. More... | |
void | scale (const Vec3D &s) |
Scale transformation. More... | |
void | scale_before (const Vec3D &s) |
Scale transformation. More... | |
void | rotate_x (double a) |
Rotate transformation around x-axis. More... | |
void | rotate_x_before (double a) |
Rotate transformation around x-axis. More... | |
void | rotate_y (double a) |
Rotate transformation around y-axis. More... | |
void | rotate_y_before (double a) |
Rotate transformation around y-axis. More... | |
void | rotate_z (double a) |
Rotate transformation around z-axis. More... | |
void | rotate_z_before (double a) |
Rotate transformation around z-axis. More... | |
void | save (const std::string &filename) const |
Saves data to a new file filename. More... | |
void | save (std::ostream &os) const |
Saves vector field data to stream os. More... | |
void | debug_print (std::ostream &os) const |
Print debugging information to stream os. More... | |
Static Public Member Functions | |
static Transformation | unity (void) |
Return unity transformation. More... | |
static Transformation | translation (const Vec3D &d) |
Return translation transformation. More... | |
static Transformation | scaling (const Vec3D &s) |
Return scaling transformation. More... | |
static Transformation | rotation_x (double a) |
Return rotation transformation rotating around x-axis. More... | |
static Transformation | rotation_y (double a) |
Return rotation transformation rotating around y-axis. More... | |
static Transformation | rotation_z (double a) |
Return rotation transformation rotating around z-axis. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Transformation &t) |
Outputting to stream. More... | |
Detailed Description
Transformation for homogenous three dimensional space.
Transformation for homogenous three dimensional space operates of 4-vectors of type Vec4D. The transformation contains convenience functions for making affine transformations on 3-vectors of type Vec3D.
The Transformation object is a 4x4 matrix with convenience functions for transformation related operations. The matrix is stored in row first order:
Constructor & Destructor Documentation
◆ Transformation() [1/4]
Transformation::Transformation | ( | ) |
Constructor for identity transformation.
◆ Transformation() [2/4]
Transformation::Transformation | ( | double | x11, |
double | x12, | ||
double | x13, | ||
double | x14, | ||
double | x21, | ||
double | x22, | ||
double | x23, | ||
double | x24, | ||
double | x31, | ||
double | x32, | ||
double | x33, | ||
double | x34, | ||
double | x41, | ||
double | x42, | ||
double | x43, | ||
double | x44 | ||
) |
Constructor for preset transformation matrix.
◆ Transformation() [3/4]
Transformation::Transformation | ( | const Transformation & | m | ) |
Copy constructor.
◆ Transformation() [4/4]
Transformation::Transformation | ( | std::istream & | is | ) |
Constructor for loading transformation from stream is.
◆ ~Transformation()
Transformation::~Transformation | ( | ) |
Destructor.
Member Function Documentation
◆ debug_print()
void Transformation::debug_print | ( | std::ostream & | os | ) | const |
Print debugging information to stream os.
◆ determinant()
double Transformation::determinant | ( | void | ) | const |
Return determinant of matrix.
◆ inv_transform_point()
Inverse transform point xin.
Assumes the transformation is affine. Homogenization of output vector is not done.
This is a convenience function to inverting a transformation matrix and then doing a transform. If more than one transform is done inverse() and transform() functions should be used.
◆ inv_transform_vector()
Inverse transform vector xin.
Assumes the transformation is affine. Homogenization of output vector is not done.
This is a convenience function to inverting a transformation matrix and then doing a transform. If more than one transform is done inverse() and transform_vector() functions should be used.
◆ inverse()
Transformation Transformation::inverse | ( | void | ) | const |
Return inverse matrix.
Throws an error if determinant is zero.
◆ operator!=()
bool Transformation::operator!= | ( | const Transformation & | m | ) | const |
Non-equality test.
◆ operator%()
Multiplication of the transpose of the tranformation matrix by vector.
Used for transforming surface normal vectors.
◆ operator*() [1/2]
Transformation Transformation::operator* | ( | const Transformation & | m | ) | const |
Multiplication of transformation matrices for combining transformations.
Tranformation is done by multiplying the matrix with a vector from the right. Therefore the multiplication of transformation matrices has the effect that the right-hand-side transformation is applied first and left-hand-side second.
◆ operator*() [2/2]
Multiplication of tranformation matrix by vector.
Makes a full transformation on the homogenous vector v.
◆ operator*=()
const Transformation & Transformation::operator*= | ( | double | s | ) |
Multiplication of tranformation matrix by scalar.
◆ operator[]() [1/2]
|
inline |
Indexing for transformation matrix.
◆ operator[]() [2/2]
|
inline |
Indexing for constant transformation matrix.
◆ reset()
void Transformation::reset | ( | void | ) |
Reset transformation.
Reset transformation to unity.
◆ rotate_x()
void Transformation::rotate_x | ( | double | a | ) |
Rotate transformation around x-axis.
Rotate around x-axis for a radians.
The effect of the new transformation is to first do the old transformation and then do the rotation.
◆ rotate_x_before()
void Transformation::rotate_x_before | ( | double | a | ) |
Rotate transformation around x-axis.
Rotate around x-axis for a radians.
The effect of the new transformation is to first do the rotation and then do the old transformation.
◆ rotate_y()
void Transformation::rotate_y | ( | double | a | ) |
Rotate transformation around y-axis.
Rotate around y-axis for a radians.
The effect of the new transformation is to first do the old transformation and then do the rotation.
◆ rotate_y_before()
void Transformation::rotate_y_before | ( | double | a | ) |
Rotate transformation around y-axis.
Rotate around y-axis for a radians.
The effect of the new transformation is to first do the rotation and then do the old transformation.
◆ rotate_z()
void Transformation::rotate_z | ( | double | a | ) |
Rotate transformation around z-axis.
Rotate around z-axis for a radians.
The effect of the new transformation is to first do the old transformation and then do the rotation.
◆ rotate_z_before()
void Transformation::rotate_z_before | ( | double | a | ) |
Rotate transformation around z-axis.
Rotate around z-axis for a radians.
The effect of the new transformation is to first do the rotation and then do the old transformation.
◆ rotation_x()
|
static |
Return rotation transformation rotating around x-axis.
◆ rotation_y()
|
static |
Return rotation transformation rotating around y-axis.
◆ rotation_z()
|
static |
Return rotation transformation rotating around z-axis.
◆ save() [1/2]
void Transformation::save | ( | const std::string & | filename | ) | const |
Saves data to a new file filename.
◆ save() [2/2]
void Transformation::save | ( | std::ostream & | os | ) | const |
Saves vector field data to stream os.
◆ scale()
void Transformation::scale | ( | const Vec3D & | s | ) |
Scale transformation.
The effect of the new transformation is to first do the old transformation and then do the scaling.
◆ scale_before()
void Transformation::scale_before | ( | const Vec3D & | s | ) |
Scale transformation.
The effect of the new transformation is to first do the scaling and then do the old transformation.
◆ scaling()
|
static |
Return scaling transformation.
◆ transform()
◆ transform_homogenous_point()
Transform point xin to homogenous space.
Homogenization of output vector is not done.
◆ transform_point()
Transform point xin.
Assumes the transformation is affine. Homogenization of output vector is not done.
◆ transform_vector()
Transform vector xin.
Assumes the transformation is affine. Homogenization of output vector is not done.
◆ translate()
void Transformation::translate | ( | const Vec3D & | d | ) |
Translate transformation.
The effect of the new transformation is to first do the old transformation and then do the translation.
◆ translate_before()
void Transformation::translate_before | ( | const Vec3D & | d | ) |
Translate transformation.
The effect of the new transformation is to first do the translation and then do the old transformation.
◆ translation()
|
static |
Return translation transformation.
◆ transpose()
Transformation Transformation::transpose | ( | void | ) | const |
Return transpose matrix.
◆ unity()
|
static |
Return unity transformation.
Friends And Related Function Documentation
◆ operator<<
|
friend |
Outputting to stream.
The documentation for this class was generated from the following files: