#include <vimt3d_transform_3d.h>
The transform which can be up to an affine transformation. In order of complexity the transform can be
One useful special case of Affine involves anisotropic scaling, followed by rotation, then translation.
The transform types Translation, ZoomOnly, RigidBody and Similarity have a defined order in which scaling, rotation and translation components are applied, and the components are thus separable. Other transformations (e.g. translation followed by rotation) can be obtained by composing multiple transforms. The resulting transform will in general be termed affine.
The transformation can be represented by a 4x4 matrix of homogeneous co-ordinates.
( xx xy xz xt ) ( yx yy yz yt ) ( zx zy zz zt ) ( tx ty tz tt )
Definition at line 46 of file vimt3d_transform_3d.h.
Public Types | |
| enum | Form { Identity, Translation, ZoomOnly, RigidBody, Similarity, Affine } |
| Defines form of transformation. More... | |
Public Member Functions | |
| vimt3d_transform_3d () | |
| Construct as identity transform. | |
| ~vimt3d_transform_3d () | |
| Destructor. | |
| bool | is_identity () const |
| True if identity. | |
| Form | form () const |
| Form of transformation. | |
| vnl_matrix< double > | matrix () const |
| Gets 4x4 Matrix representing transformation. | |
| void | matrix (vnl_matrix< double > &M) const |
| Gets 4x4 Matrix representing transformation. | |
| void | params (vnl_vector< double > &v) const |
| Fills v with parameters. | |
| void | set (const vnl_vector< double > &v, Form) |
| Sets transform using v. | |
| void | set_identity () |
| Sets transform to identity. | |
| void | set_translation (double t_x, double t_y, double t_z) |
| Sets the transformation to be a translation. | |
| void | set_zoom_only (double s_x, double s_y, double s_z, double t_x, double t_y, double t_z) |
| Sets the transformation to be anisotropic scaling, followed by translation. | |
| void | set_zoom_only (double s, double t_x, double t_y, double t_z) |
| Sets the transformation to be isotropic scaling, followed by translation. | |
| void | set_rigid_body (double r_x, double r_y, double r_z, double t_x, double t_y, double t_z) |
| Sets the transformation to be rotation, followed by translation. | |
| void | set_similarity (double s, double r_x, double r_y, double r_z, double t_x, double t_y, double t_z) |
| Sets the transformation to be isotropic scaling, followed by rotation, then translation. | |
| void | set_affine (double s_x, double s_y, double s_z, double r_x, double r_y, double r_z, double t_x, double t_y, double t_z) |
| Sets the transformation to be a special case of Affine: anisotropic scaling, followed by rotation, then translation. | |
| void | set_affine (double s_x, double s_y, double s_z, vgl_vector_3d< double > c_x, vgl_vector_3d< double > c_y, vgl_vector_3d< double > c_z, double t_x, double t_y, double t_z) |
| Sets the transformation to be a special case of Affine: anisotropic scaling, followed by rotation, then translation. | |
| void | set_affine (const vgl_point_3d< double > &p, const vgl_vector_3d< double > &u, const vgl_vector_3d< double > &v, const vgl_vector_3d< double > &w) |
| Sets the transformation to be a special case of Affine. | |
| vgl_point_3d< double > | origin () const |
| Returns the coordinates of the origin. | |
| void | set_origin (const vgl_point_3d< double > &) |
| Modifies the transformation so that origin == p. | |
| vgl_point_3d< double > | operator() (double x, double y, double z) const |
| Applies transformation to (x,y,z). | |
| vgl_point_3d< double > | operator() (vgl_point_3d< double > p) const |
| Applies transformation to point p. | |
| vimt3d_transform_3d | inverse () const |
| Returns the inverse of the current transform. | |
| vgl_vector_3d< double > | delta (vgl_point_3d< double >, vgl_vector_3d< double > dp) const |
| Returns change in transformed point when original point moved by dp. | |
| void | print_summary (vcl_ostream &os) const |
| Print class to os. | |
| void | print_all (vcl_ostream &os) const |
| Print class to os. | |
| void | config (vcl_istream &is) |
| Set transformation from stream;. | |
| void | b_write (vsl_b_ostream &bfs) const |
| Save class to binary file stream. | |
| void | b_read (vsl_b_istream &bfs) |
| Load class from binary file stream. | |
| bool | operator== (const vimt3d_transform_3d &) const |
| True if t is the same as this. | |
Protected Member Functions | |
| void | calcInverse () const |
| void | setCheck (int n1, int n2, const char *str) const |
| void | angles (double &phi_x, double &phi_y, double &phi_z) const |
| void | setRotMat (double r_x, double r_y, double r_z) |
Protected Attributes | |
| double | xx_ |
| double | xy_ |
| double | xz_ |
| double | xt_ |
| double | yx_ |
| double | yy_ |
| double | yz_ |
| double | yt_ |
| double | zx_ |
| double | zy_ |
| double | zz_ |
| double | zt_ |
| double | tx_ |
| double | ty_ |
| double | tz_ |
| double | tt_ |
| Form | form_ |
| double | xx2_ |
| double | xy2_ |
| double | xz2_ |
| double | xt2_ |
| double | yx2_ |
| double | yy2_ |
| double | yz2_ |
| double | yt2_ |
| double | zx2_ |
| double | zy2_ |
| double | zz2_ |
| double | zt2_ |
| double | tx2_ |
| double | ty2_ |
| double | tz2_ |
| double | tt2_ |
| bool | inv_uptodate_ |
Friends | |
| vimt3d_transform_3d | operator * (const vimt3d_transform_3d &L, const vimt3d_transform_3d &R) |
| Calculates the product LR. | |
Defines form of transformation.
| Identity | |
| Translation | |
| ZoomOnly | Anisotropic scaling, followed by translation. |
| RigidBody | Rotation, followed by translation. |
| Similarity | Isotropic scaling, followed by rotation, then translation. |
| Affine |
Definition at line 51 of file vimt3d_transform_3d.h.
| vimt3d_transform_3d::vimt3d_transform_3d | ( | ) | [inline] |
| vimt3d_transform_3d::~vimt3d_transform_3d | ( | ) | [inline] |
| bool vimt3d_transform_3d::is_identity | ( | ) | const [inline] |
| Form vimt3d_transform_3d::form | ( | ) | const [inline] |
| vnl_matrix< double > vimt3d_transform_3d::matrix | ( | ) | const |
| void vimt3d_transform_3d::matrix | ( | vnl_matrix< double > & | M | ) | const |
Gets 4x4 Matrix representing transformation.
| M | a 4x4 Matrix representing transformation |
Definition at line 31 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::params | ( | vnl_vector< double > & | v | ) | const |
| void vimt3d_transform_3d::set | ( | const vnl_vector< double > & | v, | |
| Form | ||||
| ) |
| void vimt3d_transform_3d::set_identity | ( | ) |
| void vimt3d_transform_3d::set_translation | ( | double | t_x, | |
| double | t_y, | |||
| double | t_z | |||
| ) |
Sets the transformation to be a translation.
| t_x | Translation in x | |
| t_y | Translation in y | |
| t_z | Translation in z |
Definition at line 292 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::set_zoom_only | ( | double | s_x, | |
| double | s_y, | |||
| double | s_z, | |||
| double | t_x, | |||
| double | t_y, | |||
| double | t_z | |||
| ) |
Sets the transformation to be anisotropic scaling, followed by translation.
The transformation is separable affine. x' = s_x.x + t_x, y' = s_y.y + t_y, z' = s_z.z + t_z
| s_x | Scaling in x | |
| s_y | Scaling in y | |
| s_z | Scaling in z | |
| t_x | Translation in x | |
| t_y | Translation in y | |
| t_z | Translation in z |
Definition at line 316 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::set_zoom_only | ( | double | s, | |
| double | t_x, | |||
| double | t_y, | |||
| double | t_z | |||
| ) | [inline] |
Sets the transformation to be isotropic scaling, followed by translation.
The transformation is separable affine. x' = s.x + t_x, y' = s.y + t_y, z' = s.z + t_z
| s | Scaling in x, y and z | |
| t_x | Translation in x | |
| t_y | Translation in y | |
| t_z | Translation in z |
Definition at line 119 of file vimt3d_transform_3d.h.
| void vimt3d_transform_3d::set_rigid_body | ( | double | r_x, | |
| double | r_y, | |||
| double | r_z, | |||
| double | t_x, | |||
| double | t_y, | |||
| double | t_z | |||
| ) |
Sets the transformation to be rotation, followed by translation.
The transformation is separable affine.
| r_x | Angle of rotation in x | |
| r_y | Angle of rotation in y | |
| r_z | Angle of rotation in z | |
| t_x | Translation in x | |
| t_y | Translation in y | |
| t_z | Translation in z |
Definition at line 341 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::set_similarity | ( | double | s, | |
| double | r_x, | |||
| double | r_y, | |||
| double | r_z, | |||
| double | t_x, | |||
| double | t_y, | |||
| double | t_z | |||
| ) |
Sets the transformation to be isotropic scaling, followed by rotation, then translation.
The transformation is separable affine.
| s | Scaling factor | |
| r_x | Angle of rotation in x | |
| r_y | Angle of rotation in y | |
| r_z | Angle of rotation in z | |
| t_x | Translation in x | |
| t_y | Translation in y | |
| t_z | Translation in z |
Definition at line 369 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::set_affine | ( | double | s_x, | |
| double | s_y, | |||
| double | s_z, | |||
| double | r_x, | |||
| double | r_y, | |||
| double | r_z, | |||
| double | t_x, | |||
| double | t_y, | |||
| double | t_z | |||
| ) |
Sets the transformation to be a special case of Affine: anisotropic scaling, followed by rotation, then translation.
| s_x | Scaling factor in x | |
| s_y | Scaling factor in y | |
| s_z | Scaling factor in z | |
| r_x | Angle of rotation in x | |
| r_y | Angle of rotation in y | |
| r_z | Angle of rotation in z | |
| t_x | Translation in x | |
| t_y | Translation in y | |
| t_z | Translation in z |
Definition at line 413 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::set_affine | ( | double | s_x, | |
| double | s_y, | |||
| double | s_z, | |||
| vgl_vector_3d< double > | c_x, | |||
| vgl_vector_3d< double > | c_y, | |||
| vgl_vector_3d< double > | c_z, | |||
| double | t_x, | |||
| double | t_y, | |||
| double | t_z | |||
| ) |
Sets the transformation to be a special case of Affine: anisotropic scaling, followed by rotation, then translation.
| s_x | Scaling factor in x | |
| s_y | Scaling factor in y | |
| s_z | Scaling factor in z | |
| c_x | First column of rotation matrix | |
| c_y | Second column of rotation matrix | |
| c_z | Third column of rotation matrix | |
| t_x | Translation in x | |
| t_y | Translation in y | |
| t_z | Translation in z |
Definition at line 439 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::set_affine | ( | const vgl_point_3d< double > & | p, | |
| const vgl_vector_3d< double > & | u, | |||
| const vgl_vector_3d< double > & | v, | |||
| const vgl_vector_3d< double > & | w | |||
| ) |
Sets the transformation to be a special case of Affine.
T(x,y,z) = p +x.u +y.v + z.w
| p | Origin point | |
| u | Vector to which the x-axis is mapped. The length of u indicates scaling in x. | |
| v | Vector to which the y-axis is mapped. The length of v indicates scaling in y. | |
| w | Vector to which the z-axis is mapped. The length of w indicates scaling in z. |
This creates a special case of Affine. Although this special case is separable, in general Affine transformations are not separable.
Definition at line 471 of file vimt3d_transform_3d.cxx.
| vgl_point_3d<double> vimt3d_transform_3d::origin | ( | ) | const [inline] |
| void vimt3d_transform_3d::set_origin | ( | const vgl_point_3d< double > & | ) |
Modifies the transformation so that origin == p.
Modifies the transformation so that operator()(vgl_point_3d<double> (0,0)) == p. The rest of the transformation is unaffected. If the transformation was previously the identity, it becomes a translation.
Definition at line 264 of file vimt3d_transform_3d.cxx.
| vgl_point_3d<double> vimt3d_transform_3d::operator() | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) | const [inline] |
Applies transformation to (x,y,z).
| x | x coordinate | |
| y | y co-ord | |
| z | z co-ord ret: Point = T(x,y,z) |
Definition at line 213 of file vimt3d_transform_3d.h.
| vgl_point_3d<double> vimt3d_transform_3d::operator() | ( | vgl_point_3d< double > | p | ) | const [inline] |
Applies transformation to point p.
| p | Point |
Definition at line 238 of file vimt3d_transform_3d.h.
| vimt3d_transform_3d vimt3d_transform_3d::inverse | ( | ) | const |
Returns the inverse of the current transform.
Definition at line 513 of file vimt3d_transform_3d.cxx.
| vgl_vector_3d<double> vimt3d_transform_3d::delta | ( | vgl_point_3d< double > | , | |
| vgl_vector_3d< double > | dp | |||
| ) | const [inline] |
Returns change in transformed point when original point moved by dp.
| p | point | |
| dp | movement from point |
Definition at line 249 of file vimt3d_transform_3d.h.
| void vimt3d_transform_3d::print_summary | ( | vcl_ostream & | os | ) | const |
Print class to os.
This function prints the extracted params.
Definition at line 721 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::print_all | ( | vcl_ostream & | os | ) | const |
Print class to os.
This function prints the actual parameters xx_,xy_,xz_,xt_, yx_,yy_,yz_,yt_, zx_,zy_,zz_,zt_, tx_,ty_,tz_,tt_
Definition at line 782 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::config | ( | vcl_istream & | is | ) |
Set transformation from stream;.
You can specify the vector as used in the set() operation.
form: rigidbody
vector: { 0.1 0.1 0.1 2 2 2 }
form: rigidbody r_x: 0.1 r_y: 0.1 r_z: 0.1 t_x: 2 t_y: 2 t_z: 2
Definition at line 823 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::b_write | ( | vsl_b_ostream & | bfs | ) | const |
| void vimt3d_transform_3d::b_read | ( | vsl_b_istream & | bfs | ) |
| bool vimt3d_transform_3d::operator== | ( | const vimt3d_transform_3d & | ) | const |
True if t is the same as this.
Definition at line 610 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::calcInverse | ( | ) | const [protected] |
Definition at line 537 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::setCheck | ( | int | n1, | |
| int | n2, | |||
| const char * | str | |||
| ) | const [protected] |
Definition at line 179 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::angles | ( | double & | phi_x, | |
| double & | phi_y, | |||
| double & | phi_z | |||
| ) | const [protected] |
Definition at line 46 of file vimt3d_transform_3d.cxx.
| void vimt3d_transform_3d::setRotMat | ( | double | r_x, | |
| double | r_y, | |||
| double | r_z | |||
| ) | [protected] |
Definition at line 241 of file vimt3d_transform_3d.cxx.
| vimt3d_transform_3d operator * | ( | const vimt3d_transform_3d & | L, | |
| const vimt3d_transform_3d & | R | |||
| ) | [friend] |
Calculates the product LR.
| L | Transform | |
| R | Transform |
full multiplication - inefficient but works for
Definition at line 636 of file vimt3d_transform_3d.cxx.
double vimt3d_transform_3d::xx_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::xy_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::xz_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::xt_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::yx_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::yy_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::yz_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::yt_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::zx_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::zy_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::zz_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::zt_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::tx_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::ty_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::tz_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::tt_ [protected] |
Definition at line 316 of file vimt3d_transform_3d.h.
Form vimt3d_transform_3d::form_ [protected] |
Definition at line 317 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::xx2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::xy2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::xz2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::xt2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::yx2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::yy2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::yz2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::yt2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::zx2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::zy2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::zz2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::zt2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::tx2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::ty2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::tz2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
double vimt3d_transform_3d::tt2_ [mutable, protected] |
Definition at line 321 of file vimt3d_transform_3d.h.
bool vimt3d_transform_3d::inv_uptodate_ [mutable, protected] |
Definition at line 322 of file vimt3d_transform_3d.h.
1.5.1