Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AffineTransf.cpp
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #include "AffineTransf.hh"
27 
28 using namespace BIAS;
29 using namespace std;
30 
32  Matrix3x4<double>(), R_(), C_()
33 {}
34 
36 {}
37 
39 {
40  HomgPoint3D res;
41  Mult(argv, res);
42  return res;
43 }
44 
45 void
47 {
48  destv[0] =
49  v_[0] * argv[0]
50  +v_[1] * argv[1]
51  +v_[2] * argv[2]
52  +v_[3] * argv[3];
53  destv[1] =
54  v_[4] * argv[0]
55  +v_[5] * argv[1]
56  +v_[6] * argv[2]
57  +v_[7] * argv[3];
58  destv[2] =
59  v_[8] * argv[0]
60  +v_[9] * argv[1]
61  +v_[10] * argv[2]
62  +v_[11] * argv[3];
63  // fake last row, affine transf has normaly size 4x4
64  destv[3] = argv[3];
65 }
66 
69 {
70  const double *p = arg.GetData();
71  memcpy(v_, p, 12*sizeof(double));
72  R_ = arg.GetR();
73  C_ = arg.GetC();
74  return *this;
75 }
76 
77 
78 void
80 {
81  double *p = R.GetData();
82  v_[0] = p[0]; v_[1] = p[1]; v_[2] = p[2];
83  v_[4] = p[3]; v_[5] = p[4]; v_[6] = p[5];
84  v_[8] = p[6]; v_[9] = p[7]; v_[10] = p[8];
85  v_[3] = v_[7] = v_[11] = 0.0;
86 }
void SetAsRotationMatrix(Matrix3x3< double > &R)
Vector3< double > GetC() const
Definition: AffineTransf.hh:54
Vector3< double > C_
Definition: AffineTransf.hh:69
T * v_
Definition: cmat.h:87
void Mult(Vector4< double > &argv, Vector4< double > &destv)
args must be of type Vector4&lt;double&gt; because this should work not only for HomgPoint3D but also for H...
class Vector4 contains a Vector of dim.
Definition: Vector4.hh:65
RMatrixBase GetR() const
Definition: AffineTransf.hh:51
T * GetData()
get the pointer to the data array of the matrix (for faster direct memeory access) ...
Definition: Matrix.hh:185
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
Definition: HomgPoint3D.hh:61
is a &#39;fixed size&#39; rectangular matrix of dim.
Definition: Matrix3x3.hh:39
HomgPoint3D operator*(HomgPoint3D &argv)
AffineTransf & operator=(const AffineTransf &arg)
last line of an affine transformation in 3d space is always 0 0 0 1 and can therefor be droped from t...
Definition: AffineTransf.hh:44