Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpRotationMatrix.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Rotation matrix.
32 */
33
38
39#ifndef VP_ROTATION_MATRIX_H
40#define VP_ROTATION_MATRIX_H
41
42#include <visp3/core/vpConfig.h>
43#include <visp3/core/vpArray2D.h>
44#include <visp3/core/vpHomogeneousMatrix.h>
45#include <visp3/core/vpPoseVector.h>
46#include <visp3/core/vpQuaternionVector.h>
47#include <visp3/core/vpRxyzVector.h>
48#include <visp3/core/vpRzyxVector.h>
49#include <visp3/core/vpRzyzVector.h>
50#include <visp3/core/vpThetaUVector.h>
51#include <visp3/core/vpTranslationVector.h>
52
129class VISP_EXPORT vpRotationMatrix : public vpArray2D<double>
130{
131public:
134 VP_EXPLICIT vpRotationMatrix(const vpHomogeneousMatrix &M);
135 VP_EXPLICIT vpRotationMatrix(const vpThetaUVector &r);
136 VP_EXPLICIT vpRotationMatrix(const vpPoseVector &p);
137 VP_EXPLICIT vpRotationMatrix(const vpRzyzVector &r);
138 VP_EXPLICIT vpRotationMatrix(const vpRxyzVector &r);
139 VP_EXPLICIT vpRotationMatrix(const vpRzyxVector &r);
140 VP_EXPLICIT vpRotationMatrix(const vpQuaternionVector &q);
141 VP_EXPLICIT vpRotationMatrix(const vpMatrix &R);
142 vpRotationMatrix(double tux, double tuy, double tuz);
143
144#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
145 VP_EXPLICIT vpRotationMatrix(const std::initializer_list<double> &list);
146#endif
147
155 vpRotationMatrix &buildFrom(const double &tux, const double &tuy, const double &tuz);
156
157 void eye();
158
159 vpColVector getCol(unsigned int j) const;
161
163 void inverse(vpRotationMatrix &R) const;
164
165 bool isARotationMatrix(double threshold = 1e-6) const;
166
167 // copy operator from vpRotationMatrix
169 // copy operator from vpMatrix (handle with care)
171#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
172 vpRotationMatrix &operator=(const std::initializer_list<double> &list);
173#endif
174 // operation c = A * b (A is unchanged)
176 // operation C = A * B (A is unchanged)
178 // operation C = A * B (A is unchanged)
180 vpMatrix operator*(const vpMatrix &M) const;
181 // operation v2 = A * v1 (A is unchanged)
182 vpColVector operator*(const vpColVector &v) const;
183 vpRotationMatrix operator*(double x) const;
184 vpRotationMatrix &operator*=(double x);
185
186 vpRotationMatrix &operator<<(double val);
187 vpRotationMatrix &operator,(double val);
188
189 void orthogonalize();
190
191 void printVector();
192
198 VP_NORETURN void resize(unsigned int nrows, unsigned int ncols, bool flagNullify = true)
199 {
200 (void)nrows;
201 (void)ncols;
202 (void)flagNullify;
203 throw(vpException(vpException::fatalError, "Cannot resize a rotation matrix"));
204 }
205
206 // transpose
207 vpRotationMatrix t() const;
208
209 static vpRotationMatrix mean(const std::vector<vpHomogeneousMatrix> &vec_M);
210 static vpRotationMatrix mean(const std::vector<vpRotationMatrix> &vec_R);
211
212#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
217
221 VP_DEPRECATED void init() { }
225 VP_DEPRECATED void setIdentity();
227#endif
228
229protected:
230 unsigned int m_index;
231private:
232 static const unsigned int constr_val_3;
233};
234
235#ifndef DOXYGEN_SHOULD_SKIP_THIS
236VISP_EXPORT
237#endif
238VISP_NAMESPACE_ADDRESSING vpRotationMatrix operator*(const double &x, const VISP_NAMESPACE_ADDRESSING vpRotationMatrix &R);
239END_VISP_NAMESPACE
240#endif
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
Definition vpArray2D.h:615
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition vpArray2D.h:705
vpArray2D< Type > t() const
Compute the transpose of the array.
Definition vpArray2D.h:1273
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
Definition vpException.h:60
@ fatalError
Fatal error.
Definition vpException.h:72
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
Implementation of a pose vector and operations on poses.
Implementation of a rotation vector as quaternion angle minimal representation.
Implementation of a rotation matrix and operations on such kind of matrices.
VP_DEPRECATED void init()
vpRotationMatrix & operator*=(double x)
bool isARotationMatrix(double threshold=1e-6) const
vpRotationMatrix & operator,(double val)
vpColVector getCol(unsigned int j) const
vpThetaUVector getThetaUVector()
vpRotationMatrix & buildFrom(const vpHomogeneousMatrix &M)
VP_NORETURN void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true)
vpRotationMatrix inverse() const
vpTranslationVector operator*(const vpTranslationVector &tv) const
Implementation of a rotation vector as Euler angle minimal representation.
Implementation of a rotation vector as Euler angle minimal representation.
Implementation of a rotation vector as Euler angle minimal representation.
Implementation of a rotation vector as axis-angle minimal representation.
Class that consider the case of a translation vector.