Visual Servoing Platform  version 3.1.0
vpRotationMatrix.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  * Rotation matrix.
33  *
34  * Authors:
35  * Eric Marchand
36  *
37  *****************************************************************************/
38 
39 #ifndef vpROTATIONMATRIX_H
40 #define vpROTATIONMATRIX_H
41 
47 #include <visp3/core/vpArray2D.h>
48 #include <visp3/core/vpHomogeneousMatrix.h>
49 #include <visp3/core/vpPoseVector.h>
50 #include <visp3/core/vpQuaternionVector.h>
51 #include <visp3/core/vpRxyzVector.h>
52 #include <visp3/core/vpRzyxVector.h>
53 #include <visp3/core/vpRzyzVector.h>
54 #include <visp3/core/vpThetaUVector.h>
55 #include <visp3/core/vpTranslationVector.h>
56 
71 class VISP_EXPORT vpRotationMatrix : public vpArray2D<double>
72 {
73 public:
76  explicit vpRotationMatrix(const vpHomogeneousMatrix &M);
77  explicit vpRotationMatrix(const vpThetaUVector &r);
78  explicit vpRotationMatrix(const vpPoseVector &p);
79  explicit vpRotationMatrix(const vpRzyzVector &r);
80  explicit vpRotationMatrix(const vpRxyzVector &r);
81  explicit vpRotationMatrix(const vpRzyxVector &r);
82  explicit vpRotationMatrix(const vpQuaternionVector &q);
83  vpRotationMatrix(const double tux, const double tuy, const double tuz);
87  virtual ~vpRotationMatrix(){};
88 
89  vpRotationMatrix buildFrom(const vpHomogeneousMatrix &M);
90  vpRotationMatrix buildFrom(const vpThetaUVector &v);
91  vpRotationMatrix buildFrom(const vpPoseVector &p);
92  vpRotationMatrix buildFrom(const vpRzyzVector &v);
93  vpRotationMatrix buildFrom(const vpRxyzVector &v);
94  vpRotationMatrix buildFrom(const vpRzyxVector &v);
95  vpRotationMatrix buildFrom(const vpQuaternionVector &q);
96  vpRotationMatrix buildFrom(const double tux, const double tuy, const double tuz);
97 
98  void eye();
99 
100  vpColVector getCol(const unsigned int j) const;
101  vpThetaUVector getThetaUVector();
102 
103  vpRotationMatrix inverse() const;
104  void inverse(vpRotationMatrix &R) const;
105 
106  bool isARotationMatrix() const;
107 
108  // copy operator from vpRotationMatrix
110  // copy operator from vpMatrix (handle with care)
112  // operation c = A * b (A is unchanged)
114  // operation C = A * B (A is unchanged)
115  vpRotationMatrix operator*(const vpRotationMatrix &R) const;
116  // operation C = A * B (A is unchanged)
117  vpMatrix operator*(const vpMatrix &M) const;
118  // operation v2 = A * v1 (A is unchanged)
119  vpColVector operator*(const vpColVector &v) const;
120  vpRotationMatrix operator*(const double x) const;
121  vpRotationMatrix &operator*=(const double x);
122 
123  void printVector();
124 
130  void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify = true)
131  {
132  (void)nrows;
133  (void)ncols;
134  (void)flagNullify;
135  throw(vpException(vpException::fatalError, "Cannot resize a rotation matrix"));
136  };
137 
138  // transpose
139  vpRotationMatrix t() const;
140 
141 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
142 
150  vp_deprecated void init(){};
154  vp_deprecated void setIdentity();
156 #endif
157 
158 private:
159  static const double threshold;
160 };
161 
162 #ifndef DOXYGEN_SHOULD_SKIP_THIS
163 VISP_EXPORT
164 #endif
165 vpRotationMatrix operator*(const double &x, const vpRotationMatrix &R);
166 
167 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
Definition: vpArray2D.h:244
Implementation of an homogeneous matrix and operations on such kind of matrices.
error that can be emited by ViSP classes.
Definition: vpException.h:71
Implementation of a generic 2D array used as vase class of matrices and vectors.
Definition: vpArray2D.h:70
Implementation of a rotation vector as Euler angle minimal representation.
Definition: vpRzyxVector.h:158
Implementation of a rotation matrix and operations on such kind of matrices.
virtual ~vpRotationMatrix()
vpColVector operator*(const double &x, const vpColVector &v)
vp_deprecated void init()
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
Implementation of a rotation vector as quaternion angle minimal representation.
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:92
Implementation of a rotation vector as Euler angle minimal representation.
Definition: vpRxyzVector.h:156
Implementation of a rotation vector as Euler angle minimal representation.
Definition: vpRzyzVector.h:154
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.