cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vctQuaternionRotation3Base.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Anton Deguet
7  Created on: 2005-08-24
8 
9  (C) Copyright 2005-2012 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 */
20 
21 #pragma once
22 #ifndef _vctQuaternionRotation3Base_h
23 #define _vctQuaternionRotation3Base_h
24 
35 
36 #include <cisstVector/vctExport.h>
37 
38 #ifndef DOXYGEN
39 #ifndef SWIG
40 
41 // helper functions for subtemplated methods of a templated class
42 template <class _quaternionType, class _matrixType>
43 void
45  const vctMatrixRotation3Base<_matrixType> & matrixRotation);
46 
47 #endif // SWIG
48 #endif // DOXYGEN
49 
50 
64 template <class _containerType>
65 class vctQuaternionRotation3Base: public vctQuaternionBase<_containerType>
66 {
67 public:
68  enum {SIZE = 4};
69  enum {DIMENSION = 3};
70 
73 
77  typedef _containerType ContainerType;
79 
80  /* no need to document, inherit doxygen documentation from vctFixedSizeVectorBase */
81  VCT_CONTAINER_TRAITS_TYPEDEFS(typename ContainerType::value_type);
83 
84 
85 protected:
87  inline void ThrowUnlessIsNormalized(void) const throw(std::runtime_error) {
88  if (! this->IsNormalized()) {
89  cmnThrow(std::runtime_error("vctQuaternionRotation3Base: This rotation is not normalized"));
90  }
91  }
92 
97  template <class _inputType>
98  inline void ThrowUnlessIsNormalized(const _inputType & input) const throw(std::runtime_error) {
99  if (! input.IsNormalized()) {
100  cmnThrow(std::runtime_error("vctQuaternionRotation3Base: Input is not normalized"));
101  }
102  }
103 
108  inline void Allocate(void) {}
109 
110 public:
111 
112 
115  {
116  this->Allocate();
117  this->Assign(ThisType::Identity());
118  }
119 
124  inline vctQuaternionRotation3Base(const ThisType & quaternionRotation):
125  BaseType()
126  {
127  this->Allocate();
128  this->Assign(quaternionRotation);
129  }
130 
131 
145 
153  inline
154  vctQuaternionRotation3Base(const value_type & x, const value_type & y, const value_type & z,
155  const value_type & r) throw(std::runtime_error)
156  {
157  this->Allocate();
158  this->From(x, y, z, r);
159  }
160 
165  template <class __containerType>
166  inline explicit
167  vctQuaternionRotation3Base(const vctMatrixRotation3Base<__containerType> & matrixRotation) throw(std::runtime_error)
168  {
169  this->Allocate();
170  this->From(matrixRotation);
171  }
172 
177  inline
178  vctQuaternionRotation3Base(const vctAxisAngleRotation3<value_type> & axisAngleRotation) throw(std::runtime_error)
179  {
180  this->Allocate();
181  this->From(axisAngleRotation);
182  }
183 
188  template <class __containerType>
189  inline
190  vctQuaternionRotation3Base(const vctRodriguezRotation3Base<__containerType> & rodriguezRotation) throw(std::runtime_error)
191  {
192  this->Allocate();
193  this->From(rodriguezRotation);
194  }
196 
197 
198 
199 
221 
227  inline
228  vctQuaternionRotation3Base(const ThisType & quaternionRotation,
229  bool normalizeInput)
230  {
231  this->Allocate();
232  if (normalizeInput) {
233  this->FromNormalized(quaternionRotation);
234  } else {
235  this->FromRaw(quaternionRotation);
236  }
237  }
238 
239 
248  inline
249  vctQuaternionRotation3Base(const value_type & x, const value_type & y, const value_type & z,
250  const value_type & r,
251  bool normalizeInput)
252  {
253  this->Allocate();
254  if (normalizeInput) {
255  this->FromNormalized(x, y, z, r);
256  } else {
257  this->FromRaw(x, y, z, r);
258  }
259  }
260 
266  template <class __containerType>
267  inline explicit
269  bool normalizeInput)
270  {
271  this->Allocate();
272  if (normalizeInput) {
273  this->FromNormalized(matrixRotation);
274  } else {
275  this->FromRaw(matrixRotation);
276  }
277  }
278 
284  inline
286  bool normalizeInput)
287  {
288  this->Allocate();
289  if (normalizeInput) {
290  this->FromNormalized(axisAngleRotation);
291  } else {
292  this->FromRaw(axisAngleRotation);
293  }
294  }
295 
296 
302  template <class __containerType>
303  inline
305  bool normalizeInput)
306  {
307  this->Allocate();
308  if (normalizeInput) {
309  this->FromNormalized(rodriguezRotation);
310  } else {
311  this->FromRaw(rodriguezRotation);
312  }
313  }
315 
316 
319  static CISST_EXPORT const ThisType & Identity();
320 
321 
335 
338  inline ThisType &
339  From(value_type x, value_type y, value_type z, value_type r) throw(std::runtime_error) {
340  this->Assign(x, y, z, r);
341  this->ThrowUnlessIsNormalized(*this);
342  return *this;
343  }
344 
346  inline ThisType &
347  From(const vctAxisAngleRotation3<value_type> axisAngleRotation) throw(std::runtime_error) {
348  this->ThrowUnlessIsNormalized(axisAngleRotation);
349  return FromRaw(axisAngleRotation);
350  }
351 
353  template <class __containerType>
354  inline ThisType &
355  From(const vctRodriguezRotation3Base<__containerType> & rodriguezRotation) throw(std::runtime_error) {
356  this->ThrowUnlessIsNormalized(rodriguezRotation);
357  return this->FromRaw(rodriguezRotation);
358  }
359 
361  template <class __containerType>
362  inline ThisType &
363  From(const vctMatrixRotation3Base<__containerType> & matrixRotation) throw(std::runtime_error) {
364  this->ThrowUnlessIsNormalized(matrixRotation);
365  return FromRaw(matrixRotation);
366  }
368 
369 
370 
371 
381 
384  template <class __containerType>
385  inline ThisType &
387  this->Assign(other);
388  this->NormalizedSelf();
389  return *this;
390  }
391 
394  inline ThisType &
395  FromNormalized(value_type x, value_type y, value_type z, value_type r) {
396  this->Assign(x, y, z, r);
397  this->NormalizedSelf();
398  return *this;
399  }
400 
402  inline ThisType &
404  return FromRaw(axisAngleRotation.Normalized());
405  }
406 
408  template <class __containerType>
409  inline ThisType &
411  return this->FromRaw(rodriguezRotation.Normalized());
412  }
413 
423  template <class __containerType>
424  inline ThisType &
426  this->FromRaw(matrixRotation);
427  this->NormalizedSelf();
428  return *this;
429  }
431 
432 
433 
434 
444 
445  template <class __containerType>
446  inline ThisType &
448  this->Assign(other);
449  return *this;
450  }
451 
452  inline ThisType &
453  FromRaw(value_type x, value_type y, value_type z, value_type r) {
454  this->Assign(x, y, z, r);
455  return *this;
456  }
457 
458  inline ThisType &
459  FromRaw(const vctAxisAngleRotation3<value_type> axisAngleRotation) {
460  typedef vctAxisAngleRotation3<value_type> AxisAngleType;
461  typedef typename AxisAngleType::AxisType AxisType;
462 
463  const AngleType angle = axisAngleRotation.Angle();
464  const AxisType axis = axisAngleRotation.Axis();
465 
466  const AngleType halfAngle = angle * 0.5;
467  const value_type s = (value_type) sin(halfAngle);
468  const value_type c = (value_type) cos(halfAngle);
469 
470  this->Assign(s * axis[0], s * axis[1], s * axis[2], c);
471  return *this;
472  }
473 
475  template <class __containerType>
476  inline ThisType &
478  return this->FromRaw(vctAxisAngleRotation3<value_type>(rodriguezRotation, VCT_DO_NOT_NORMALIZE));
479  }
480 
490  template <class __containerType>
491  inline ThisType & FromRaw(const vctMatrixRotation3Base<__containerType> & matrixRotation) {
492  vctQuaternionRotation3BaseFromRaw(*this, matrixRotation);
493  return *this;
494  }
496 
497 
498 
499 
503  inline ThisType & From(const ThisType & otherRotation) {
504  return reinterpret_cast<ThisType &>(this->Assign(otherRotation));
505  }
506 
507 
510  inline ThisType & NormalizedOf(const ThisType & otherQuaternion) {
511  CMN_ASSERT(otherQuaternion.Pointer() != this->Pointer());
512  this->Assign(otherQuaternion);
513  this->NormalizedSelf();
514  return *this;
515  }
516 
517 
519  inline ThisType & NormalizedSelf(void) {
520  BaseType::NormalizedSelf();
521  return *this;
522  }
523 
524 
528  inline ThisType
529  Normalized(void) const {
530  ThisType result(*this);
531  result.NormalizedSelf();
532  return result;
533  }
534 
535 
539  inline ThisType & InverseSelf(void) {
540  this->ConjugateSelf();
541  return *this;
542  }
543 
544 
546  inline ThisType & InverseOf(const ThisType & otherRotation) {
547  this->ConjugateOf(otherRotation);
548  return *this;
549  }
550 
551 
554  inline ThisType Inverse(void) const {
555  ThisType result;
556  result.InverseOf(*this);
557  return result;
558  }
559 
560 
567  template <stride_type __stride1, class __dataPtrType1, stride_type __stride2, class __dataPtrType2>
568  inline void
571  {
572  CMN_ASSERT(input.Pointer() != output.Pointer());
573  vctQuaternionVectorProductByElements(this->X(), this->Y(), this->Z(), this->R(),
574  input.X(), input.Y(), input.Z(), output);
575  }
576 
577 
578  template <class __vectorOwnerType, stride_type __stride, class __dataPtrType>
579  inline void
582  {
583  CMN_ASSERT(input.Pointer() != output.Pointer());
584  CMN_ASSERT(input.size() == DIMENSION);
585  vctQuaternionVectorProductByElements(this->X(), this->Y(), this->Z(), this->R(),
586  input.X(), input.Y(), input.Z(), output);
587  }
588 
589 
598  template <stride_type __stride, class __dataPtrType>
601  {
603  this->ApplyTo(input, result);
604  return result;
605  }
606 
607  template <class __vectorOwnerType>
610  {
611  CMN_ASSERT(input.size() == DIMENSION);
613  this->ApplyTo(input, result);
614  return result;
615  }
616 
617 
620  template <size_type __cols, stride_type __rowStride1, stride_type __colStride1, class __dataPtrType1,
621  stride_type __rowStride2, stride_type __colStride2, class __dataPtrType2>
624  {
625  CMN_ASSERT(input.Pointer() != output.Pointer());
626  const size_type numCols = input.cols();
627  index_type col;
628  for (col = 0; col < numCols; ++col) {
631  this->ApplyTo(inputCol, outputCol);
632  }
633  }
634 
637  template <class __matrixOwnerType1, class __matrixOwnerType2>
640  {
641  CMN_ASSERT((input.rows() == DIMENSION) && (output.rows() == DIMENSION) && (input.cols() == output.cols()));
642  CMN_ASSERT(input.Pointer() != output.Pointer());
643  const size_type numCols = input.cols();
644  index_type col;
645  for (col = 0; col < numCols; ++col) {
646  vctDynamicConstVectorRef<value_type> inputCol(input.Column(col));
647  vctDynamicVectorRef<value_type> outputCol(output.Column(col));
648  this->ApplyTo(inputCol, outputCol);
649  }
650  }
651 
652 
660  inline void ApplyTo(const ThisType & input, ThisType & output) const {
661  CMN_ASSERT(input.Pointer() != output.Pointer());
662  output.ProductOf(*this, input);
663  }
664 
665 
674  inline ThisType ApplyTo(const ThisType & input) const {
675  ThisType result;
676  this->ApplyTo(input, result);
677  return result;
678  }
679 
680 
685  template <class _vectorOwnerType1, class _vectorOwnerType2>
686  inline void
689  {
690  CMN_ASSERT(input.Pointer() != output.Pointer());
691  CMN_ASSERT(input.size() == DIMENSION);
692  CMN_ASSERT(output.size() == DIMENSION);
694  vctQuaternionVectorProductByElements(this->X(), this->Y(), this->Z(), this->R(),
695  input.X(), input.Y(), input.Z(), tmpOutput);
696  output.X() = tmpOutput.X();
697  output.Y() = tmpOutput.Y();
698  output.Z() = tmpOutput.Z();
699  }
700 
701 
709  template <stride_type __stride1, class __dataPtrType1, stride_type __stride2, class __dataPtrType2>
710  inline void
713  {
714  CMN_ASSERT(input.Pointer() != output.Pointer());
715  vctQuaternionVectorProductByElements(-this->X(), -this->Y(), -this->Z(), this->R(),
716  input.X(), input.Y(), input.Z(), output);
717  }
718 
719 
720  template <class __vectorOwnerType, stride_type __stride, class __dataPtrType>
721  inline void
724  {
725  CMN_ASSERT(input.Pointer() != output.Pointer());
726  CMN_ASSERT(input.size() == DIMENSION);
727  vctQuaternionVectorProductByElements(-this->X(), -this->Y(), -this->Z(), this->R(),
728  input.X(), input.Y(), input.Z(), output);
729  }
730 
731 
740  template <stride_type __stride, class __dataPtrType>
743  {
745  this->ApplyInverseTo(input, result);
746  return result;
747  }
748 
749  template <class __vectorOwnerType>
752  {
753  CMN_ASSERT(input.size() == DIMENSION);
755  this->ApplyInverseTo(input, result);
756  return result;
757  }
758 
759 
762  template <size_type __cols, stride_type __rowStride1, stride_type __colStride1, class __dataPtrType1,
763  stride_type __rowStride2, stride_type __colStride2, class __dataPtrType2>
766  {
767  CMN_ASSERT(input.Pointer() != output.Pointer());
768  const size_type numCols = input.cols();
769  index_type col;
770  for (col = 0; col < numCols; ++col) {
773  this->ApplyInverseTo(inputCol, outputCol);
774  }
775  }
776 
784  inline void ApplyInverseTo(const ThisType & input, ThisType & output) const {
785  CMN_ASSERT(input.Pointer() != output.Pointer());
786  output.ProductOf(this->Conjugate(), input);
787  }
788 
789 
798  inline ThisType ApplyInverseTo(const ThisType & input) const {
799  ThisType result;
800  this->ApplyInverseTo(input, result);
801  return result;
802  }
803 
804 
809  template <class _vectorOwnerType1, class _vectorOwnerType2>
810  inline void
813  {
814  CMN_ASSERT(input.Pointer() != output.Pointer());
815  CMN_ASSERT(input.size() == DIMENSION);
816  CMN_ASSERT(output.size() == DIMENSION);
818  vctQuaternionVectorProductByElements(-this->X(), -this->Y(), -this->Z(), this->R(),
819  input.X(), input.Y(), input.Z(), tmpOutput);
820  output.X() = tmpOutput.X();
821  output.Y() = tmpOutput.Y();
822  output.Z() = tmpOutput.Z();
823  }
824 
827  template <class __matrixOwnerType1, class __matrixOwnerType2>
830  {
831  CMN_ASSERT((input.rows() == DIMENSION) && (output.rows() == DIMENSION) && (input.cols() == output.cols()));
832  CMN_ASSERT(input.Pointer() != output.Pointer());
833  const size_type numCols = input.cols();
834  index_type col;
835  for (col = 0; col < numCols; ++col) {
836  vctDynamicConstVectorRef<value_type> inputCol(input.Column(col));
837  vctDynamicVectorRef<value_type> outputCol(output.Column(col));
838  this->ApplyInverseTo(inputCol, outputCol);
839  }
840  }
841 
842 
854  inline bool AlmostEquivalent(const ThisType & other,
855  value_type tolerance = TypeTraits::Tolerance()) const {
856  ThisType differenceVector;
857  differenceVector.DifferenceOf(*this, other);
858  differenceVector.AbsSelf();
859  if (differenceVector.Lesser(tolerance)) {
860  return true;
861  }
862  differenceVector.SumOf(*this, other);
863  differenceVector.AbsSelf();
864  if (differenceVector.Lesser(tolerance)) {
865  return true;
866  }
867  return false;
868  }
869 
870 
878  ThisType operator * (const ThisType & input) const {
879  CMN_ASSERT(input.Pointer() != this->Pointer());
880  return this->ApplyTo(input);
881  }
882 
883 
884 
889 
901  template <stride_type __stride, class __dataPtrType>
902  inline CISST_DEPRECATED const ThisType &
904  const AngleType & angle) {
905  assert(vctUnaryOperations<value_type>::AbsValue::Operate(value_type(axis.Norm() - 1))
907  const double halfAngle = angle * 0.5;
908  const value_type s = value_type(sin(halfAngle));
909  const value_type c = value_type(cos(halfAngle));
910  this->ConcatenationOf(s * axis, c);
911  return *this;
912  }
913 
928  template <stride_type __stride, class __dataPtrType>
929  inline CISST_DEPRECATED const ThisType &
931  const value_type axisLength = rodriguezRotation.Norm();
932  const value_type axisTolerance = cmnTypeTraits<value_type>::Tolerance();
933  const double angle = (fabs(axisLength) < axisTolerance) ? 0.0 : axisLength;
934  const vctFixedSizeVector<value_type,3> defaultAxis(value_type(1), value_type(0), value_type(0));
935  const vctFixedSizeVector<value_type,3> axis( (angle == value_type(0)) ? defaultAxis : (rodriguezRotation / axisLength) );
936  return this->From(axis, angle);
937  }
938 
939 
950  template <stride_type __stride, class __dataPtrType>
951  inline CISST_DEPRECATED
953  value_type & angle) {
954  angle = value_type(acos(this->R()) * 2);
955  value_type sinAngle = value_type(sqrt(1.0 - this->R() * this->R()));
957  axis.X() = this->X() / sinAngle;
958  axis.Y() = this->Y() / sinAngle;
959  axis.Z() = this->Z() / sinAngle;
960  } else {
961  axis.X() = this->X();
962  axis.Y() = this->Y();
963  axis.Z() = this->Z();
964  }
965  }
967 };
968 
969 
970 
971 
972 template <class _containerType, class _elementType, vct::stride_type _stride, class _dataPtrType>
977  rotationQuaternion.ApplyTo(vector, result);
978  return result;
979 }
980 
981 template <class _containerType, class _elementType, class _vectorOwnerType>
986  rotationQuaternion.ApplyTo(vector, result);
987  return result;
988 }
989 
990 
991 
997 template <class _elementType, vct::stride_type __strideOut, class __dataPtrTypeOut>
999  const _elementType qX, const _elementType qY, const _elementType qZ, const _elementType qR,
1000  const _elementType vX, const _elementType vY, const _elementType vZ,
1002 {
1003  typedef _elementType value_type;
1004 
1005  // compute the product of quaternions q_input = [in, 0] and q
1006  // conjugate. Since q_input[3] = 0, suppress terms with it.
1007  const value_type tR = - vX * qX - vY * qY - vZ * qZ;
1008  const value_type tX = - vX * qR + vY * qZ - vZ * qY;
1009  const value_type tY = - vY * qR + vZ * qX - vX * qZ;
1010  const value_type tZ = - vZ * qR + vX * qY - vY * qX;
1011 
1012  // multiply q by (qX, qY, qY, qR). For out quaternion,
1013  // element 4 (qR) is not interesting since we only want the
1014  // vector.
1015  output.X() = - qR * tX - qX * tR - qY * tZ + qZ * tY;
1016  output.Y() = - qR * tY - qY * tR - qZ * tX + qX * tZ;
1017  output.Z() = - qR * tZ - qZ * tR - qX * tY + qY * tX;
1018 }
1019 
1020 
1021 
1022 template <class _quaternionType, class _matrixType>
1023 void
1025  const vctMatrixRotation3Base<_matrixType> & matrixRotation)
1026 {
1027  typedef typename _quaternionType::value_type value_type;
1028  typedef typename _quaternionType::NormType NormType;
1029 
1030  const NormType a0 = 1.0 + matrixRotation.Element(0, 0) + matrixRotation.Element(1, 1) + matrixRotation.Element(2, 2);
1031  const NormType a1 = 1.0 + matrixRotation.Element(0, 0) - matrixRotation.Element(1, 1) - matrixRotation.Element(2, 2);
1032  const NormType a2 = 1.0 - matrixRotation.Element(0, 0) + matrixRotation.Element(1, 1) - matrixRotation.Element(2, 2);
1033  const NormType a3 = 1.0 - matrixRotation.Element(0, 0) - matrixRotation.Element(1, 1) + matrixRotation.Element(2, 2);
1034 
1035  NormType max = a0;
1036  unsigned char index = 0;
1037  if (a1 > max) {
1038  max = a1;
1039  index = 1;
1040  }
1041  if (a2 > max) {
1042  max = a2;
1043  index = 2;
1044  }
1045  if (a3 > max) {
1046  index = 3;
1047  }
1048 
1049  NormType ratio;
1050  switch (index) {
1051  case 0:
1052  quaternionRotation.R() = static_cast<value_type>(sqrt(a0) * 0.5);
1053  ratio = 0.25 / quaternionRotation.R();
1054  quaternionRotation.X() = static_cast<value_type>((matrixRotation.Element(2, 1) - matrixRotation.Element(1, 2)) * ratio);
1055  quaternionRotation.Y() = static_cast<value_type>((matrixRotation.Element(0, 2) - matrixRotation.Element(2, 0)) * ratio);
1056  quaternionRotation.Z() = static_cast<value_type>((matrixRotation.Element(1, 0) - matrixRotation.Element(0, 1)) * ratio);
1057  break;
1058  case 1:
1059  quaternionRotation.X() = static_cast<value_type>(sqrt(a1) * 0.5);
1060  ratio = 0.25 / quaternionRotation.X();
1061  quaternionRotation.R() = static_cast<value_type>((matrixRotation.Element(2, 1) - matrixRotation.Element(1, 2)) * ratio);
1062  quaternionRotation.Y() = static_cast<value_type>((matrixRotation.Element(1, 0) + matrixRotation.Element(0, 1)) * ratio);
1063  quaternionRotation.Z() = static_cast<value_type>((matrixRotation.Element(2, 0) + matrixRotation.Element(0, 2)) * ratio);
1064  break;
1065  case 2:
1066  quaternionRotation.Y() = static_cast<value_type>(sqrt(a2) * 0.5);
1067  ratio = 0.25 / quaternionRotation.Y();
1068  quaternionRotation.R() = static_cast<value_type>((matrixRotation.Element(0, 2) - matrixRotation.Element(2, 0)) * ratio);
1069  quaternionRotation.X() = static_cast<value_type>((matrixRotation.Element(1, 0) + matrixRotation.Element(0, 1)) * ratio);
1070  quaternionRotation.Z() = static_cast<value_type>((matrixRotation.Element(2, 1) + matrixRotation.Element(1, 2)) * ratio);
1071  break;
1072  case 3:
1073  quaternionRotation.Z() = static_cast<value_type>(sqrt(a3) * 0.5);
1074  ratio = 0.25 / quaternionRotation.Z();
1075  quaternionRotation.R() = static_cast<value_type>((matrixRotation.Element(1, 0) - matrixRotation.Element(0, 1)) * ratio);
1076  quaternionRotation.X() = static_cast<value_type>((matrixRotation.Element(0, 2) + matrixRotation.Element(2, 0)) * ratio);
1077  quaternionRotation.Y() = static_cast<value_type>((matrixRotation.Element(2, 1) + matrixRotation.Element(1, 2)) * ratio);
1078  break;
1079  default:
1080  break;
1081  }
1082 }
1083 
1084 #endif // _vctQuaternionRotation3Base_h
size_t index_type
Definition: vctContainerTraits.h:36
void ApplyTo(const ThisType &input, ThisType &output) const
Definition: vctQuaternionRotation3Base.h:660
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
value_type & Y(void)
Definition: vctFixedSizeVectorBase.h:572
value_type & Y(void)
Definition: vctDynamicVectorBase.h:510
const value_type & Y(void) const
Definition: vctDynamicConstVectorBase.h:251
A template for a fixed size matrix with fixed spacing in memory.
Definition: vctFixedSizeConstMatrixBase.h:103
void ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctQuaternionRotation3Base.h:711
ThisType Inverse(void) const
Definition: vctQuaternionRotation3Base.h:554
ThisType & From(const vctAxisAngleRotation3< value_type > axisAngleRotation)
Definition: vctQuaternionRotation3Base.h:347
const AxisType & Axis(void) const
Definition: vctAxisAngleRotation3.h:314
#define CMN_ASSERT(expr)
Definition: cmnAssert.h:90
NormType Norm(void) const
Definition: vctFixedSizeConstVectorBase.h:453
void ApplyInverseTo(const ThisType &input, ThisType &output) const
Definition: vctQuaternionRotation3Base.h:784
Definition: vctDynamicMatrixBase.h:42
#define CISST_DEPRECATED
Definition: cmnPortability.h:310
Dynamic vector referencing existing memory (const)
Definition: vctDynamicConstVectorRef.h:79
vctQuaternionRotation3Base(const ThisType &quaternionRotation)
Definition: vctQuaternionRotation3Base.h:124
vctQuaternionRotation3Base(const vctAxisAngleRotation3< value_type > &axisAngleRotation)
Definition: vctQuaternionRotation3Base.h:178
vctQuaternionRotation3Base(void)
Definition: vctQuaternionRotation3Base.h:114
Define a quaternion container.
Definition: vctForwardDeclarations.h:205
An implementation of the ``abstract'' vctFixedSizeVectorBase.
Definition: vctFixedSizeVectorRef.h:46
bool AlmostEquivalent(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition: vctQuaternionRotation3Base.h:854
ThisType & FromRaw(const vctMatrixRotation3Base< __containerType > &matrixRotation)
Definition: vctQuaternionRotation3Base.h:491
static Type Tolerance(void)
Definition: cmnTypeTraits.h:170
bool Lesser(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
Definition: vctFixedSizeConstVectorBase.h:733
ThisType operator*(const ThisType &input) const
Definition: vctQuaternionRotation3Base.h:878
ThisType & ConjugateSelf(void)
Definition: vctQuaternionBase.h:126
Declaration of vctFixedSizeMatrix.
const value_type & Y(void) const
Definition: vctFixedSizeConstVectorBase.h:306
ThisType & FromNormalized(value_type x, value_type y, value_type z, value_type r)
Definition: vctQuaternionRotation3Base.h:395
const value_type & X(void) const
Definition: vctDynamicConstVectorBase.h:243
Dynamic vector referencing existing memory.
Definition: vctDynamicVectorRef.h:77
Declaration of vctQuaternionBase.
Declaration of vctAxisAngleRotation3.
_containerType ContainerType
Definition: vctQuaternionRotation3Base.h:77
vctQuaternionRotation3Base(const vctAxisAngleRotation3< value_type > &axisAngleRotation, bool normalizeInput)
Definition: vctQuaternionRotation3Base.h:285
An implementation of the ``abstract'' vctFixedSizeConstVectorBase.
Definition: vctFixedSizeConstVectorRef.h:50
ThisType & From(const vctMatrixRotation3Base< __containerType > &matrixRotation)
Definition: vctQuaternionRotation3Base.h:363
size_t size_type
Definition: vctContainerTraits.h:35
vctFixedSizeVector< value_type, DIMENSION > ApplyTo(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &input) const
Definition: vctQuaternionRotation3Base.h:609
VCT_CONTAINER_TRAITS_TYPEDEFS(typename ContainerType::value_type)
ThisType & InverseSelf(void)
Definition: vctQuaternionRotation3Base.h:539
ColumnRefType Column(size_type index)
Definition: vctDynamicMatrixBase.h:233
void ApplyTo(const vctDynamicConstMatrixBase< __matrixOwnerType1, value_type > &input, vctDynamicMatrixBase< __matrixOwnerType2, value_type > &output) const
Definition: vctQuaternionRotation3Base.h:638
void Allocate(void)
Definition: vctQuaternionRotation3Base.h:108
const value_type & Z(void) const
Definition: vctDynamicConstVectorBase.h:259
ThisType Normalized(void) const
Definition: vctQuaternionRotation3Base.h:529
Definition: vctDynamicConstMatrixBase.h:77
void ApplyInverseTo(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &input, vctFixedSizeVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &output) const
Definition: vctQuaternionRotation3Base.h:722
Define a rotation based on an axis and an angle for a space of dimension 3.
Definition: vctAxisAngleRotation3.h:94
static CISST_EXPORT const ThisType & Identity()
Define unary operations on an object as classes.
Definition: vctUnaryOperations.h:55
void ApplyInverseTo(const vctDynamicConstMatrixBase< __matrixOwnerType1, value_type > &input, vctDynamicMatrixBase< __matrixOwnerType2, value_type > &output) const
Definition: vctQuaternionRotation3Base.h:828
ThisType & From(const ThisType &otherRotation)
Definition: vctQuaternionRotation3Base.h:503
value_type & X(void)
Definition: vctFixedSizeVectorBase.h:559
ThisType & NormalizedSelf(void)
Definition: vctQuaternionRotation3Base.h:519
size_type size(void) const
Definition: vctDynamicConstVectorBase.h:164
void ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition: vctQuaternionRotation3Base.h:687
A template for a fixed size matrix with fixed spacings in memory.
Definition: vctFixedSizeMatrixBase.h:58
ThisType & FromNormalized(const vctQuaternionRotation3Base< __containerType > &other)
Definition: vctQuaternionRotation3Base.h:386
ThisType & FromNormalized(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition: vctQuaternionRotation3Base.h:410
Define a rotation matrix for a space of dimension 3.
Definition: vctForwardDeclarations.h:199
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition: vctDynamicMatrixBase.h:143
Definition: vctQuaternionRotation3Base.h:69
vctFixedSizeVector< value_type, DIMENSION > ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition: vctQuaternionRotation3Base.h:600
ThisType Normalized(void) const
Definition: vctAxisAngleRotation3.h:542
size_type rows() const
Definition: vctDynamicConstMatrixBase.h:238
void ApplyTo(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &input, vctFixedSizeVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &output) const
Definition: vctQuaternionRotation3Base.h:580
void Assign(const OtherT &other)
Definition: cisstVectorEigenAddons.h:3
size_type cols() const
Definition: vctDynamicConstMatrixBase.h:243
ThisType Normalized(void) const
Definition: vctRodriguezRotation3Base.h:304
void ThrowUnlessIsNormalized(const _inputType &input) const
Definition: vctQuaternionRotation3Base.h:98
ThisType & FromRaw(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition: vctQuaternionRotation3Base.h:477
vctQuaternionRotation3Base(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation, bool normalizeInput)
Definition: vctQuaternionRotation3Base.h:304
ConstColumnRefType Column(size_type index) const
Definition: vctDynamicConstMatrixBase.h:372
value_type & X(void)
Definition: vctDynamicVectorBase.h:497
const_pointer Pointer(size_type index=0) const
Definition: vctFixedSizeConstVectorBase.h:268
void ApplyInverseTo(const vctFixedSizeConstMatrixBase< DIMENSION, __cols, __rowStride1, __colStride1, value_type, __dataPtrType1 > &input, vctFixedSizeMatrixBase< DIMENSION, __cols, __rowStride2, __colStride2, value_type, __dataPtrType2 > &output) const
Definition: vctQuaternionRotation3Base.h:764
void vctQuaternionVectorProductByElements(const _elementType qX, const _elementType qY, const _elementType qZ, const _elementType qR, const _elementType vX, const _elementType vY, const _elementType vZ, vctFixedSizeVectorBase< 3, __strideOut, _elementType, __dataPtrTypeOut > &output)
Definition: vctQuaternionRotation3Base.h:998
vctQuaternionRotation3Base(const ThisType &quaternionRotation, bool normalizeInput)
Definition: vctQuaternionRotation3Base.h:228
ThisType & FromNormalized(const vctMatrixRotation3Base< __containerType > &matrixRotation)
Definition: vctQuaternionRotation3Base.h:425
const_pointer Pointer(index_type rowIndex, index_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:306
CISST_DEPRECATED const ThisType & From(const vctFixedSizeConstVectorBase< 3, __stride, value_type, __dataPtrType > &axis, const AngleType &angle)
Definition: vctQuaternionRotation3Base.h:903
vctQuaternionRotation3Base(const vctMatrixRotation3Base< __containerType > &matrixRotation, bool normalizeInput)
Definition: vctQuaternionRotation3Base.h:268
const value_type & X(void) const
Definition: vctFixedSizeConstVectorBase.h:298
vctQuaternionRotation3Base(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition: vctQuaternionRotation3Base.h:190
ThisType ApplyInverseTo(const ThisType &input) const
Definition: vctQuaternionRotation3Base.h:798
ThisType & From(value_type x, value_type y, value_type z, value_type r)
Definition: vctQuaternionRotation3Base.h:339
void ThrowUnlessIsNormalized(void) const
Definition: vctQuaternionRotation3Base.h:87
CISST_DEPRECATED const ThisType & From(const vctFixedSizeConstVectorBase< 3, __stride, value_type, __dataPtrType > &rodriguezRotation)
Definition: vctQuaternionRotation3Base.h:930
vctQuaternionRotation3Base< _containerType > ThisType
Definition: vctQuaternionRotation3Base.h:78
#define cmnThrow(a)
Definition: MinimalCmn.h:4
const_pointer Pointer(index_type index=0) const
Definition: vctDynamicConstVectorBase.h:221
ThisType & FromRaw(value_type x, value_type y, value_type z, value_type r)
Definition: vctQuaternionRotation3Base.h:453
pointer Pointer(index_type index=0)
Definition: vctDynamicVectorBase.h:155
const AngleType & Angle(void) const
Definition: vctAxisAngleRotation3.h:324
Declaration of vctMatrixRotation3Base.
void ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctQuaternionRotation3Base.h:569
const_reference R(void) const
Definition: vctQuaternionBase.h:101
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeVectorBase.h:76
ThisType Conjugate(void) const
Definition: vctQuaternionBase.h:136
ptrdiff_t stride_type
Definition: vctContainerTraits.h:37
Definition: vctQuaternionRotation3Base.h:68
ThisType ApplyTo(const ThisType &input) const
Definition: vctQuaternionRotation3Base.h:674
Definition: vctDynamicConstVectorBase.h:77
void ApplyTo(const vctFixedSizeConstMatrixBase< DIMENSION, __cols, __rowStride1, __colStride1, value_type, __dataPtrType1 > &input, vctFixedSizeMatrixBase< DIMENSION, __cols, __rowStride2, __colStride2, value_type, __dataPtrType2 > &output) const
Definition: vctQuaternionRotation3Base.h:622
const value_type & Z(void) const
Definition: vctFixedSizeConstVectorBase.h:314
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeConstVectorBase.h:107
ThisType & InverseOf(const ThisType &otherRotation)
Definition: vctQuaternionRotation3Base.h:546
pointer Pointer(size_type index=0)
Definition: vctFixedSizeVectorBase.h:226
const bool VCT_DO_NOT_NORMALIZE
Definition: vctForwardDeclarations.h:69
void vctQuaternionRotation3BaseFromRaw(vctQuaternionRotation3Base< _quaternionType > &quaternionRotation, const vctMatrixRotation3Base< _matrixType > &matrixRotation)
Definition: vctQuaternionRotation3Base.h:1024
vctFixedSizeVector< value_type, DIMENSION > ApplyInverseTo(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &input) const
Definition: vctQuaternionRotation3Base.h:751
value_type & Z(void)
Definition: vctFixedSizeVectorBase.h:585
ThisType & ConjugateOf(const vctQuaternionBase< __containerTypeOther > &otherQuaternion)
Definition: vctQuaternionBase.h:116
Define a rotation quaternion for a space of dimension 3.
Definition: vctForwardDeclarations.h:208
Macros to export the symbols of cisstVector (in a Dll).
A collection of useful information about the C++ basic types, represented in a generic programming wa...
Definition: cmnTypeTraits.h:155
void ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition: vctQuaternionRotation3Base.h:811
ColumnRefType Column(size_type index)
Definition: vctFixedSizeMatrixBase.h:249
vctFixedSizeVector< _elementType, 3 > operator*(const vctQuaternionRotation3Base< _containerType > &rotationQuaternion, const vctFixedSizeConstVectorBase< 3, _stride, _elementType, _dataPtrType > &vector)
Definition: vctQuaternionRotation3Base.h:974
cmnTypeTraits< value_type > TypeTraits
Definition: vctQuaternionRotation3Base.h:82
vctQuaternionRotation3Base(const vctMatrixRotation3Base< __containerType > &matrixRotation)
Definition: vctQuaternionRotation3Base.h:167
vctFixedSizeVector< value_type, DIMENSION > ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition: vctQuaternionRotation3Base.h:742
ThisType & FromRaw(const vctAxisAngleRotation3< value_type > axisAngleRotation)
Definition: vctQuaternionRotation3Base.h:459
Define a rotation based on the rodriguez representation for a space of dimension 3.
Definition: vctForwardDeclarations.h:214
ThisType & From(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition: vctQuaternionRotation3Base.h:355
ThisType & FromRaw(const vctQuaternionRotation3Base< __containerType > &other)
Definition: vctQuaternionRotation3Base.h:447
vctQuaternionRotation3Base(const value_type &x, const value_type &y, const value_type &z, const value_type &r, bool normalizeInput)
Definition: vctQuaternionRotation3Base.h:249
Declaration of vctRodriguezRotation3.
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition: vctFixedSizeMatrixBase.h:161
CISST_DEPRECATED void GetAxisAngle(vctFixedSizeVectorBase< 3, __stride, value_type, __dataPtrType > &axis, value_type &angle)
Definition: vctQuaternionRotation3Base.h:952
value_type & Z(void)
Definition: vctDynamicVectorBase.h:523
Definition: vctDynamicVectorBase.h:61
ThisType & FromNormalized(const vctAxisAngleRotation3< value_type > axisAngleRotation)
Definition: vctQuaternionRotation3Base.h:403
ThisType & NormalizedOf(const ThisType &otherQuaternion)
Definition: vctQuaternionRotation3Base.h:510
vctQuaternionBase< _containerType > BaseType
Definition: vctQuaternionRotation3Base.h:72
vctQuaternionRotation3Base(const value_type &x, const value_type &y, const value_type &z, const value_type &r)
Definition: vctQuaternionRotation3Base.h:154