121 cMatrix3d(
const Eigen::Matrix3d& a_matrix)
123 (*this)(0,0) = a_matrix(0,0);
124 (*this)(0,1) = a_matrix(0,1);
125 (*this)(0,2) = a_matrix(0,2);
126 (*this)(1,0) = a_matrix(1,0);
127 (*this)(1,1) = a_matrix(1,1);
128 (*this)(1,2) = a_matrix(1,2);
129 (*this)(2,0) = a_matrix(2,0);
130 (*this)(2,1) = a_matrix(2,1);
131 (*this)(2,2) = a_matrix(2,2);
151 cMatrix3d(
const double& a_m00,
const double& a_m01,
const double& a_m02,
152 const double& a_m10,
const double& a_m11,
const double& a_m12,
153 const double& a_m20,
const double& a_m21,
const double& a_m22)
155 (*this)(0,0) = a_m00; (*this)(0,1) = a_m01; (*this)(0,2) = a_m02;
156 (*this)(1,0) = a_m10; (*this)(1,1) = a_m11; (*this)(1,2) = a_m12;
157 (*this)(2,0) = a_m20; (*this)(2,1) = a_m21; (*this)(2,2) = a_m22;
175 (*this).setCol0(a_colVector0);
176 (*this).setCol1(a_colVector1);
177 (*this).setCol2(a_colVector2);
192 cMatrix3d(
const Eigen::Vector3d& a_colVector0,
193 const Eigen::Vector3d& a_colVector1,
194 const Eigen::Vector3d& a_colVector2)
196 (*this)(0,0) = a_colVector0(0); (*this)(0,1) = a_colVector1(0); (*this)(0,2) = a_colVector2(0);
197 (*this)(1,0) = a_colVector0(1); (*this)(1,1) = a_colVector1(1); (*this)(1,2) = a_colVector2(1);
198 (*this)(2,0) = a_colVector0(2); (*this)(2,1) = a_colVector1(2); (*this)(2,2) = a_colVector2(2);
223 const double& a_angle2,
224 const double& a_angle3,
226 const bool a_useIntrinsicEulerModel =
true,
227 const bool a_anglesDefinedInDegrees =
false)
229 if (a_anglesDefinedInDegrees)
231 if (a_useIntrinsicEulerModel)
242 if (a_useIntrinsicEulerModel)
265 const double& a_angleRad)
283 const double& a_axisY,
284 const double& a_axisZ,
285 const double& a_angleRad)
297 Eigen::Matrix3d eigen()
300 m(0,0) = (*this)(0,0);
301 m(0,1) = (*this)(0,1);
302 m(0,2) = (*this)(0,2);
303 m(1,0) = (*this)(1,0);
304 m(1,1) = (*this)(1,1);
305 m(1,2) = (*this)(1,2);
306 m(2,0) = (*this)(2,0);
307 m(2,1) = (*this)(2,1);
308 m(2,2) = (*this)(2,2);
327 (*this)(0,0) = 1.0; (*this)(0,1) = 0.0; (*this)(0,2) = 0.0;
328 (*this)(1,0) = 0.0; (*this)(1,1) = 1.0; (*this)(1,2) = 0.0;
329 (*this)(2,0) = 0.0; (*this)(2,1) = 0.0; (*this)(2,2) = 1.0;
345 inline void set(
const double& a_value)
347 (*this)(0,0) = a_value; (*this)(0,1) = a_value; (*this)(0,2) = a_value;
348 (*this)(1,0) = a_value; (*this)(1,1) = a_value; (*this)(1,2) = a_value;
349 (*this)(2,0) = a_value; (*this)(2,1) = a_value; (*this)(2,2) = a_value;
365 inline void set(
const double a_source[3][3])
367 (*this)(0,0) = a_source[0][0];
368 (*this)(0,1) = a_source[0][1];
369 (*this)(0,2) = a_source[0][2];
370 (*this)(1,0) = a_source[1][0];
371 (*this)(1,1) = a_source[1][1];
372 (*this)(1,2) = a_source[1][2];
373 (*this)(2,0) = a_source[2][0];
374 (*this)(2,1) = a_source[2][1];
375 (*this)(2,2) = a_source[2][2];
400 inline void set(
const double& a_m00,
const double& a_m01,
const double& a_m02,
401 const double& a_m10,
const double& a_m11,
const double& a_m12,
402 const double& a_m20,
const double& a_m21,
const double& a_m22)
404 (*this)(0,0) = a_m00; (*this)(0,1) = a_m01; (*this)(0,2) = a_m02;
405 (*this)(1,0) = a_m10; (*this)(1,1) = a_m11; (*this)(1,2) = a_m12;
406 (*this)(2,0) = a_m20; (*this)(2,1) = a_m21; (*this)(2,2) = a_m22;
433 (*this)(0,0) = a_vectCol0(0); (*this)(0,1) = a_vectCol1(0); (*this)(0,2) = a_vectCol2(0);
434 (*this)(1,0) = a_vectCol0(1); (*this)(1,1) = a_vectCol1(1); (*this)(1,2) = a_vectCol2(1);
435 (*this)(2,0) = a_vectCol0(2); (*this)(2,1) = a_vectCol1(2); (*this)(2,2) = a_vectCol2(2);
453 (*this)(0,0) = a_vectCol(0);
454 (*this)(1,0) = a_vectCol(1);
455 (*this)(2,0) = a_vectCol(2);
473 (*this)(0,1) = a_vectCol(0);
474 (*this)(1,1) = a_vectCol(1);
475 (*this)(2,1) = a_vectCol(2);
493 (*this)(0,2) = a_vectCol(0);
494 (*this)(1,2) = a_vectCol(1);
495 (*this)(2,2) = a_vectCol(2);
511 inline void get(
double* a_destination[])
513 *a_destination[0] = (*this)(0,0);
514 *a_destination[1] = (*this)(0,1);
515 *a_destination[2] = (*this)(0,2);
516 *a_destination[3] = (*this)(1,0);
517 *a_destination[4] = (*this)(1,1);
518 *a_destination[5] = (*this)(1,2);
519 *a_destination[6] = (*this)(2,0);
520 *a_destination[7] = (*this)(2,1);
521 *a_destination[8] = (*this)(2,2);
539 result(0) = (*this)(0,0);
540 result(1) = (*this)(1,0);
541 result(2) = (*this)(2,0);
560 result(0) = (*this)(0,1);
561 result(1) = (*this)(1,1);
562 result(2) = (*this)(2,1);
581 result(0) = (*this)(0,2);
582 result(1) = (*this)(1,2);
583 result(2) = (*this)(2,2);
605 result(0) = (*this)(a_index, 0);
606 result(1) = (*this)(a_index, 1);
607 result(2) = (*this)(a_index, 2);
630 a_destination = (*this);
651 inline void copyto(Eigen::Matrix3d& a_destination)
const 653 a_destination(0,0) = (*this)(0,0); a_destination(0,1) = (*this)(0,1); a_destination(0,2) = (*this)(0,2);
654 a_destination(1,0) = (*this)(1,0); a_destination(1,1) = (*this)(1,1); a_destination(1,2) = (*this)(1,2);
655 a_destination(2,0) = (*this)(2,0); a_destination(2,1) = (*this)(2,1); a_destination(2,2) = (*this)(2,2);
698 inline void copyfrom(
const Eigen::Matrix3d& a_source)
700 (*this)(0,0) = a_source(0,0); (*this)(0,1) = a_source(0,1); (*this)(0,2) = a_source(0,2);
701 (*this)(1,0) = a_source(1,0); (*this)(1,1) = a_source(1,1); (*this)(1,2) = a_source(1,2);
702 (*this)(2,0) = a_source(2,0); (*this)(2,1) = a_source(2,1); (*this)(2,2) = a_source(2,2);
724 for(
int i=0; i<3; i++)
726 for(
int j=0; j<3; j++)
728 if (a_matrix(i,j) != (*
this)(i,j))
return (
false);
754 (*this)(0,0) = (*
this)(0,0) + a_matrix(0,0);
755 (*this)(0,1) = (*
this)(0,1) + a_matrix(0,1);
756 (*this)(0,2) = (*
this)(0,2) + a_matrix(0,2);
757 (*this)(1,0) = (*
this)(1,0) + a_matrix(1,0);
758 (*this)(1,1) = (*
this)(1,1) + a_matrix(1,1);
759 (*this)(1,2) = (*
this)(1,2) + a_matrix(1,2);
760 (*this)(2,0) = (*
this)(2,0) + a_matrix(2,0);
761 (*this)(2,1) = (*
this)(2,1) + a_matrix(2,1);
762 (*this)(2,2) = (*
this)(2,2) + a_matrix(2,2);
788 a_result(0,0) = (*this)(0,0) + a_matrix(0,0);
789 a_result(0,1) = (*this)(0,1) + a_matrix(0,1);
790 a_result(0,2) = (*this)(0,2) + a_matrix(0,2);
791 a_result(1,0) = (*this)(1,0) + a_matrix(1,0);
792 a_result(1,1) = (*this)(1,1) + a_matrix(1,1);
793 a_result(1,2) = (*this)(1,2) + a_matrix(1,2);
794 a_result(2,0) = (*this)(2,0) + a_matrix(2,0);
795 a_result(2,1) = (*this)(2,1) + a_matrix(2,1);
796 a_result(2,2) = (*this)(2,2) + a_matrix(2,2);
819 (*this)(0,0) = (*
this)(0,0) - a_matrix(0,0);
820 (*this)(0,1) = (*
this)(0,1) - a_matrix(0,1);
821 (*this)(0,2) = (*
this)(0,2) - a_matrix(0,2);
822 (*this)(1,0) = (*
this)(1,0) - a_matrix(1,0);
823 (*this)(1,1) = (*
this)(1,1) - a_matrix(1,1);
824 (*this)(1,2) = (*
this)(1,2) - a_matrix(1,2);
825 (*this)(2,0) = (*
this)(2,0) - a_matrix(2,0);
826 (*this)(2,1) = (*
this)(2,1) - a_matrix(2,1);
827 (*this)(2,2) = (*
this)(2,2) - a_matrix(2,2);
853 a_result(0,0) = (*this)(0,0) - a_matrix(0,0);
854 a_result(0,1) = (*this)(0,1) - a_matrix(0,1);
855 a_result(0,2) = (*this)(0,2) - a_matrix(0,2);
856 a_result(1,0) = (*this)(1,0) - a_matrix(1,0);
857 a_result(1,1) = (*this)(1,1) - a_matrix(1,1);
858 a_result(1,2) = (*this)(1,2) - a_matrix(1,2);
859 a_result(2,0) = (*this)(2,0) - a_matrix(2,0);
860 a_result(2,1) = (*this)(2,1) - a_matrix(2,1);
861 a_result(2,2) = (*this)(2,2) - a_matrix(2,2);
886 double m00 = (*this)(0,0) * a_matrix(0,0) + (*this)(0,1) * a_matrix(1,0) + (*this)(0,2) * a_matrix(2,0);
887 double m01 = (*this)(0,0) * a_matrix(0,1) + (*this)(0,1) * a_matrix(1,1) + (*this)(0,2) * a_matrix(2,1);
888 double m02 = (*this)(0,0) * a_matrix(0,2) + (*this)(0,1) * a_matrix(1,2) + (*this)(0,2) * a_matrix(2,2);
889 double m10 = (*this)(1,0) * a_matrix(0,0) + (*this)(1,1) * a_matrix(1,0) + (*this)(1,2) * a_matrix(2,0);
890 double m11 = (*this)(1,0) * a_matrix(0,1) + (*this)(1,1) * a_matrix(1,1) + (*this)(1,2) * a_matrix(2,1);
891 double m12 = (*this)(1,0) * a_matrix(0,2) + (*this)(1,1) * a_matrix(1,2) + (*this)(1,2) * a_matrix(2,2);
892 double m20 = (*this)(2,0) * a_matrix(0,0) + (*this)(2,1) * a_matrix(1,0) + (*this)(2,2) * a_matrix(2,0);
893 double m21 = (*this)(2,0) * a_matrix(0,1) + (*this)(2,1) * a_matrix(1,1) + (*this)(2,2) * a_matrix(2,1);
894 double m22 = (*this)(2,0) * a_matrix(0,2) + (*this)(2,1) * a_matrix(1,2) + (*this)(2,2) * a_matrix(2,2);
897 (*this)(0,0) = m00; (*this)(0,1) = m01; (*this)(0,2) = m02;
898 (*this)(1,0) = m10; (*this)(1,1) = m11; (*this)(1,2) = m12;
899 (*this)(2,0) = m20; (*this)(2,1) = m21; (*this)(2,2) = m22;
926 a_result(0,0) = (*this)(0,0) * a_matrix(0,0) + (*this)(0,1) * a_matrix(1,0) + (*this)(0,2) * a_matrix(2,0);
927 a_result(0,1) = (*this)(0,0) * a_matrix(0,1) + (*this)(0,1) * a_matrix(1,1) + (*this)(0,2) * a_matrix(2,1);
928 a_result(0,2) = (*this)(0,0) * a_matrix(0,2) + (*this)(0,1) * a_matrix(1,2) + (*this)(0,2) * a_matrix(2,2);
929 a_result(1,0) = (*this)(1,0) * a_matrix(0,0) + (*this)(1,1) * a_matrix(1,0) + (*this)(1,2) * a_matrix(2,0);
930 a_result(1,1) = (*this)(1,0) * a_matrix(0,1) + (*this)(1,1) * a_matrix(1,1) + (*this)(1,2) * a_matrix(2,1);
931 a_result(1,2) = (*this)(1,0) * a_matrix(0,2) + (*this)(1,1) * a_matrix(1,2) + (*this)(1,2) * a_matrix(2,2);
932 a_result(2,0) = (*this)(2,0) * a_matrix(0,0) + (*this)(2,1) * a_matrix(1,0) + (*this)(2,2) * a_matrix(2,0);
933 a_result(2,1) = (*this)(2,0) * a_matrix(0,1) + (*this)(2,1) * a_matrix(1,1) + (*this)(2,2) * a_matrix(2,1);
934 a_result(2,2) = (*this)(2,0) * a_matrix(0,2) + (*this)(2,1) * a_matrix(1,2) + (*this)(2,2) * a_matrix(2,2);
959 double x = (*this)(0,0) * a_vector(0) + (*this)(0,1) * a_vector(1) + (*this)(0,2) * a_vector(2);
960 double y = (*this)(1,0) * a_vector(0) + (*this)(1,1) * a_vector(1) + (*this)(1,2) * a_vector(2);
961 double z = (*this)(2,0) * a_vector(0) + (*this)(2,1) * a_vector(1) + (*this)(2,2) * a_vector(2);
988 a_result(0) = (*this)(0,0) * a_vector(0) + (*this)(0,1) * a_vector(1) + (*this)(0,2) * a_vector(2);
989 a_result(1) = (*this)(1,0) * a_vector(0) + (*this)(1,1) * a_vector(1) + (*this)(1,2) * a_vector(2);
990 a_result(2) = (*this)(2,0) * a_vector(0) + (*this)(2,1) * a_vector(1) + (*this)(2,2) * a_vector(2);
1007 return (+ (*
this)(0,0) * (*
this)(1,1) * (*
this)(2,2)
1008 + (*
this)(0,1) * (*
this)(1,2) * (*
this)(2,0)
1009 + (*
this)(0,2) * (*
this)(1,0) * (*
this)(2,1)
1010 - (*
this)(2,0) * (*
this)(1,1) * (*
this)(0,2)
1011 - (*
this)(2,1) * (*
this)(1,2) * (*
this)(0,0)
1012 - (*
this)(2,2) * (*
this)(1,0) * (*
this)(0,1));
1030 t = (*this)(0,1); (*this)(0,1) = (*
this)(1,0); (*this)(1,0) = t;
1031 t = (*this)(0,2); (*this)(0,2) = (*
this)(2,0); (*this)(2,0) = t;
1032 t = (*this)(1,2); (*this)(1,2) = (*
this)(2,1); (*this)(2,1) = t;
1051 a_result(0,0) = (*this)(0,0);
1052 a_result(0,1) = (*this)(1,0);
1053 a_result(0,2) = (*this)(2,0);
1055 a_result(1,0) = (*this)(0,1);
1056 a_result(1,1) = (*this)(1,1);
1057 a_result(1,2) = (*this)(2,1);
1059 a_result(2,0) = (*this)(0,2);
1060 a_result(2,1) = (*this)(1,2);
1061 a_result(2,2) = (*this)(2,2);
1080 double d = ( + (*this)(0,0) * (*
this)(1,1) * (*
this)(2,2)
1081 + (*
this)(0,1) * (*
this)(1,2) * (*
this)(2,0)
1082 + (*
this)(0,2) * (*
this)(1,0) * (*
this)(2,1)
1083 - (*
this)(2,0) * (*
this)(1,1) * (*
this)(0,2)
1084 - (*
this)(2,1) * (*
this)(1,2) * (*
this)(0,0)
1085 - (*
this)(2,2) * (*
this)(1,0) * (*
this)(0,1));
1096 double m00 = ((*this)(1,1) * (*
this)(2,2) - (*
this)(2,1)*(*
this)(1,2)) / d;
1097 double m01 = -((*this)(0,1) * (*
this)(2,2) - (*
this)(2,1)*(*
this)(0,2)) / d;
1098 double m02 = ((*this)(0,1) * (*
this)(1,2) - (*
this)(1,1)*(*
this)(0,2)) / d;
1100 double m10 = -((*this)(1,0) * (*
this)(2,2) - (*
this)(2,0)*(*
this)(1,2)) / d;
1101 double m11 = ((*this)(0,0) * (*
this)(2,2) - (*
this)(2,0)*(*
this)(0,2)) / d;
1102 double m12 = -((*this)(0,0) * (*
this)(1,2) - (*
this)(1,0)*(*
this)(0,2)) / d;
1104 double m20 = ((*this)(1,0) * (*
this)(2,1) - (*
this)(2,0)*(*
this)(1,1)) / d;
1105 double m21 = -((*this)(0,0) * (*
this)(2,1) - (*
this)(2,0)*(*
this)(0,1)) / d;
1106 double m22 = ((*this)(0,0) * (*
this)(1,1) - (*
this)(1,0)*(*
this)(0,1)) / d;
1109 (*this)(0,0) = m00; (*this)(0,1) = m01; (*this)(0,2) = m02;
1110 (*this)(1,0) = m10; (*this)(1,1) = m11; (*this)(1,2) = m12;
1111 (*this)(2,0) = m20; (*this)(2,1) = m21; (*this)(2,2) = m22;
1135 double d = ( + (*this)(0,0) * (*
this)(1,1) * (*
this)(2,2)
1136 + (*
this)(0,1) * (*
this)(1,2) * (*
this)(2,0)
1137 + (*
this)(0,2) * (*
this)(1,0) * (*
this)(2,1)
1138 - (*
this)(2,0) * (*
this)(1,1) * (*
this)(0,2)
1139 - (*
this)(2,1) * (*
this)(1,2) * (*
this)(0,0)
1140 - (*
this)(2,2) * (*
this)(1,0) * (*
this)(0,1));
1151 a_result(0,0) = ((*this)(1,1) * (*
this)(2,2) - (*
this)(2,1)*(*
this)(1,2)) / d;
1152 a_result(0,1) = -((*this)(0,1) * (*
this)(2,2) - (*
this)(2,1)*(*
this)(0,2)) / d;
1153 a_result(0,2) = ((*this)(0,1) * (*
this)(1,2) - (*
this)(1,1)*(*
this)(0,2)) / d;
1155 a_result(1,0) = -((*this)(1,0) * (*
this)(2,2) - (*
this)(2,0)*(*
this)(1,2)) / d;
1156 a_result(1,1) = ((*this)(0,0) * (*
this)(2,2) - (*
this)(2,0)*(*
this)(0,2)) / d;
1157 a_result(1,2) = -((*this)(0,0) * (*
this)(1,2) - (*
this)(1,0)*(*
this)(0,2)) / d;
1159 a_result(2,0) = ((*this)(1,0) * (*
this)(2,1) - (*
this)(2,0)*(*
this)(1,1)) / d;
1160 a_result(2,1) = -((*this)(0,0) * (*
this)(2,1) - (*
this)(2,0)*(*
this)(0,1)) / d;
1161 a_result(2,2) = ((*this)(0,0) * (*
this)(1,1) - (*
this)(1,0)*(*
this)(0,1)) / d;
1212 const double& a_angleRad)
1215 double length = a_axis.
length();
1225 double f = 1.0 / length;
1226 double x = f * a_axis(0);
1227 double y = f * a_axis(1);
1228 double z = f * a_axis(2);
1231 double c = ::cos(a_angleRad);
1232 double s = ::sin(a_angleRad);
1235 (*this)(0,0) = x*x*v+c; (*this)(0,1) = x*y*v-z*s; (*this)(0,2) = x*z*v+y*s;
1236 (*this)(1,0) = x*y*v+z*s; (*this)(1,1) = y*y*v+c; (*this)(1,2) = y*z*v-x*s;
1237 (*this)(2,0) = x*z*v-y*s; (*this)(2,1) = y*z*v+x*s; (*this)(2,2) = z*z*v+c;
1261 const double& a_angleDeg)
1286 const double& a_axisY,
1287 const double& a_axisZ,
1288 const double& a_angleRad)
1313 const double& a_axisY,
1314 const double& a_axisZ,
1315 const double& a_angleDeg)
1338 const double& a_angle2,
1339 const double& a_angle3,
1342 switch(a_eulerOrder)
1412 const double& a_angle2,
1413 const double& a_angle3,
1440 const double& a_angle2,
1441 const double& a_angle3,
1444 double c1 = ::cos(a_angle1);
1445 double s1 = ::sin(a_angle1);
1446 double c2 = ::cos(a_angle2);
1447 double s2 = ::sin(a_angle2);
1448 double c3 = ::cos(a_angle3);
1449 double s3 = ::sin(a_angle3);
1451 switch(a_eulerOrder)
1454 (*this)(0,0) = c2*c3; (*this)(0,1) =-c2*s3; (*this)(0,2) = s2;
1455 (*this)(1,0) = c1*s3+c3*s1*s2; (*this)(1,1) = c1*c3-s1*s2*s3; (*this)(1,2) =-c2*s1;
1456 (*this)(2,0) = s1*s3-c1*c3*s2; (*this)(2,1) = c3*s1+c1*s2*s3; (*this)(2,2) = c1*c2;
1460 (*this)(0,0) = c2; (*this)(0,1) = s2*s3; (*this)(0,2) = c3*s2;
1461 (*this)(1,0) = s1*s2; (*this)(1,1) = c1*c3-c2*s1*s3; (*this)(1,2) =-c1*s3-c2*c3*s1;
1462 (*this)(2,0) =-c1*s2; (*this)(2,1) = c3*s1+c1*c2*s3; (*this)(2,2) = c1*c2*c3-s1*s3;
1466 (*this)(0,0) = c2*c3; (*this)(0,1) =-s2; (*this)(0,2) = c2*s3;
1467 (*this)(1,0) = s1*s3+c1*c3*s2; (*this)(1,1) = c1*c2; (*this)(1,2) = c1*s2*s3-c3*s1;
1468 (*this)(2,0) = c3*s1*s2-c1*s3; (*this)(2,1) = c2*s1; (*this)(2,2) = c1*c3+s1*s2*s3;
1472 (*this)(0,0) = c2; (*this)(0,1) =-c3*s2; (*this)(0,2) = s2*s3;
1473 (*this)(1,0) = c1*s2; (*this)(1,1) = c1*c2*c3-s1*s3; (*this)(1,2) =-c3*s1-c1*c2*s3;
1474 (*this)(2,0) = s1*s2; (*this)(2,1) = c1*s3+c2*c3*s1; (*this)(2,2) = c1*c3-c2*s1*s3;
1478 (*this)(0,0) = c1*c2; (*this)(0,1) = s1*s3-c1*c3*s2; (*this)(0,2) = c3*s1+c1*s2*s3;
1479 (*this)(1,0) = s2; (*this)(1,1) = c2*c3; (*this)(1,2) =-c2*s3;
1480 (*this)(2,0) =-c2*s1; (*this)(2,1) = c1*s3+c3*s1*s2; (*this)(2,2) = c1*c3-s1*s2*s3;
1484 (*this)(0,0) = c1*c2*c3-s1*s3; (*this)(0,1) =-c1*s2; (*this)(0,2) = c3*s1+c1*c2*s3;
1485 (*this)(1,0) = c3*s2; (*this)(1,1) = c2; (*this)(1,2) = s2*s3;
1486 (*this)(2,0) =-c1*s3-c2*c3*s1; (*this)(2,1) = s1*s2; (*this)(2,2) = c1*c3-c2*s1*s3;
1490 (*this)(0,0) = c1*c3+s1*s2*s3; (*this)(0,1) = c3*s1*s2-c1*s3; (*this)(0,2) = c2*s1;
1491 (*this)(1,0) = c2*s3; (*this)(1,1) = c2*c3; (*this)(1,2) =-s2;
1492 (*this)(2,0) = c1*s2*s3-c3*s1; (*this)(2,1) = s1*s3+c1*c3*s2; (*this)(2,2) = c1*c2;
1496 (*this)(0,0) = c1*c3-c2*s1*s3; (*this)(0,1) = s1*s2; (*this)(0,2) = c1*s3+c2*c3*s1;
1497 (*this)(1,0) = s2*s3; (*this)(1,1) = c2; (*this)(1,2) =-c3*s2;
1498 (*this)(2,0) =-c3*s1-c1*c2*s3; (*this)(2,1) = c1*s2; (*this)(2,2) = c1*c2*c3-s1*s3;
1502 (*this)(0,0) = c1*c3-s1*s2*s3; (*this)(0,1) =-c2*s1; (*this)(0,2) = c1*s3+c3*s1*s2;
1503 (*this)(1,0) = c3*s1+c1*s2*s3; (*this)(1,1) = c1*c2; (*this)(1,2) = s1*s3-c1*c3*s2;
1504 (*this)(2,0) =-c2*s3; (*this)(2,1) = s2; (*this)(2,2) = c2*c3;
1508 (*this)(0,0) = c1*c3-c2*s1*s3; (*this)(0,1) =-c1*s3-c2*c3*s1; (*this)(0,2) = s1*s2;
1509 (*this)(1,0) = c3*s1+c1*c2*s3; (*this)(1,1) = c1*c2*c3-s1*s3; (*this)(1,2) =-c1*s2;
1510 (*this)(2,0) = s2*s3; (*this)(2,1) = c3*s2; (*this)(2,2) = c2;
1514 (*this)(0,0) = c1*c2; (*this)(0,1) = c1*s2*s3-c3*s1; (*this)(0,2) = s1*s3+c1*c3*s2;
1515 (*this)(1,0) = c2*s1; (*this)(1,1) = c1*c3+s1*s2*s3; (*this)(1,2) = c3*s1*s2-c1*s3;
1516 (*this)(2,0) =-s2; (*this)(2,1) = c2*s3; (*this)(2,2) = c2*c3;
1520 (*this)(0,0) = c1*c2*c3-s1*s3; (*this)(0,1) =-c3*s1-c1*c2*s3; (*this)(0,2) = c1*s2;
1521 (*this)(1,0) = c1*s3+c2*c3*s1; (*this)(1,1) = c1*c3-c2*s1*s3; (*this)(1,2) = s1*s2;
1522 (*this)(2,0) =-c3*s2; (*this)(2,1) = s2*s3; (*this)(2,2) = c2;
1545 const double& a_angle2,
1546 const double& a_angle3,
1573 const double& a_angleRad)
1576 double length = a_axis.
length();
1586 double f = 1.0 / length;
1587 double x = f * a_axis(0);
1588 double y = f * a_axis(1);
1589 double z = f * a_axis(2);
1592 double c = ::cos(a_angleRad);
1593 double s = ::sin(a_angleRad);
1597 m(0,0) = x*x*v+c; m(0,1) = x*y*v-z*s; m(0,2) = x*z*v+y*s;
1598 m(1,0) = x*y*v+z*s; m(1,1) = y*y*v+c; m(1,2) = y*z*v-x*s;
1599 m(2,0) = x*z*v-y*s; m(2,1) = y*z*v+x*s; m(2,2) = z*z*v+c;
1601 (*this) = m*(*this);
1625 const double& a_angleDeg)
1650 const double& a_axisY,
1651 const double& a_axisZ,
1652 const double& a_angleRad)
1677 const double& a_axisY,
1678 const double& a_axisZ,
1679 const double& a_angleDeg)
1702 const double& a_angleRad)
1705 double length = a_axis.
length();
1715 double f = 1.0 / length;
1716 double x = f * a_axis(0);
1717 double y = f * a_axis(1);
1718 double z = f * a_axis(2);
1721 double c = ::cos(a_angleRad);
1722 double s = ::sin(a_angleRad);
1726 m(0,0) = x*x*v+c; m(0,1) = x*y*v-z*s; m(0,2) = x*z*v+y*s;
1727 m(1,0) = x*y*v+z*s; m(1,1) = y*y*v+c; m(1,2) = y*z*v-x*s;
1728 m(2,0) = x*z*v-y*s; m(2,1) = y*z*v+x*s; m(2,2) = z*z*v+c;
1730 (*this) = (*this)*m;
1754 const double& a_angleDeg)
1779 const double& a_axisY,
1780 const double& a_axisZ,
1781 const double& a_angleRad)
1806 const double& a_axisY,
1807 const double& a_axisZ,
1808 const double& a_angleDeg)
1831 double& a_angle)
const 1834 double epsilon1 = 0.01;
1835 double epsilon2 = 0.1;
1837 if ((fabs((*
this)(0,1) - (*
this)(1,0)) < epsilon1) &&
1838 (fabs((*
this)(0,2) - (*
this)(2,0)) < epsilon1) &&
1839 (fabs((*
this)(1,2) - (*
this)(2,1)) < epsilon1))
1844 if ( (fabs((*
this)(0,1) + (*
this)(1,0)) < epsilon2) &&
1845 (fabs((*
this)(0,2) + (*
this)(2,0)) < epsilon2) &&
1846 (fabs((*
this)(1,2) + (*
this)(2,1)) < epsilon2) &&
1847 (fabs((*
this)(0,0) + (*
this)(1,1) + (*
this)(2,2)-3) < epsilon2))
1857 double xx = ((*this)(0,0)+1)/2;
1858 double yy = ((*this)(1,1)+1)/2;
1859 double zz = ((*this)(2,2)+1)/2;
1860 double xy = ((*this)(0,1)+(*
this)(1,0))/4;
1861 double xz = ((*this)(0,2)+(*
this)(2,0))/4;
1862 double yz = ((*this)(1,2)+(*
this)(2,1))/4;
1864 if ((xx > yy) && (xx > zz))
1885 x = 0.7071067811865475;
1887 z = 0.7071067811865475;
1901 x = 0.7071067811865475;
1902 y = 0.7071067811865475;
1919 double s = sqrt(((*
this)(2,1) - (*
this)(1,2))*((*
this)(2,1) - (*
this)(1,2)) +
1920 ((*
this)(0,2) - (*
this)(2,0))*((*
this)(0,2) - (*
this)(2,0)) +
1921 ((*
this)(1,0) - (*
this)(0,1))*((*
this)(1,0) - (*
this)(0,1)));
1926 if (fabs(s) < 0.001) s=1;
1928 angle = acos(( (*
this)(0,0) + (*
this)(1,1) + (*
this)(2,2) - 1)/2);
1929 x = ((*this)(2,1) - (*
this)(1,2))/s;
1930 y = ((*this)(0,2) - (*
this)(2,0))/s;
1931 z = ((*this)(1,0) - (*
this)(0,1))/s;
1956 inline std::string
str(
const unsigned int a_precision = 2)
const 1959 result.append(
"[ ");
1961 for (
int i=0; i<3; i++)
1963 result.append(
"( ");
1964 for (
int j=0; j<3; j++)
1966 result.append(
cStr((*
this)(j,i), a_precision));
1969 result.append(
", ");
1972 result.append(
" ) ");
1983 (*this)(0,0) *= a_val; (*this)(0,1) *= a_val; (*this)(0,2) *= a_val;
1984 (*this)(1,0) *= a_val; (*this)(1,1) *= a_val; (*this)(1,2) *= a_val;
1985 (*this)(2,0) *= a_val; (*this)(2,1) *= a_val; (*this)(2,2) *= a_val;
1993 mulr(a_val, result);
2017 (*this)(0,0) += a_input(0,0);
2018 (*this)(0,1) += a_input(0,1);
2019 (*this)(0,2) += a_input(0,2);
2021 (*this)(1,0) += a_input(1,0);
2022 (*this)(1,1) += a_input(1,1);
2023 (*this)(1,2) += a_input(1,2);
2025 (*this)(2,0) += a_input(2,0);
2026 (*this)(2,1) += a_input(2,1);
2027 (*this)(2,2) += a_input(2,2);
2034 (*this)(0,0) -= a_input(0,0);
2035 (*this)(0,1) -= a_input(0,1);
2036 (*this)(0,2) -= a_input(0,2);
2038 (*this)(1,0) -= a_input(1,0);
2039 (*this)(1,1) -= a_input(1,1);
2040 (*this)(1,2) -= a_input(1,2);
2042 (*this)(2,0) -= a_input(2,0);
2043 (*this)(2,1) -= a_input(2,1);
2044 (*this)(2,2) -= a_input(2,2);
2049 inline double&
operator() (
const int a_index0,
const int a_index1)
2051 return m_data[a_index0][a_index1];
2056 inline const double&
operator() (
const int a_index0,
const int a_index1)
const 2058 return m_data[a_index0][a_index1];
2069 double m_data[3][3];
2082 a_matrix.
mulr(a_vector, result);
2092 a_matrix1.
mulr(a_matrix2, result);
This class implements a 3D vector.
Definition: CVector3d.h:88
Definition: CMatrix3d.h:67
void setExtrinsicEulerRotationDeg(const double &a_angle1, const double &a_angle2, const double &a_angle3, const cEulerOrder a_eulerOrder)
This method builds a rotation matrix from an Euler angle representation.
Definition: CMatrix3d.h:1411
bool setAxisAngleRotationRad(const cVector3d &a_axis, const double &a_angleRad)
This method builds a rotation matrix from an axis-angle representation.
Definition: CMatrix3d.h:1211
void sub(const cMatrix3d &a_matrix)
This method computes the subtraction of this matrix with another.
Definition: CMatrix3d.h:817
double det() const
This method computes and returns the determinant of this matrix.
Definition: CMatrix3d.h:1005
Definition: CMatrix3d.h:66
cVector3d getCol0() const
This method returns column vector 0 of matrix.
Definition: CMatrix3d.h:536
cMatrix3d(const double &a_m00, const double &a_m01, const double &a_m02, const double &a_m10, const double &a_m11, const double &a_m12, const double &a_m20, const double &a_m21, const double &a_m22)
Definition: CMatrix3d.h:151
double & operator()(const int a_index0, const int a_index1)
An overloaded () operator.
Definition: CMatrix3d.h:2049
Definition: CMatrix3d.h:69
bool rotateAboutGlobalAxisDeg(const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleDeg)
This method rotates this matrix around an axis described in global coordinates.
Definition: CMatrix3d.h:1676
bool setAxisAngleRotationDeg(const cVector3d &a_axis, const double &a_angleDeg)
This method builds a rotation matrix from an axis-angle representation.
Definition: CMatrix3d.h:1260
bool invert()
This method computes the inverse of this matrix.
Definition: CMatrix3d.h:1077
void mulr(const cMatrix3d &a_matrix, cMatrix3d &a_result) const
This function computes the multiplication of this matrix with another.
Definition: CMatrix3d.h:922
Definition: CMatrix3d.h:68
void normalize()
This method normalizes this vector to length 1.
Definition: CVector3d.h:1054
bool rotateAboutLocalAxisDeg(const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleDeg)
This method rotates this matrix around an axis described in local coordinates.
Definition: CMatrix3d.h:1805
cVector3d operator*(const cVector3d &a_val)
An overloaded * operator for matrix/vector multiplication.
Definition: CMatrix3d.h:1990
void crossr(const cVector3d &a_vector, cVector3d &a_result) const
This method computes the cross product.
Definition: CVector3d.h:975
void operator+=(const cMatrix3d &a_input)
An overloaded += operator for matrix/matrix addition.
Definition: CMatrix3d.h:2015
void operator-=(const cMatrix3d &a_input)
An overloaded -= operator for matrix/matrix subtraction.
Definition: CMatrix3d.h:2032
Definition: CMatrix3d.h:64
std::string cStr(const bool a_value)
This function converts a boolean into a string.
Definition: CString.cpp:189
Definition: CMatrix3d.h:65
double length() const
This method computes the Euclidean norm of this vector.
Definition: CVector3d.h:1015
Definition: CMatrix3d.h:70
cMatrix3d(const cVector3d &a_colVector0, const cVector3d &a_colVector1, const cVector3d &a_colVector2)
Definition: CMatrix3d.h:171
Definition: CMatrix3d.h:62
bool rotateAboutGlobalAxisDeg(const cVector3d &a_axis, const double &a_angleDeg)
This method rotates this matrix around an axis described in global coordinates.
Definition: CMatrix3d.h:1624
void mul(const cMatrix3d &a_matrix)
This function computes the multiplication of this matrix with another.
Definition: CMatrix3d.h:883
bool rotateAboutLocalAxisDeg(const cVector3d &a_axis, const double &a_angleDeg)
This method rotates this matrix around an axis described in local coordinates.
Definition: CMatrix3d.h:1753
bool rotateAboutLocalAxisRad(const cVector3d &a_axis, const double &a_angleRad)
This method rotates this matrix around an axis described in local coordinates.
Definition: CMatrix3d.h:1701
Implements mathematical constants.
void set(const double &a_x, const double &a_y, const double &a_z)
This method initializes this vector with components x, y, and z passed as arguments.
Definition: CVector3d.h:298
const double C_DEG2RAD
Conversion from degrees to radians.
Definition: CConstants.h:94
void mul(cVector3d &a_vector) const
This function computes the multiplication of this matrix with a vector.
Definition: CMatrix3d.h:956
const double C_PI
PI constant.
Definition: CConstants.h:88
bool setAxisAngleRotationRad(const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleRad)
This method builds a rotation matrix from an axis-angle representation.
Definition: CMatrix3d.h:1285
std::string str(const unsigned int a_precision=2) const
This method converts this matrix to a string representation.
Definition: CMatrix3d.h:1956
Definition: CMatrix3d.h:60
This class implements a 3D matrix.
Definition: CMatrix3d.h:97
cMatrix3d(const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleRad)
Definition: CMatrix3d.h:282
bool setAxisAngleRotationDeg(const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleDeg)
This method builds a rotation matrix from axis-angle representation.
Definition: CMatrix3d.h:1312
Definition: CMatrix3d.h:61
void setCol2(const cVector3d &a_vectCol)
This method initializes column 2 of this matrix.
Definition: CMatrix3d.h:491
void orthogonalize()
This method orthogonalizes this matrix.
Definition: CMatrix3d.h:1180
const double C_TINY
Smallest value near zero for a double.
Definition: CConstants.h:100
Definition: CMatrix3d.h:63
cMatrix3d(const double &a_angle1, const double &a_angle2, const double &a_angle3, const cEulerOrder a_eulerOrder, const bool a_useIntrinsicEulerModel=true, const bool a_anglesDefinedInDegrees=false)
Definition: CMatrix3d.h:222
cEulerOrder
Definition: CMatrix3d.h:57
void operator*=(const double &a_val)
An overloaded *= operator for matrix/scalar multiplication.
Definition: CMatrix3d.h:1981
void setExtrinsicEulerRotationRad(const double &a_angle1, const double &a_angle2, const double &a_angle3, const cEulerOrder a_eulerOrder)
This method builds a rotation matrix from an Euler angle representation.
Definition: CMatrix3d.h:1337
bool rotateAboutGlobalAxisRad(const cVector3d &a_axis, const double &a_angleRad)
This method rotates this matrix around an axis described in global coordinates.
Definition: CMatrix3d.h:1572
void trans()
This method computes the transpose of this matrix.
Definition: CMatrix3d.h:1027
void setCol(const cVector3d &a_vectCol0, const cVector3d &a_vectCol1, const cVector3d &a_vectCol2)
This method initialize this matrix with column vectors passed as arguments.
Definition: CMatrix3d.h:429
void setCol1(const cVector3d &a_vectCol)
This method initializes column 1 of this matrix.
Definition: CMatrix3d.h:471
bool invertr(cMatrix3d &a_result) const
This method computes the inverse of this matrix.
Definition: CMatrix3d.h:1132
void setCol0(const cVector3d &a_vectCol)
This method initializes column 0 of this matrix.
Definition: CMatrix3d.h:451
cVector3d getCol1() const
This method returns column vector 1 of matrix.
Definition: CMatrix3d.h:557
Definition: CAudioBuffer.cpp:56
cMatrix3d(const cVector3d &a_axis, const double &a_angleRad)
Definition: CMatrix3d.h:264
bool rotateAboutLocalAxisRad(const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleRad)
This method rotates this matrix around an axis described in local coordinates.
Definition: CMatrix3d.h:1778
void identity()
This method builds an identity matrix.
Definition: CMatrix3d.h:325
void copyfrom(const cMatrix3d &a_source)
This method copies all elements from another matrix to this one.
Definition: CMatrix3d.h:675
Definition: CMatrix3d.h:59
bool toAxisAngle(cVector3d &a_axis, double &a_angle) const
This method converts this rotation matrix to an axis-angle representation.
Definition: CMatrix3d.h:1830
void add(const cMatrix3d &a_matrix)
This method computes the addition of this matrix with another.
Definition: CMatrix3d.h:752
cVector3d getCol2() const
This method returns column vector 2 of matrix.
Definition: CMatrix3d.h:578
void mulr(const cVector3d &a_vector, cVector3d &a_result) const
This function computes the multiplication of this matrix with a vector.
Definition: CMatrix3d.h:985
bool rotateAboutGlobalAxisRad(const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleRad)
This method rotates this matrix around an axis described in global coordinates.
Definition: CMatrix3d.h:1649
void setIntrinsicEulerRotationRad(const double &a_angle1, const double &a_angle2, const double &a_angle3, const cEulerOrder a_eulerOrder)
This method builds a rotation matrix from an Euler angle representation.
Definition: CMatrix3d.h:1439
bool equals(cMatrix3d &a_matrix) const
This method compares if two matrices are equal.
Definition: CMatrix3d.h:722
void subr(const cMatrix3d &a_matrix, cMatrix3d &a_result) const
This method computes the subtraction of this matrix with another.
Definition: CMatrix3d.h:850
void addr(const cMatrix3d &a_matrix, cMatrix3d &a_result) const
This method computes the addition of this matrix with another.
Definition: CMatrix3d.h:785
void setIntrinsicEulerRotationDeg(const double &a_angle1, const double &a_angle2, const double &a_angle3, const cEulerOrder a_eulerOrder)
This method builds a rotation matrix from an Euler angle representation.
Definition: CMatrix3d.h:1544
cVector3d getRow(const unsigned int &a_index) const
This method returns the i th row of matrix.
Definition: CMatrix3d.h:602
void copyto(cMatrix3d &a_destination) const
This method copies all elements of this matrix to another matrix.
Definition: CMatrix3d.h:628
cMatrix3d()
Definition: CMatrix3d.h:110
void transr(cMatrix3d &a_result) const
This method computes the transpose of this matrix.
Definition: CMatrix3d.h:1049