ViSP  2.10.0
vpHomogeneousMatrix.h
1 /****************************************************************************
2  *
3  * $Id: vpHomogeneousMatrix.h 5130 2015-01-06 18:50:43Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Homogeneous matrix.
36  *
37  * Authors:
38  * Eric Marchand
39  *
40  *****************************************************************************/
41 
42 
43 
50 #ifndef VPHOMOGENEOUSMATRIX_HH
51 #define VPHOMOGENEOUSMATRIX_HH
52 
53 class vpPoseVector;
54 class vpMatrix;
55 class vpRotationMatrix;
56 class vpPoseVector;
57 class vpThetaUVector;
58 
59 #include <vector>
60 
61 #include <visp/vpMatrix.h>
62 #include <visp/vpRotationMatrix.h>
63 #include <visp/vpThetaUVector.h>
64 #include <visp/vpTranslationVector.h>
65 #include <visp/vpPoseVector.h>
66 
67 #include <fstream>
68 
69 class vpMatrix;
70 class vpRotationMatrix;
71 class vpPoseVector;
72 class vpThetaUVector;
73 class vpQuaternionVector;
74 
103 class VISP_EXPORT vpHomogeneousMatrix : public vpMatrix
104 {
105  public:
120  vpHomogeneousMatrix(const vpPoseVector &p) ;
121 
123  vpHomogeneousMatrix(const double tx, const double ty, const double tz,
124  const double tux, const double tuy, const double tuz) ;
125  vpHomogeneousMatrix(const std::vector<float> &v);
126  vpHomogeneousMatrix(const std::vector<double> &v);
127 
129  void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R) ;
131  void buildFrom(const vpTranslationVector &t, const vpThetaUVector &tu) ;
133  void buildFrom(const vpTranslationVector &t, const vpQuaternionVector& q) ;
134  void buildFrom(const std::vector<float> &v) ;
135  void buildFrom(const std::vector<double> &v) ;
136 
141  void buildFrom(const vpPoseVector &p) ;
142 
144  void buildFrom(const double tx,const double ty, const double tz,
145  const double tux,const double tuy, const double tuz ) ;
146 
147  void convert(std::vector<float> &M);
148  void convert(std::vector<double> &M);
149 
154  {
156  this->extract(tr);
157  return tr;
158  }
159 // /*!
160 // Return the rotation matrix from the homogeneous transformation matrix.
161 // */
162 // vpThetaUVector getThetaUVector()
163 // vpRotationMatrix getRotationMatrix()
164 // {
165 // vpRotationMatrix R;
166 // this->extract(R);
167 // return R;
168 // }
169 
172 
175 
177  vpColVector operator*(const vpColVector &v) const;
178 
179  // Invert the homogeneous matrix.
180  vpHomogeneousMatrix inverse() const ;
181  // Invert the homogeneous matrix.
182  void inverse(vpHomogeneousMatrix &Mi) const;
183 
184  // Test if the rotational part of the matrix is a rotation matrix.
185  bool isAnHomogeneousMatrix() const ;
186 
187  void insert(const vpRotationMatrix &R) ;
188  void insert(const vpThetaUVector &tu) ;
189  void insert(const vpTranslationVector &t) ;
190  void insert(const vpQuaternionVector &t) ;
191 
192  void extract( vpRotationMatrix &R) const;
193  void extract(vpTranslationVector &t) const;
194  void extract(vpThetaUVector &tu) const;
195  void extract(vpQuaternionVector& q) const;
196 
197  // Load an homogeneous matrix from a file
198  void load(std::ifstream &f) ;
199  // Save an homogeneous matrix in a file
200  void save(std::ofstream &f) const ;
201 
202  // Set to identity
203  void eye();
205  void init() ;
206  // Basic initialisation (identity).
207  void setIdentity() ;
208 
210  void print() ;
211 
212 } ;
213 
214 #endif
215 
216 /*
217  * Local variables:
218  * c-basic-offset: 2
219  * End:
220  */
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
void init()
Initialization of the object matrix.
Definition: vpMatrix.cpp:98
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
int print(std::ostream &s, unsigned int length, char const *intro=0)
Definition: vpMatrix.cpp:2937
The vpRotationMatrix considers the particular case of a rotation matrix.
vpTranslationVector getTranslationVector()
void insert(const vpMatrix &A, const unsigned int r, const unsigned int c)
Definition: vpMatrix.cpp:3291
void setIdentity(const double &val=1.0)
Definition: vpMatrix.cpp:1230
vpMatrix & operator=(const vpMatrix &B)
Copy operator. Allow operation such as A = B.
Definition: vpMatrix.cpp:385
Defines a quaternion and its basic operations.
void eye(unsigned int n)
Definition: vpMatrix.cpp:1252
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
The pose is a complete representation of every rigid motion in the euclidian space.
Definition: vpPoseVector.h:92
vpMatrix operator*(const vpMatrix &B) const
Definition: vpMatrix.cpp:523
Class that consider the case of a translation vector.
Class that consider the case of the parameterization for the rotation.