Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

transform.h File Reference

#include "vec3.h"
#include "emobject.h"
#include <cstdio>

Include dependency graph for transform.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  EMAN

Classes

class  EMAN::Transform
 A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of alignment parameters and euler orientations. More...
class  EMAN::Transform3D
 Transform3D These are a collection of transformation tools: rotation, translation, and construction of symmetric objects. More...

Defines

#define eman__transform_h__   1
 
Id
transform.h,v 1.170 2010/02/24 23:12:41 gtang Exp


Functions

Transform operator * (const Transform &M2, const Transform &M1)
 Matrix times Matrix, a pure mathematical operation.
template<typename Type>
Vec3f operator * (const Transform &M, const Vec3< Type > &v)
 Matrix times Vector, a pure mathematical operation.
template<typename Type>
Vec2f operator * (const Transform &M, const Vec2< Type > &v)
 Matrix times Vector, a pure mathematical operation.
template<typename Type>
Vec3f operator * (const Vec3< Type > &v, const Transform &M)
 Vector times a matrix.
Transform3D operator * (const Transform3D &M1, const Transform3D &M2)
template<typename Type>
Vec3f operator * (const Vec3< Type > &v, const Transform3D &M)
template<typename Type>
Vec3f operator * (const Transform3D &M, const Vec3< Type > &v)
template<typename Type>
Vec2f operator * (const Transform3D &M, const Vec2< Type > &v)


Define Documentation

#define eman__transform_h__   1
 

Id
transform.h,v 1.170 2010/02/24 23:12:41 gtang Exp

Definition at line 38 of file transform.h.


Function Documentation

template<typename Type>
Vec2f operator * const Transform3D &  M,
const Vec2< Type > &  v
 

Definition at line 899 of file transform.h.

References v, EMAN::Vec2f, x, and y.

00900         {
00901 //      This is the  left multiplication of a vector, v by a matrix M
00902                 float x = M[0][0] * v[0] + M[0][1] * v[1] + M[0][3] ;
00903                 float y = M[1][0] * v[0] + M[1][1] * v[1] + M[1][3];
00904                 return Vec2f(x, y);
00905         }

template<typename Type>
Vec3f operator * const Transform3D &  M,
const Vec3< Type > &  v
 

Definition at line 888 of file transform.h.

References v, EMAN::Vec3f, x, and y.

00889         {
00890 //      This is the  left multiplication of a vector, v by a matrix M
00891                 float x = M[0][0] * v[0] + M[0][1] * v[1] + M[0][2] * v[2] + M[0][3];
00892                 float y = M[1][0] * v[0] + M[1][1] * v[1] + M[1][2] * v[2] + M[1][3];
00893                 float z = M[2][0] * v[0] + M[2][1] * v[1] + M[2][2] * v[2] + M[2][3];
00894                 return Vec3f(x, y, z);
00895         }

template<typename Type>
Vec3f operator * const Vec3< Type > &  v,
const Transform3D &  M
 

Definition at line 878 of file transform.h.

References v, EMAN::Vec3f, x, and y.

00879         {
00880 //               This is the right multiplication of a row vector, v by a transform3D matrix M
00881                 float x = v[0] * M[0][0] + v[1] * M[1][0] + v[2] * M[2][0] ;
00882                 float y = v[0] * M[0][1] + v[1] * M[1][1] + v[2] * M[2][1];
00883                 float z = v[0] * M[0][2] + v[1] * M[1][2] + v[2] * M[2][2];
00884                 return Vec3f(x, y, z);
00885         }

Transform3D EMAN::operator * const Transform3D M1,
const Transform3D M2
 

Definition at line 1532 of file transform.cpp.

01533 {
01534 //       This is the  left multiplication of a matrix M1 by a matrix M2; that is M2*M1
01535 //       It returns a new matrix
01536         Transform3D resultant;
01537         for (int i=0; i<3; i++) {
01538                 for (int j=0; j<4; j++) {
01539                         resultant[i][j] = M2[i][0] * M1[0][j] +  M2[i][1] * M1[1][j] + M2[i][2] * M1[2][j];
01540                 }
01541                 resultant[i][3] += M2[i][3];  // add on the new translation (not included above)
01542         }
01543 
01544         for (int j=0; j<3; j++) {
01545                 resultant[3][j] = M2[3][j];
01546         }
01547 
01548         return resultant; // This will have the post_trans of M2
01549 }

template<typename Type>
Vec3f operator * const Vec3< Type > &  v,
const Transform &  M
 

Vector times a matrix.

Highly specialized. Useful when the upper 3x3 only contains rotations and you want to quickly multiply by the rotation matrix inverse (transpose)

Definition at line 473 of file transform.h.

References v, EMAN::Vec3f, x, and y.

00474         {
00475                 float x = v[0] * M[0][0] + v[1] * M[1][0] + v[2] * M[2][0] ;
00476                 float y = v[0] * M[0][1] + v[1] * M[1][1] + v[2] * M[2][1];
00477                 float z = v[0] * M[0][2] + v[1] * M[1][2] + v[2] * M[2][2];
00478                 return Vec3f(x, y, z);
00479         }

template<typename Type>
Vec2f operator * const Transform &  M,
const Vec2< Type > &  v
 

Matrix times Vector, a pure mathematical operation.

Definition at line 464 of file transform.h.

References EMAN::Transform::transform(), v, and EMAN::Vec2f.

00465         {
00466                 return M.transform(v);
00467         }

template<typename Type>
Vec3f operator * const Transform &  M,
const Vec3< Type > &  v
 

Matrix times Vector, a pure mathematical operation.

Definition at line 457 of file transform.h.

References EMAN::Transform::transform(), v, and EMAN::Vec3f.

00458         {
00459                 return M.transform(v);
00460         }

Transform EMAN::operator * const Transform M2,
const Transform M1
 

Matrix times Matrix, a pure mathematical operation.

Definition at line 1149 of file transform.cpp.

01150 {
01151         Transform result;
01152         for (int i=0; i<3; i++) {
01153                 for (int j=0; j<4; j++) {
01154                         result[i][j] = M2[i][0] * M1[0][j] +  M2[i][1] * M1[1][j] + M2[i][2] * M1[2][j];
01155                 }
01156                 result[i][3] += M2[i][3];
01157         }
01158 
01159         return result;
01160 }


Generated on Fri Apr 30 15:39:09 2010 for EMAN2 by  doxygen 1.3.9.1