Public Member Functions | Static Public Member Functions | Friends | List of all members
Transformation Class Reference

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 Transformationoperator*= (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.
 

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.

Constructor & Destructor Documentation

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.

Member Function Documentation

void Transformation::debug_print ( std::ostream &  os) const

Print debugging information to stream os.

double Transformation::determinant ( void  ) const

Return determinant of matrix.

Vec3D Transformation::inv_transform_point ( const Vec3D xin) const

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.

Vec3D Transformation::inv_transform_vector ( const Vec3D xin) const

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.

Vec4D Transformation::operator% ( const Vec4D v) const

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.

Vec4D Transformation::operator* ( const Vec4D v) const

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.

double& Transformation::operator[] ( int  i)
inline

Indexing for transformation matrix.

const double& Transformation::operator[] ( int  i) const
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 Transformation Transformation::rotation_x ( double  a)
static

Return rotation transformation rotating around x-axis.

static Transformation Transformation::rotation_y ( double  a)
static

Return rotation transformation rotating around y-axis.

static Transformation Transformation::rotation_z ( double  a)
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 Transformation Transformation::scaling ( const Vec3D s)
static

Return scaling transformation.

Vec4D Transformation::transform ( const Vec4D xin) const

Transform homogenous vector xin.

Vec3D Transformation::transform_point ( const Vec3D xin) const

Transform point xin.

Assumes the transformation is affine. Homogenization of output vector is not done.

Vec3D Transformation::transform_vector ( const Vec3D xin) const

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 Transformation Transformation::translation ( const Vec3D d)
static

Return translation transformation.

static Transformation Transformation::unity ( void  )
static

Return unity transformation.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Transformation t 
)
friend

Outputting to stream.


The documentation for this class was generated from the following file: