Transformation for homogenous three dimensional space. More...
#include <transformation.hpp>
Public Member Functions | |
Transformation () | |
Constructor for identity 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 (const Transformation &m) | |
Copy constructor. | |
Transformation (std::istream &is) | |
Constructor for loading transformation from stream is. | |
~Transformation () | |
Destructor. | |
double & | operator[] (int i) |
Indexing for transformation matrix. | |
const double & | operator[] (int i) const |
Indexing for constant transformation matrix. | |
double | determinant (void) const |
Return determinant of matrix. | |
Transformation | inverse (void) const |
Return inverse matrix. | |
const Transformation & | operator*= (double s) |
Multiplication of tranformation matrix by scalar. | |
Transformation | operator* (const Transformation &m) const |
Multiplication of transformation matrices for combining transformations. | |
Vec4D | operator* (const Vec4D &v) const |
Multiplication of tranformation matrix by vector. | |
Vec4D | operator% (const Vec4D &v) const |
Multiplication of the transpose of the tranformation matrix by vector. | |
Vec4D | transform (const Vec4D &xin) const |
Transform homogenous vector xin. | |
Vec3D | transform_point (const Vec3D &xin) const |
Transform point xin. | |
Vec3D | inv_transform_point (const Vec3D &xin) const |
Inverse transform point xin. | |
Vec3D | transform_vector (const Vec3D &xin) const |
Transform vector xin. | |
Vec3D | inv_transform_vector (const Vec3D &xin) const |
Inverse transform vector xin. | |
void | reset (void) |
Reset transformation. | |
void | translate (const Vec3D &d) |
Translate transformation. | |
void | scale (const Vec3D &s) |
Scale transformation. | |
void | rotate_x (double a) |
Rotate transformation around x-axis. | |
void | rotate_y (double a) |
Rotate transformation around y-axis. | |
void | rotate_z (double a) |
Rotate transformation around z-axis. | |
void | save (const std::string &filename) const |
Saves data to a new file filename. | |
void | save (std::ostream &os) const |
Saves vector field data to stream os. | |
void | debug_print (std::ostream &os) const |
Print debugging information to stream os. |
Static Public Member Functions | |
static Transformation | unity (void) |
Return unity transformation. | |
static Transformation | translation (const Vec3D &d) |
Return translation transformation. | |
static Transformation | scaling (const Vec3D &s) |
Return scaling transformation. | |
static Transformation | rotation_x (double a) |
Return rotation transformation rotating around x-axis. | |
static Transformation | rotation_y (double a) |
Return rotation transformation rotating around y-axis. | |
static Transformation | rotation_z (double a) |
Return rotation transformation rotating around z-axis. |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Transformation &t) |
Outputting to stream. |
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.
Transformation::Transformation | ( | ) |
Constructor for identity transformation.
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::Transformation | ( | const Transformation & | m | ) |
Copy constructor.
Transformation::Transformation | ( | std::istream & | is | ) |
Constructor for loading transformation from stream is.
Transformation::~Transformation | ( | ) |
Destructor.
void Transformation::debug_print | ( | std::ostream & | os | ) | const |
Print debugging information to stream os.
double Transformation::determinant | ( | void | ) | const |
Return determinant of matrix.
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.
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.
Transformation Transformation::inverse | ( | void | ) | const |
Return inverse matrix.
Multiplication of the transpose of the tranformation matrix by vector.
Used for transforming surface normal vectors.
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.
Multiplication of tranformation matrix by vector.
Makes a full transformation on the homogenous vector v.
const Transformation& Transformation::operator*= | ( | double | s | ) |
Multiplication of tranformation matrix by scalar.
|
inline |
Indexing for transformation matrix.
|
inline |
Indexing for constant transformation matrix.
void Transformation::reset | ( | void | ) |
Reset transformation.
Reset transformation to unity.
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.
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.
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.
|
static |
Return rotation transformation rotating around x-axis.
|
static |
Return rotation transformation rotating around y-axis.
|
static |
Return rotation transformation rotating around z-axis.
void Transformation::save | ( | const std::string & | filename | ) | const |
Saves data to a new file filename.
void Transformation::save | ( | std::ostream & | os | ) | const |
Saves vector field data to stream os.
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.
|
static |
Return scaling transformation.
Transform point xin.
Assumes the transformation is affine. Homogenization of output vector is not done.
Transform vector xin.
Assumes the transformation is affine. Homogenization of output vector is not done.
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.
|
static |
Return translation transformation.
|
static |
Return unity transformation.
|
friend |
Outputting to stream.