Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpRotationMatrix.cpp
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
39
40#include <visp3/core/vpMath.h>
41#include <visp3/core/vpMatrix.h>
42
43// Rotation classes
44#include <visp3/core/vpRotationMatrix.h>
45
46// Exception
47#include <visp3/core/vpException.h>
48
49// Debug trace
50#include <math.h>
51
53const unsigned int vpRotationMatrix::constr_val_3 = 3;
60{
61 const unsigned int val_3 = 3;
62 for (unsigned int i = 0; i < val_3; ++i) {
63 for (unsigned int j = 0; j < val_3; ++j) {
64 if (i == j) {
65 (*this)[i][j] = 1.0;
66 }
67 else {
68 (*this)[i][j] = 0.0;
69 }
70 }
71 }
72}
73
84{
85 const unsigned int val_3 = 3;
86 for (unsigned int i = 0; i < val_3; ++i) {
87 for (unsigned int j = 0; j < val_3; ++j) {
88 rowPtrs[i][j] = R.rowPtrs[i][j];
89 }
90 }
91
92 return *this;
93}
94
95#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
123vpRotationMatrix &vpRotationMatrix::operator=(const std::initializer_list<double> &list)
124{
125 if (dsize != static_cast<unsigned int>(list.size())) {
127 "Cannot set a 3-by-3 rotation matrix from a %d-elements list of doubles."));
128 }
129
130 std::copy(list.begin(), list.end(), data);
131
132 if (!isARotationMatrix()) {
133 if (isARotationMatrix(1e-3)) {
135 }
136 else {
137 throw(vpException(
139 "Rotation matrix initialization fails since its elements do not represent a valid rotation matrix"));
140 }
141 }
142
143 return *this;
144}
145#endif
146
164{
165 const unsigned int val_3 = 3;
166 if ((M.getCols() != val_3) && (M.getRows() != val_3)) {
167 throw(vpException(vpException::dimensionError, "Cannot set a (3x3) rotation matrix from a (%dx%d) matrix",
168 M.getRows(), M.getCols()));
169 }
170
171 for (unsigned int i = 0; i < val_3; ++i) {
172 for (unsigned int j = 0; j < val_3; ++j) {
173 (*this)[i][j] = M[i][j];
174 }
175 }
176 if (!isARotationMatrix()) {
177 if (isARotationMatrix(1e-3)) {
179 }
180 else {
181 throw(vpException(vpException::fatalError, "Cannot set a rotation matrix "
182 "from a matrix that is not a "
183 "rotation matrix"));
184 }
185 }
186
187 return *this;
188}
189
222{
223 m_index = 0;
224 data[m_index] = val;
225 return *this;
226}
227
260{
261 ++m_index;
262 if (m_index >= size()) {
264 "Cannot set rotation matrix out of bounds. It has only %d elements while you try to initialize "
265 "with %d elements",
266 size(), m_index + 1));
267 }
268 data[m_index] = val;
269 return *this;
270}
271
276{
278
279 const unsigned int val_3 = 3;
280 for (unsigned int i = 0; i < val_3; ++i) {
281 for (unsigned int j = 0; j < val_3; ++j) {
282 double s = 0;
283 for (unsigned int k = 0; k < val_3; ++k) {
284 s += rowPtrs[i][k] * R.rowPtrs[k][j];
285 }
286 p[i][j] = s;
287 }
288 }
289 return p;
290}
291
310{
311 const unsigned int val_3 = 3;
312 if ((M.getRows() != val_3) || (M.getCols() != val_3)) {
313 throw(vpException(vpException::dimensionError, "Cannot set a (3x3) rotation matrix from a (%dx%d) matrix",
314 M.getRows(), M.getCols()));
315 }
316 vpMatrix p(3, 3);
317
318 for (unsigned int i = 0; i < val_3; ++i) {
319 for (unsigned int j = 0; j < val_3; ++j) {
320 double s = 0;
321 for (unsigned int k = 0; k < val_3; ++k) {
322 s += (*this)[i][k] * M[k][j];
323 }
324 p[i][j] = s;
325 }
326 }
327 return p;
328}
329
348
383{
384 const unsigned int rows_size = 3;
385 if (v.getRows() != rows_size) {
387 "Cannot multiply a (3x3) rotation matrix by a %d "
388 "dimension column vector",
389 v.getRows()));
390 }
391 vpColVector v_out(3);
392
393 for (unsigned int j = 0; j < colNum; ++j) {
394 double vj = v[j]; // optimization em 5/12/2006
395 for (unsigned int i = 0; i < rowNum; ++i) {
396 v_out[i] += rowPtrs[i][j] * vj;
397 }
398 }
399
400 return v_out;
401}
402
408{
410 const unsigned int val_3 = 3;
411
412 for (unsigned int j = 0; j < val_3; ++j) {
413 p[j] = 0;
414 }
415
416 for (unsigned int j = 0; j < val_3; ++j) {
417 for (unsigned int i = 0; i < val_3; ++i) {
418 p[i] += rowPtrs[i][j] * tv[j];
419 }
420 }
421
422 return p;
423}
424
430{
432
433 for (unsigned int i = 0; i < rowNum; ++i) {
434 for (unsigned int j = 0; j < colNum; ++j) {
435 R[i][j] = rowPtrs[i][j] * x;
436 }
437 }
438
439 return R;
440}
441
447{
448 for (unsigned int i = 0; i < rowNum; ++i) {
449 for (unsigned int j = 0; j < colNum; ++j) {
450 rowPtrs[i][j] *= x;
451 }
452 }
453
454 return *this;
455}
456
457/*********************************************************************/
458
465bool vpRotationMatrix::isARotationMatrix(double threshold) const
466{
467 bool isRotation = true;
468 const unsigned int val_3 = 3;
469
470 if ((getCols() != val_3) || (getRows() != val_3)) {
471 return false;
472 }
473
474 // --comment: test R^TR = Id
475 vpRotationMatrix RtR = (*this).t() * (*this);
476 for (unsigned int i = 0; i < val_3; ++i) {
477 for (unsigned int j = 0; j < val_3; ++j) {
478 if (i == j) {
479 if (fabs(RtR[i][j] - 1) > threshold) {
480 isRotation = false;
481 }
482 }
483 else {
484 if (fabs(RtR[i][j]) > threshold) {
485 isRotation = false;
486 }
487 }
488 }
489 }
490 // test if it is a basis
491 // test || Ci || = 1
492 const unsigned int index_2 = 2;
493 for (unsigned int i = 0; i < val_3; ++i) {
494 if ((sqrt(vpMath::sqr(RtR[0][i]) + vpMath::sqr(RtR[1][i]) + vpMath::sqr(RtR[index_2][i])) - 1) > threshold) {
495 isRotation = false;
496 }
497 }
498
499 // test || Ri || = 1
500 for (unsigned int i = 0; i < val_3; ++i) {
501 if ((sqrt(vpMath::sqr(RtR[i][0]) + vpMath::sqr(RtR[i][1]) + vpMath::sqr(RtR[i][index_2])) - 1) > threshold) {
502 isRotation = false;
503 }
504 }
505
506 // test if the basis is orthogonal
507 return isRotation;
508}
509
513vpRotationMatrix::vpRotationMatrix() : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { eye(); }
514
519vpRotationMatrix::vpRotationMatrix(const vpRotationMatrix &M) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { (*this) = M; }
520
524vpRotationMatrix::vpRotationMatrix(const vpHomogeneousMatrix &M) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { buildFrom(M); }
525
530vpRotationMatrix::vpRotationMatrix(const vpThetaUVector &tu) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { buildFrom(tu); }
531
535vpRotationMatrix::vpRotationMatrix(const vpPoseVector &p) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { buildFrom(p); }
536
541vpRotationMatrix::vpRotationMatrix(const vpRzyzVector &euler) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0)
542{
543 buildFrom(euler);
544}
545
550vpRotationMatrix::vpRotationMatrix(const vpRxyzVector &Rxyz) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { buildFrom(Rxyz); }
551
556vpRotationMatrix::vpRotationMatrix(const vpRzyxVector &Rzyx) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { buildFrom(Rzyx); }
557
561vpRotationMatrix::vpRotationMatrix(const vpMatrix &R) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { *this = R; }
562
567vpRotationMatrix::vpRotationMatrix(double tux, double tuy, double tuz) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0)
568{
569 buildFrom(tux, tuy, tuz);
570}
571
575vpRotationMatrix::vpRotationMatrix(const vpQuaternionVector &q) : vpArray2D<double>(constr_val_3, constr_val_3), m_index(0) { buildFrom(q); }
576
577#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
603vpRotationMatrix::vpRotationMatrix(const std::initializer_list<double> &list)
604 : vpArray2D<double>(3, 3, list), m_index(0)
605{
606 if (!isARotationMatrix()) {
607 if (isARotationMatrix(1e-3)) {
609 }
610 else {
611 throw(vpException(
613 "Rotation matrix initialization fails since its elements do not represent a valid rotation matrix"));
614 }
615 }
616}
617#endif
618
626{
628
629 const unsigned int val_3 = 3;
630 for (unsigned int i = 0; i < val_3; ++i) {
631 for (unsigned int j = 0; j < val_3; ++j) {
632 Rt[j][i] = (*this)[i][j];
633 }
634 }
635
636 return Rt;
637}
638
646{
647 vpRotationMatrix Ri = (*this).t();
648
649 return Ri;
650}
651
674
680{
681 vpThetaUVector tu(*this);
682
683 const unsigned int val_3 = 3;
684 for (unsigned int i = 0; i < val_3; ++i) {
685 std::cout << tu[i] << " ";
686 }
687
688 std::cout << std::endl;
689}
690
701{
702 double theta, si, co, sinc, mcosc;
704
705 const unsigned int index_0 = 0;
706 const unsigned int index_1 = 1;
707 const unsigned int index_2 = 2;
708 theta = sqrt((v[index_0] * v[index_0]) + (v[index_1] * v[index_1]) + (v[index_2] * v[index_2]));
709 si = sin(theta);
710 co = cos(theta);
711 sinc = vpMath::sinc(si, theta);
712 mcosc = vpMath::mcosc(co, theta);
713
714 R[index_0][index_0] = co + (mcosc * v[index_0] * v[index_0]);
715 R[index_0][index_1] = (-sinc * v[index_2]) + (mcosc * v[index_0] * v[index_1]);
716 R[index_0][index_2] = (sinc * v[index_1]) + (mcosc * v[index_0] * v[index_2]);
717 R[index_1][index_0] = (sinc * v[index_2]) + (mcosc * v[index_1] * v[index_0]);
718 R[index_1][index_1] = co + (mcosc * v[index_1] * v[index_1]);
719 R[index_1][index_2] = (-sinc * v[index_0]) + (mcosc * v[index_1] * v[index_2]);
720 R[index_2][index_0] = (-sinc * v[index_1]) + (mcosc * v[index_2] * v[index_0]);
721 R[index_2][index_1] = (sinc * v[index_0]) + (mcosc * v[index_2] * v[index_1]);
722 R[index_2][index_2] = co + (mcosc * v[index_2] * v[index_2]);
723
724 const unsigned int val_3 = 3;
725 for (unsigned int i = 0; i < val_3; ++i) {
726 for (unsigned int j = 0; j < val_3; ++j) {
727 (*this)[i][j] = R[i][j];
728 }
729 }
730
731 return *this;
732}
733
738{
739 const unsigned int val_3 = 3;
740 for (unsigned int i = 0; i < val_3; ++i) {
741 for (unsigned int j = 0; j < val_3; ++j) {
742 (*this)[i][j] = M[i][j];
743 }
744 }
745
746 return *this;
747}
748
759
768{
769 double c0, c1, c2, s0, s1, s2;
770 const unsigned int index_0 = 0;
771 const unsigned int index_1 = 1;
772 const unsigned int index_2 = 2;
773
774 c0 = cos(v[index_0]);
775 c1 = cos(v[index_1]);
776 c2 = cos(v[index_2]);
777 s0 = sin(v[index_0]);
778 s1 = sin(v[index_1]);
779 s2 = sin(v[index_2]);
780
781 (*this)[index_0][index_0] = (c0 * c1 * c2) - (s0 * s2);
782 (*this)[index_0][index_1] = (-c0 * c1 * s2) - (s0 * c2);
783 (*this)[index_0][index_2] = c0 * s1;
784 (*this)[index_1][index_0] = (s0 * c1 * c2) + (c0 * s2);
785 (*this)[index_1][index_1] = (-s0 * c1 * s2) + (c0 * c2);
786 (*this)[index_1][index_2] = s0 * s1;
787 (*this)[index_2][index_0] = -s1 * c2;
788 (*this)[index_2][index_1] = s1 * s2;
789 (*this)[index_2][index_2] = c1;
790
791 return *this;
792}
793
803{
804 double c0, c1, c2, s0, s1, s2;
805 const unsigned int index_0 = 0;
806 const unsigned int index_1 = 1;
807 const unsigned int index_2 = 2;
808
809 c0 = cos(v[index_0]);
810 c1 = cos(v[index_1]);
811 c2 = cos(v[index_2]);
812 s0 = sin(v[index_0]);
813 s1 = sin(v[index_1]);
814 s2 = sin(v[index_2]);
815
816 (*this)[index_0][index_0] = c1 * c2;
817 (*this)[index_0][index_1] = -c1 * s2;
818 (*this)[index_0][index_2] = s1;
819 (*this)[index_1][index_0] = (c0 * s2) + (s0 * s1 * c2);
820 (*this)[index_1][index_1] = (c0 * c2) - (s0 * s1 * s2);
821 (*this)[index_1][index_2] = -s0 * c1;
822 (*this)[index_2][index_0] = (-c0 * s1 * c2) + (s0 * s2);
823 (*this)[index_2][index_1] = (c0 * s1 * s2) + (c2 * s0);
824 (*this)[index_2][index_2] = c0 * c1;
825
826 return *this;
827}
828
836{
837 double c0, c1, c2, s0, s1, s2;
838 const unsigned int index_0 = 0;
839 const unsigned int index_1 = 1;
840 const unsigned int index_2 = 2;
841
842 c0 = cos(v[index_0]);
843 c1 = cos(v[index_1]);
844 c2 = cos(v[index_2]);
845 s0 = sin(v[index_0]);
846 s1 = sin(v[index_1]);
847 s2 = sin(v[index_2]);
848
849 (*this)[index_0][index_0] = c0 * c1;
850 (*this)[index_0][index_1] = (c0 * s1 * s2) - (s0 * c2);
851 (*this)[index_0][index_2] = (c0 * s1 * c2) + (s0 * s2);
852
853 (*this)[index_1][index_0] = s0 * c1;
854 (*this)[index_1][index_1] = (s0 * s1 * s2) + (c0 * c2);
855 (*this)[index_1][index_2] = (s0 * s1 * c2) - (c0 * s2);
856
857 (*this)[index_2][index_0] = -s1;
858 (*this)[index_2][index_1] = c1 * s2;
859 (*this)[index_2][index_2] = c1 * c2;
860
861 return *this;
862}
863
868vpRotationMatrix &vpRotationMatrix::buildFrom(const double &tux, const double &tuy, const double &tuz)
869{
870 vpThetaUVector tu(tux, tuy, tuz);
871 buildFrom(tu);
872 return *this;
873}
874
879{
880 double a = q.w();
881 double b = q.x();
882 double c = q.y();
883 double d = q.z();
884 const unsigned int index_0 = 0;
885 const unsigned int index_1 = 1;
886 const unsigned int index_2 = 2;
887 (*this)[index_0][index_0] = (((a * a) + (b * b)) - (c * c)) - (d * d);
888 (*this)[index_0][index_1] = (2.0 * b * c) - (2.0 * a * d);
889 (*this)[index_0][index_2] = (2.0 * a * c) + (2.0 * b * d);
890
891 (*this)[index_1][index_0] = (2.0 * a * d) + (2.0 * b * c);
892 (*this)[index_1][index_1] = (((a * a) - (b * b)) + (c * c)) - (d * d);
893 (*this)[index_1][index_2] = (2.0 * c * d) - (2.0 * a * b);
894
895 (*this)[index_2][index_0] = (2.0 * b * d) - (2.0 * a * c);
896 (*this)[index_2][index_1] = (2.0 * a * b) + (2.0 * c * d);
897 (*this)[index_2][index_2] = ((a * a) - (b * b) - (c * c)) + (d * d);
898 return *this;
899}
900
906{
908 tu.buildFrom(*this);
909 return tu;
910}
911
944{
945 if (j >= getCols()) {
946 throw(vpException(vpException::dimensionError, "Unable to extract a column vector from the homogeneous matrix"));
947 }
948 unsigned int nb_rows = getRows();
949 vpColVector c(nb_rows);
950 for (unsigned int i = 0; i < nb_rows; ++i) {
951 c[i] = (*this)[i][j];
952 }
953 return c;
954}
955
965vpRotationMatrix vpRotationMatrix::mean(const std::vector<vpHomogeneousMatrix> &vec_M)
966{
967 vpMatrix meanR(3, 3);
969 size_t vec_m_size = vec_M.size();
970 for (size_t i = 0; i < vec_m_size; ++i) {
971 R = vec_M[i].getRotationMatrix();
972 meanR += static_cast<vpMatrix>(R);
973 }
974 meanR /= static_cast<double>(vec_M.size());
975
976 // Euclidean mean of the rotation matrix following Moakher's method (SIAM 2002)
977 vpMatrix M, U, V;
978 vpColVector sv;
979 meanR.pseudoInverse(M, sv, 1e-6, U, V);
980 const unsigned int index_0 = 0;
981 const unsigned int index_1 = 1;
982 const unsigned int index_2 = 2;
983 double det = sv[index_0] * sv[index_1] * sv[index_2];
984 if (det > 0) {
985 meanR = U * V.t();
986 }
987 else {
988 vpMatrix D(3, 3);
989 D = 0.0;
990 D[index_0][index_0] = 1.0;
991 D[index_1][index_1] = 1.0;
992 D[index_2][index_2] = -1;
993 meanR = U * D * V.t();
994 }
995
996 R = meanR;
997 return R;
998}
999
1008vpRotationMatrix vpRotationMatrix::mean(const std::vector<vpRotationMatrix> &vec_R)
1009{
1010 vpMatrix meanR(3, 3);
1012 size_t vec_r_size = vec_R.size();
1013 for (size_t i = 0; i < vec_r_size; ++i) {
1014 meanR += static_cast<vpMatrix>(vec_R[i]);
1015 }
1016 meanR /= static_cast<double>(vec_R.size());
1017
1018 // Euclidean mean of the rotation matrix following Moakher's method (SIAM 2002)
1019 vpMatrix M, U, V;
1020 vpColVector sv;
1021 meanR.pseudoInverse(M, sv, 1e-6, U, V);
1022 const unsigned int index_0 = 0;
1023 const unsigned int index_1 = 1;
1024 const unsigned int index_2 = 2;
1025 double det = sv[index_0] * sv[index_1] * sv[index_2];
1026 if (det > 0) {
1027 meanR = U * V.t();
1028 }
1029 else {
1030 vpMatrix D(3, 3);
1031 D = 0.0;
1032 D[index_0][index_0] = 1.0;
1033 D[index_1][index_1] = 1.0;
1034 D[index_2][index_2] = -1;
1035 meanR = U * D * V.t();
1036 }
1037
1038 R = meanR;
1039 return R;
1040}
1041
1046{
1047 vpMatrix U(*this);
1048 vpColVector w;
1049 vpMatrix V;
1050 U.svd(w, V);
1051 vpMatrix Vt = V.t();
1052 vpMatrix R = U * Vt;
1053 const unsigned int index_0 = 0;
1054 const unsigned int index_1 = 1;
1055 const unsigned int index_2 = 2;
1056 const unsigned int index_3 = 3;
1057 const unsigned int index_4 = 4;
1058 const unsigned int index_5 = 5;
1059 const unsigned int index_6 = 6;
1060 const unsigned int index_7 = 7;
1061 const unsigned int index_8 = 8;
1062
1063 double det = R.det();
1064 if (det < 0) {
1065 Vt[index_2][index_0] *= -1;
1066 Vt[index_2][index_1] *= -1;
1067 Vt[index_2][index_2] *= -1;
1068
1069 R = U * Vt;
1070 }
1071
1072 data[index_0] = R[index_0][index_0];
1073 data[index_1] = R[index_0][index_1];
1074 data[index_2] = R[index_0][index_2];
1075 data[index_3] = R[index_1][index_0];
1076 data[index_4] = R[index_1][index_1];
1077 data[index_5] = R[index_1][index_2];
1078 data[index_6] = R[index_2][index_0];
1079 data[index_7] = R[index_2][index_1];
1080 data[index_8] = R[index_2][index_2];
1081}
1082
1083#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
1084
1093
1094#endif //#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
1095
1099vpRotationMatrix operator*(const double &x, const vpRotationMatrix &R)
1100{
1102
1103 unsigned int Rrow = R.getRows();
1104 unsigned int Rcol = R.getCols();
1105
1106 for (unsigned int i = 0; i < Rrow; ++i) {
1107 for (unsigned int j = 0; j < Rcol; ++j) {
1108 C[i][j] = R[i][j] * x;
1109 }
1110 }
1111
1112 return C;
1113}
1114END_VISP_NAMESPACE
unsigned int getCols() const
Definition vpArray2D.h:423
unsigned int rowNum
Definition vpArray2D.h:1201
unsigned int dsize
Definition vpArray2D.h:1207
unsigned int size() const
Definition vpArray2D.h:435
unsigned int getRows() const
Definition vpArray2D.h:433
unsigned int colNum
Definition vpArray2D.h:1203
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
Definition vpException.h:60
@ dimensionError
Bad dimension.
Definition vpException.h:71
@ fatalError
Fatal error.
Definition vpException.h:72
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpRotationMatrix getRotationMatrix() const
vpTranslationVector getTranslationVector() const
static double sinc(double x)
Definition vpMath.cpp:289
static double sqr(double x)
Definition vpMath.h:203
static double mcosc(double cosx, double x)
Definition vpMath.cpp:254
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
void svd(vpColVector &w, vpMatrix &V)
vpMatrix pseudoInverse(double svThreshold=1e-6) const
vpMatrix t() const
Implementation of a pose vector and operations on poses.
Implementation of a rotation vector as quaternion angle minimal representation.
const double & z() const
Returns the z-component of the quaternion.
const double & x() const
Returns the x-component of the quaternion.
const double & y() const
Returns the y-component of the quaternion.
const double & w() const
Returns the w-component of the quaternion.
Implementation of a rotation matrix and operations on such kind of matrices.
VP_DEPRECATED void setIdentity()
vpRotationMatrix & operator*=(double x)
bool isARotationMatrix(double threshold=1e-6) const
vpRotationMatrix & operator,(double val)
vpColVector getCol(unsigned int j) const
vpThetaUVector getThetaUVector()
vpRotationMatrix & operator<<(double val)
vpRotationMatrix & buildFrom(const vpHomogeneousMatrix &M)
vpRotationMatrix t() const
vpRotationMatrix inverse() const
vpTranslationVector operator*(const vpTranslationVector &tv) const
static vpRotationMatrix mean(const std::vector< vpHomogeneousMatrix > &vec_M)
vpRotationMatrix & operator=(const vpRotationMatrix &R)
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.