Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpRotationMatrix.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2023 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
34#ifndef _vpRotationMatrix_h_
35#define _vpRotationMatrix_h_
36
42#include <visp3/core/vpArray2D.h>
43#include <visp3/core/vpHomogeneousMatrix.h>
44#include <visp3/core/vpPoseVector.h>
45#include <visp3/core/vpQuaternionVector.h>
46#include <visp3/core/vpRxyzVector.h>
47#include <visp3/core/vpRzyxVector.h>
48#include <visp3/core/vpRzyzVector.h>
49#include <visp3/core/vpThetaUVector.h>
50#include <visp3/core/vpTranslationVector.h>
51
117class VISP_EXPORT vpRotationMatrix : public vpArray2D<double>
118{
119public:
122 explicit vpRotationMatrix(const vpHomogeneousMatrix &M);
123 explicit vpRotationMatrix(const vpThetaUVector &r);
124 explicit vpRotationMatrix(const vpPoseVector &p);
125 explicit vpRotationMatrix(const vpRzyzVector &r);
126 explicit vpRotationMatrix(const vpRxyzVector &r);
127 explicit vpRotationMatrix(const vpRzyxVector &r);
128 explicit vpRotationMatrix(const vpQuaternionVector &q);
129 explicit vpRotationMatrix(const vpMatrix &R);
130 vpRotationMatrix(double tux, double tuy, double tuz);
131
132#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
133 explicit vpRotationMatrix(const std::initializer_list<double> &list);
134#endif
135
139 virtual ~vpRotationMatrix() { }
140
141 vpRotationMatrix buildFrom(const vpHomogeneousMatrix &M);
142 vpRotationMatrix buildFrom(const vpThetaUVector &v);
143 vpRotationMatrix buildFrom(const vpPoseVector &p);
144 vpRotationMatrix buildFrom(const vpRzyzVector &v);
145 vpRotationMatrix buildFrom(const vpRxyzVector &v);
146 vpRotationMatrix buildFrom(const vpRzyxVector &v);
147 vpRotationMatrix buildFrom(const vpQuaternionVector &q);
148 vpRotationMatrix buildFrom(double tux, double tuy, double tuz);
149
150 void eye();
151
152 vpColVector getCol(unsigned int j) const;
153 vpThetaUVector getThetaUVector();
154
155 vpRotationMatrix inverse() const;
156 void inverse(vpRotationMatrix &R) const;
157
158 bool isARotationMatrix(double threshold = 1e-6) const;
159
160 // copy operator from vpRotationMatrix
162 // copy operator from vpMatrix (handle with care)
164#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
165 vpRotationMatrix &operator=(const std::initializer_list<double> &list);
166#endif
167 // operation c = A * b (A is unchanged)
169 // operation C = A * B (A is unchanged)
171 // operation C = A * B (A is unchanged)
173 vpMatrix operator*(const vpMatrix &M) const;
174 // operation v2 = A * v1 (A is unchanged)
175 vpColVector operator*(const vpColVector &v) const;
176 vpRotationMatrix operator*(double x) const;
177 vpRotationMatrix &operator*=(double x);
178
179 vpRotationMatrix &operator<<(double val);
180 vpRotationMatrix &operator,(double val);
181
182 void orthogonalize();
183
184 void printVector();
185
191 void resize(unsigned int nrows, unsigned int ncols, bool flagNullify = true)
192 {
193 (void)nrows;
194 (void)ncols;
195 (void)flagNullify;
196 throw(vpException(vpException::fatalError, "Cannot resize a rotation matrix"));
197 }
198
199 // transpose
200 vpRotationMatrix t() const;
201
202 static vpRotationMatrix mean(const std::vector<vpHomogeneousMatrix> &vec_M);
203 static vpRotationMatrix mean(const std::vector<vpRotationMatrix> &vec_R);
204
205#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
214 vp_deprecated void init() { }
218 vp_deprecated void setIdentity();
220#endif
221
222protected:
223 unsigned int m_index;
224};
225
226#ifndef DOXYGEN_SHOULD_SKIP_THIS
227VISP_EXPORT
228#endif
229vpRotationMatrix operator*(const double &x, const vpRotationMatrix &R);
230
231#endif
Implementation of a generic 2D array used as base class for matrices and vectors.
Definition vpArray2D.h:131
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
Definition vpArray2D.h:445
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition vpArray2D.h:529
vpArray2D< Type > t() const
Compute the transpose of the array.
Definition vpArray2D.h:1059
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
Definition vpException.h:59
@ fatalError
Fatal error.
Definition vpException.h:84
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:152
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()
virtual ~vpRotationMatrix()
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true)
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.
vpColVector operator*(const double &x, const vpColVector &v)