Visual Servoing Platform  version 3.1.0
vpPoseVector.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Pose object. A pose is a size 6 vector [t, tu]^T where tu is
33  * a rotation vector (theta u representation) and t is a translation vector.
34  *
35  * Authors:
36  * Eric Marchand
37  * Fabien Spindler
38  *
39  *****************************************************************************/
40 
41 #ifndef vpPOSEVECTOR_H
42 #define vpPOSEVECTOR_H
43 
52 class vpRotationMatrix;
55 class vpThetaUVector;
56 class vpRowVector;
57 
58 #include <visp3/core/vpArray2D.h>
59 #include <visp3/core/vpHomogeneousMatrix.h>
60 #include <visp3/core/vpMatrix.h>
61 #include <visp3/core/vpRotationMatrix.h>
62 
92 class VISP_EXPORT vpPoseVector : public vpArray2D<double>
93 {
94 public:
95  // constructor
96  vpPoseVector();
97  // constructor from 3 angles (in radian)
98  vpPoseVector(const double tx, const double ty, const double tz, const double tux, const double tuy, const double tuz);
99  // constructor convert an homogeneous matrix in a pose
100  explicit vpPoseVector(const vpHomogeneousMatrix &M);
101  // constructor convert a translation and a "thetau" vector into a pose
102  vpPoseVector(const vpTranslationVector &tv, const vpThetaUVector &tu);
103  // constructor convert a translation and a rotation matrix into a pose
108  virtual ~vpPoseVector(){};
109 
110  vpPoseVector buildFrom(const double tx, const double ty, const double tz, const double tux, const double tuy,
111  const double tuz);
112  // convert an homogeneous matrix in a pose
113  vpPoseVector buildFrom(const vpHomogeneousMatrix &M);
114  // convert a translation and a "thetau" vector into a pose
115  vpPoseVector buildFrom(const vpTranslationVector &tv, const vpThetaUVector &tu);
116  // convert a translation and a rotation matrix into a pose
117  vpPoseVector buildFrom(const vpTranslationVector &tv, const vpRotationMatrix &R);
118 
119  void extract(vpRotationMatrix &R) const;
120  void extract(vpThetaUVector &tu) const;
121  void extract(vpTranslationVector &tv) const;
122  void extract(vpQuaternionVector &q) const;
123 
124  vpRotationMatrix getRotationMatrix() const;
125  vpThetaUVector getThetaUVector() const;
126  vpTranslationVector getTranslationVector() const;
127 
128  // Load an homogeneous matrix from a file
129  void load(std::ifstream &f);
130 
155  inline double &operator[](unsigned int i) { return *(data + i); }
174  inline const double &operator[](unsigned int i) const { return *(data + i); }
175 
176  // Print a vector [T thetaU] thetaU in degree
177  void print() const;
178  int print(std::ostream &s, unsigned int length, char const *intro = 0) const;
179 
185  void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify = true)
186  {
187  (void)nrows;
188  (void)ncols;
189  (void)flagNullify;
190  throw(vpException(vpException::fatalError, "Cannot resize a pose vector"));
191  };
192 
193  // Save an homogeneous matrix in a file
194  void save(std::ofstream &f) const;
195  void set(const double tx, const double ty, const double tz, const double tux, const double tuy, const double tuz);
196  vpRowVector t() const;
197 
198 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
199 
207  vp_deprecated void init(){};
209 #endif
210 };
211 
212 #endif
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
Definition: vpPoseVector.h:185
static bool save(const std::string &filename, const vpArray2D< Type > &A, const bool binary=false, const char *header="")
Definition: vpArray2D.h:508
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:72
error that can be emited by ViSP classes.
Definition: vpException.h:71
double & operator[](unsigned int i)
Definition: vpPoseVector.h:155
Implementation of a generic 2D array used as vase class of matrices and vectors.
Definition: vpArray2D.h:70
Implementation of a rotation matrix and operations on such kind of matrices.
static bool load(const std::string &filename, vpArray2D< Type > &A, const bool binary=false, char *header=NULL)
Definition: vpArray2D.h:318
const double & operator[](unsigned int i) const
Definition: vpPoseVector.h:174
Implementation of a rotation vector as quaternion angle minimal representation.
virtual ~vpPoseVector()
Definition: vpPoseVector.h:108
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:92
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.
vp_deprecated void init()
Definition: vpPoseVector.h:207