cisst-saw
Loading...
Searching...
No Matches
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 Author(s): Anton Deguet
6 Created on: 2005-08-24
7
8 (C) Copyright 2005-2020 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17*/
18
19#pragma once
20#ifndef _vctQuaternionRotation3Base_h
21#define _vctQuaternionRotation3Base_h
22
27
33
35
36#ifndef DOXYGEN
37#ifndef SWIG
38
39// helper functions for subtemplated methods of a templated class
40template <class _quaternionType, class _matrixType>
41void
43 const vctMatrixRotation3Base<_matrixType> & matrixRotation);
44
45#endif // SWIG
46#endif // DOXYGEN
47
48
62template <class _containerType>
63class vctQuaternionRotation3Base: public vctQuaternionBase<_containerType>
64{
65public:
66 enum {SIZE = 4};
67 enum {DIMENSION = 3};
68
71
75 typedef _containerType ContainerType;
77
78 /* no need to document, inherit doxygen documentation from vctFixedSizeVectorBase */
79 VCT_CONTAINER_TRAITS_TYPEDEFS(typename ContainerType::value_type);
81
82
83protected:
85 inline void ThrowUnlessIsNormalized(void) const CISST_THROW(std::runtime_error) {
86 if (! this->IsNormalized()) {
87 cmnThrow(std::runtime_error("vctQuaternionRotation3Base: This rotation is not normalized"));
88 }
89 }
90
95 template <class _inputType>
96 inline void ThrowUnlessIsNormalized(const _inputType & input) const CISST_THROW(std::runtime_error) {
97 if (! input.IsNormalized()) {
98 cmnThrow(std::runtime_error("vctQuaternionRotation3Base: Input is not normalized"));
99 }
100 }
101
106 inline void Allocate(void) {}
107
108public:
109
110
113 {
114 this->Allocate();
115 this->Assign(ThisType::Identity());
116 }
117
122 inline vctQuaternionRotation3Base(const ThisType & quaternionRotation):
123 BaseType()
124 {
125 this->Allocate();
126 this->Assign(quaternionRotation);
127 }
128
129 inline ThisType & operator = (const ThisType & quaternionRotation) {
130 this->Allocate();
131 this->Assign(quaternionRotation);
132 return *this;
133 }
134
148
156 inline
158 const value_type & r) CISST_THROW(std::runtime_error)
159 {
160 this->Allocate();
161 this->From(x, y, z, r);
162 }
163
168 template <class __containerType>
169 inline explicit
171 {
172 this->Allocate();
173 this->From(matrixRotation);
174 }
175
180 inline
181 vctQuaternionRotation3Base(const vctAxisAngleRotation3<value_type> & axisAngleRotation) CISST_THROW(std::runtime_error)
182 {
183 this->Allocate();
184 this->From(axisAngleRotation);
185 }
186
191 template <class __containerType>
192 inline
194 {
195 this->Allocate();
196 this->From(rodriguezRotation);
197 }
198
199
200
201
202
224
230 inline
231 vctQuaternionRotation3Base(const ThisType & quaternionRotation,
232 bool normalizeInput)
233 {
234 this->Allocate();
235 if (normalizeInput) {
236 this->FromNormalized(quaternionRotation);
237 } else {
238 this->FromRaw(quaternionRotation);
239 }
240 }
241
242
251 inline
253 const value_type & r,
254 bool normalizeInput)
255 {
256 this->Allocate();
257 if (normalizeInput) {
258 this->FromNormalized(x, y, z, r);
259 } else {
260 this->FromRaw(x, y, z, r);
261 }
262 }
263
269 template <class __containerType>
270 inline explicit
272 bool normalizeInput)
273 {
274 this->Allocate();
275 if (normalizeInput) {
276 this->FromNormalized(matrixRotation);
277 } else {
278 this->FromRaw(matrixRotation);
279 }
280 }
281
287 inline
289 bool normalizeInput)
290 {
291 this->Allocate();
292 if (normalizeInput) {
293 this->FromNormalized(axisAngleRotation);
294 } else {
295 this->FromRaw(axisAngleRotation);
296 }
297 }
298
299
305 template <class __containerType>
306 inline
308 bool normalizeInput)
309 {
310 this->Allocate();
311 if (normalizeInput) {
312 this->FromNormalized(rodriguezRotation);
313 } else {
314 this->FromRaw(rodriguezRotation);
315 }
316 }
317
318
319
323
324
338
341 inline ThisType &
342 From(value_type x, value_type y, value_type z, value_type r) CISST_THROW(std::runtime_error) {
343 this->Assign(x, y, z, r);
344 this->ThrowUnlessIsNormalized(*this);
345 return *this;
346 }
347
349 inline ThisType &
350 From(const vctAxisAngleRotation3<value_type> axisAngleRotation) CISST_THROW(std::runtime_error) {
351 this->ThrowUnlessIsNormalized(axisAngleRotation);
352 return FromRaw(axisAngleRotation);
353 }
354
356 template <class __containerType>
357 inline ThisType &
358 From(const vctRodriguezRotation3Base<__containerType> & rodriguezRotation) CISST_THROW(std::runtime_error) {
359 this->ThrowUnlessIsNormalized(rodriguezRotation);
360 return this->FromRaw(rodriguezRotation);
361 }
362
364 template <class __containerType>
365 inline ThisType &
366 From(const vctMatrixRotation3Base<__containerType> & matrixRotation) CISST_THROW(std::runtime_error) {
367 this->ThrowUnlessIsNormalized(matrixRotation);
368 return FromRaw(matrixRotation);
369 }
370
371
372
373
374
384
387 template <class __containerType>
388 inline ThisType &
390 this->Assign(other);
391 this->NormalizedSelf();
392 return *this;
393 }
394
397 inline ThisType &
399 this->Assign(x, y, z, r);
400 this->NormalizedSelf();
401 return *this;
402 }
403
405 inline ThisType &
407 return FromRaw(axisAngleRotation.Normalized());
408 }
409
411 template <class __containerType>
412 inline ThisType &
414 return this->FromRaw(rodriguezRotation.Normalized());
415 }
416
426 template <class __containerType>
427 inline ThisType &
429 this->FromRaw(matrixRotation);
430 this->NormalizedSelf();
431 return *this;
432 }
433
434
435
436
437
447
448 template <class __containerType>
449 inline ThisType &
451 this->Assign(other);
452 return *this;
453 }
454
455 inline ThisType &
457 this->Assign(x, y, z, r);
458 return *this;
459 }
460
461 inline ThisType &
463 typedef vctAxisAngleRotation3<value_type> AxisAngleType;
464 typedef typename AxisAngleType::AxisType AxisType;
465
466 const AngleType angle = axisAngleRotation.Angle();
467 const AxisType axis = axisAngleRotation.Axis();
468
469 const AngleType halfAngle = angle * 0.5;
470 const value_type s = (value_type) sin(halfAngle);
471 const value_type c = (value_type) cos(halfAngle);
472
473 this->Assign(s * axis[0], s * axis[1], s * axis[2], c);
474 return *this;
475 }
476
478 template <class __containerType>
479 inline ThisType &
481 return this->FromRaw(vctAxisAngleRotation3<value_type>(rodriguezRotation, VCT_DO_NOT_NORMALIZE));
482 }
483
493 template <class __containerType>
495 vctQuaternionRotation3BaseFromRaw(*this, matrixRotation);
496 return *this;
497 }
498
499
500
501
502
506 inline ThisType & From(const ThisType & otherRotation) {
507 return reinterpret_cast<ThisType &>(this->Assign(otherRotation));
508 }
509
510
513 inline ThisType & NormalizedOf(const ThisType & otherQuaternion) {
514 CMN_ASSERT(otherQuaternion.Pointer() != this->Pointer());
515 this->Assign(otherQuaternion);
516 this->NormalizedSelf();
517 return *this;
518 }
519
520
522 inline ThisType & NormalizedSelf(void) {
523 BaseType::NormalizedSelf();
524 return *this;
525 }
526
527
531 inline ThisType
532 Normalized(void) const {
533 ThisType result(*this);
534 result.NormalizedSelf();
535 return result;
536 }
537
538
542 inline ThisType & InverseSelf(void) {
543 this->ConjugateSelf();
544 return *this;
545 }
546
547
549 inline ThisType & InverseOf(const ThisType & otherRotation) {
550 this->ConjugateOf(otherRotation);
551 return *this;
552 }
553
554
557 inline ThisType Inverse(void) const {
558 ThisType result;
559 result.InverseOf(*this);
560 return result;
561 }
562
563
570 template <stride_type __stride1, class __dataPtrType1, stride_type __stride2, class __dataPtrType2>
571 inline void
574 {
575 CMN_ASSERT(input.Pointer() != output.Pointer());
576 vctQuaternionVectorProductByElements(this->X(), this->Y(), this->Z(), this->R(),
577 input.X(), input.Y(), input.Z(), output);
578 }
579
580
581 template <class __vectorOwnerType, stride_type __stride, class __dataPtrType>
582 inline void
585 {
586 CMN_ASSERT(input.Pointer() != output.Pointer());
587 CMN_ASSERT(input.size() == DIMENSION);
588 vctQuaternionVectorProductByElements(this->X(), this->Y(), this->Z(), this->R(),
589 input.X(), input.Y(), input.Z(), output);
590 }
591
592
601 template <stride_type __stride, class __dataPtrType>
604 {
606 this->ApplyTo(input, result);
607 return result;
608 }
609
610 template <class __vectorOwnerType>
613 {
614 CMN_ASSERT(input.size() == DIMENSION);
616 this->ApplyTo(input, result);
617 return result;
618 }
619
620
623 template <size_type __cols, stride_type __rowStride1, stride_type __colStride1, class __dataPtrType1,
624 stride_type __rowStride2, stride_type __colStride2, class __dataPtrType2>
627 {
628 CMN_ASSERT(input.Pointer() != output.Pointer());
629 const size_type numCols = input.cols();
630 index_type col;
631 for (col = 0; col < numCols; ++col) {
634 this->ApplyTo(inputCol, outputCol);
635 }
636 }
637
640 template <class __matrixOwnerType1, class __matrixOwnerType2>
643 {
644 CMN_ASSERT((input.rows() == DIMENSION) && (output.rows() == DIMENSION) && (input.cols() == output.cols()));
645 CMN_ASSERT(input.Pointer() != output.Pointer());
646 const size_type numCols = input.cols();
647 index_type col;
648 for (col = 0; col < numCols; ++col) {
649 vctDynamicConstVectorRef<value_type> inputCol(input.Column(col));
650 vctDynamicVectorRef<value_type> outputCol(output.Column(col));
651 this->ApplyTo(inputCol, outputCol);
652 }
653 }
654
655
663 inline void ApplyTo(const ThisType & input, ThisType & output) const {
664 CMN_ASSERT(input.Pointer() != output.Pointer());
665 output.ProductOf(*this, input);
666 }
667
668
677 inline ThisType ApplyTo(const ThisType & input) const {
678 ThisType result;
679 this->ApplyTo(input, result);
680 return result;
681 }
682
683
688 template <class _vectorOwnerType1, class _vectorOwnerType2>
689 inline void
692 {
693 CMN_ASSERT(input.Pointer() != output.Pointer());
694 CMN_ASSERT(input.size() == DIMENSION);
695 CMN_ASSERT(output.size() == DIMENSION);
697 vctQuaternionVectorProductByElements(this->X(), this->Y(), this->Z(), this->R(),
698 input.X(), input.Y(), input.Z(), tmpOutput);
699 output.X() = tmpOutput.X();
700 output.Y() = tmpOutput.Y();
701 output.Z() = tmpOutput.Z();
702 }
703
704
712 template <stride_type __stride1, class __dataPtrType1, stride_type __stride2, class __dataPtrType2>
713 inline void
716 {
717 CMN_ASSERT(input.Pointer() != output.Pointer());
718 vctQuaternionVectorProductByElements(-this->X(), -this->Y(), -this->Z(), this->R(),
719 input.X(), input.Y(), input.Z(), output);
720 }
721
722
723 template <class __vectorOwnerType, stride_type __stride, class __dataPtrType>
724 inline void
727 {
728 CMN_ASSERT(input.Pointer() != output.Pointer());
729 CMN_ASSERT(input.size() == DIMENSION);
730 vctQuaternionVectorProductByElements(-this->X(), -this->Y(), -this->Z(), this->R(),
731 input.X(), input.Y(), input.Z(), output);
732 }
733
734
743 template <stride_type __stride, class __dataPtrType>
751
752 template <class __vectorOwnerType>
755 {
756 CMN_ASSERT(input.size() == DIMENSION);
758 this->ApplyInverseTo(input, result);
759 return result;
760 }
761
762
765 template <size_type __cols, stride_type __rowStride1, stride_type __colStride1, class __dataPtrType1,
766 stride_type __rowStride2, stride_type __colStride2, class __dataPtrType2>
769 {
770 CMN_ASSERT(input.Pointer() != output.Pointer());
771 const size_type numCols = input.cols();
772 index_type col;
773 for (col = 0; col < numCols; ++col) {
776 this->ApplyInverseTo(inputCol, outputCol);
777 }
778 }
779
787 inline void ApplyInverseTo(const ThisType & input, ThisType & output) const {
788 CMN_ASSERT(input.Pointer() != output.Pointer());
789 output.ProductOf(this->Conjugate(), input);
790 }
791
792
801 inline ThisType ApplyInverseTo(const ThisType & input) const {
802 ThisType result;
803 this->ApplyInverseTo(input, result);
804 return result;
805 }
806
807
812 template <class _vectorOwnerType1, class _vectorOwnerType2>
813 inline void
816 {
817 CMN_ASSERT(input.Pointer() != output.Pointer());
818 CMN_ASSERT(input.size() == DIMENSION);
819 CMN_ASSERT(output.size() == DIMENSION);
821 vctQuaternionVectorProductByElements(-this->X(), -this->Y(), -this->Z(), this->R(),
822 input.X(), input.Y(), input.Z(), tmpOutput);
823 output.X() = tmpOutput.X();
824 output.Y() = tmpOutput.Y();
825 output.Z() = tmpOutput.Z();
826 }
827
830 template <class __matrixOwnerType1, class __matrixOwnerType2>
833 {
834 CMN_ASSERT((input.rows() == DIMENSION) && (output.rows() == DIMENSION) && (input.cols() == output.cols()));
835 CMN_ASSERT(input.Pointer() != output.Pointer());
836 const size_type numCols = input.cols();
837 index_type col;
838 for (col = 0; col < numCols; ++col) {
839 vctDynamicConstVectorRef<value_type> inputCol(input.Column(col));
840 vctDynamicVectorRef<value_type> outputCol(output.Column(col));
841 this->ApplyInverseTo(inputCol, outputCol);
842 }
843 }
844
845
857 inline bool AlmostEquivalent(const ThisType & other,
858 value_type tolerance = TypeTraits::Tolerance()) const {
859 ThisType differenceVector;
860 differenceVector.DifferenceOf(*this, other);
861 differenceVector.AbsSelf();
862 if (differenceVector.Lesser(tolerance)) {
863 return true;
864 }
865 differenceVector.SumOf(*this, other);
866 differenceVector.AbsSelf();
867 if (differenceVector.Lesser(tolerance)) {
868 return true;
869 }
870 return false;
871 }
872
873
881 ThisType operator * (const ThisType & input) const {
882 CMN_ASSERT(input.Pointer() != this->Pointer());
883 return this->ApplyTo(input);
884 }
885
886
887
892
904 template <stride_type __stride, class __dataPtrType>
905 inline CISST_DEPRECATED const ThisType &
907 const AngleType & angle) {
910 const double halfAngle = angle * 0.5;
911 const value_type s = value_type(sin(halfAngle));
912 const value_type c = value_type(cos(halfAngle));
913 this->ConcatenationOf(s * axis, c);
914 return *this;
915 }
916
931 template <stride_type __stride, class __dataPtrType>
932 inline CISST_DEPRECATED const ThisType &
934 const value_type axisLength = rodriguezRotation.Norm();
935 const value_type axisTolerance = cmnTypeTraits<value_type>::Tolerance();
936 const double angle = (fabs(axisLength) < axisTolerance) ? 0.0 : axisLength;
938 const vctFixedSizeVector<value_type,3> axis( (angle == value_type(0)) ? defaultAxis : (rodriguezRotation / axisLength) );
939 return this->From(axis, angle);
940 }
941
942
953 template <stride_type __stride, class __dataPtrType>
954 inline CISST_DEPRECATED
956 value_type & angle) {
957 angle = value_type(acos(this->R()) * 2);
958 value_type sinAngle = value_type(sqrt(1.0 - this->R() * this->R()));
960 axis.X() = this->X() / sinAngle;
961 axis.Y() = this->Y() / sinAngle;
962 axis.Z() = this->Z() / sinAngle;
963 } else {
964 axis.X() = this->X();
965 axis.Y() = this->Y();
966 axis.Z() = this->Z();
967 }
968 }
969
970};
971
972
973
974
975template <class _containerType, class _elementType, vct::stride_type _stride, class _dataPtrType>
980 rotationQuaternion.ApplyTo(vector, result);
981 return result;
982}
983
984template <class _containerType, class _elementType, class _vectorOwnerType>
989 rotationQuaternion.ApplyTo(vector, result);
990 return result;
991}
992
993
994
1000template <class _elementType, vct::stride_type __strideOut, class __dataPtrTypeOut>
1002 const _elementType qX, const _elementType qY, const _elementType qZ, const _elementType qR,
1003 const _elementType vX, const _elementType vY, const _elementType vZ,
1005{
1006 typedef _elementType value_type;
1007
1008 // compute the product of quaternions q_input = [in, 0] and q
1009 // conjugate. Since q_input[3] = 0, suppress terms with it.
1010 const value_type tR = - vX * qX - vY * qY - vZ * qZ;
1011 const value_type tX = - vX * qR + vY * qZ - vZ * qY;
1012 const value_type tY = - vY * qR + vZ * qX - vX * qZ;
1013 const value_type tZ = - vZ * qR + vX * qY - vY * qX;
1014
1015 // multiply q by (qX, qY, qY, qR). For out quaternion,
1016 // element 4 (qR) is not interesting since we only want the
1017 // vector.
1018 output.X() = - qR * tX - qX * tR - qY * tZ + qZ * tY;
1019 output.Y() = - qR * tY - qY * tR - qZ * tX + qX * tZ;
1020 output.Z() = - qR * tZ - qZ * tR - qX * tY + qY * tX;
1021}
1022
1023
1024
1025template <class _quaternionType, class _matrixType>
1026void
1028 const vctMatrixRotation3Base<_matrixType> & matrixRotation)
1029{
1030 typedef typename _quaternionType::value_type value_type;
1031 typedef typename _quaternionType::NormType NormType;
1032
1033 const NormType a0 = 1.0 + matrixRotation.Element(0, 0) + matrixRotation.Element(1, 1) + matrixRotation.Element(2, 2);
1034 const NormType a1 = 1.0 + matrixRotation.Element(0, 0) - matrixRotation.Element(1, 1) - matrixRotation.Element(2, 2);
1035 const NormType a2 = 1.0 - matrixRotation.Element(0, 0) + matrixRotation.Element(1, 1) - matrixRotation.Element(2, 2);
1036 const NormType a3 = 1.0 - matrixRotation.Element(0, 0) - matrixRotation.Element(1, 1) + matrixRotation.Element(2, 2);
1037
1038 NormType max = a0;
1039 unsigned char index = 0;
1040 if (a1 > max) {
1041 max = a1;
1042 index = 1;
1043 }
1044 if (a2 > max) {
1045 max = a2;
1046 index = 2;
1047 }
1048 if (a3 > max) {
1049 index = 3;
1050 }
1051
1052 NormType ratio;
1053 switch (index) {
1054 case 0:
1055 quaternionRotation.R() = static_cast<value_type>(sqrt(a0) * 0.5);
1056 ratio = 0.25 / quaternionRotation.R();
1057 quaternionRotation.X() = static_cast<value_type>((matrixRotation.Element(2, 1) - matrixRotation.Element(1, 2)) * ratio);
1058 quaternionRotation.Y() = static_cast<value_type>((matrixRotation.Element(0, 2) - matrixRotation.Element(2, 0)) * ratio);
1059 quaternionRotation.Z() = static_cast<value_type>((matrixRotation.Element(1, 0) - matrixRotation.Element(0, 1)) * ratio);
1060 break;
1061 case 1:
1062 quaternionRotation.X() = static_cast<value_type>(sqrt(a1) * 0.5);
1063 ratio = 0.25 / quaternionRotation.X();
1064 quaternionRotation.R() = static_cast<value_type>((matrixRotation.Element(2, 1) - matrixRotation.Element(1, 2)) * ratio);
1065 quaternionRotation.Y() = static_cast<value_type>((matrixRotation.Element(1, 0) + matrixRotation.Element(0, 1)) * ratio);
1066 quaternionRotation.Z() = static_cast<value_type>((matrixRotation.Element(2, 0) + matrixRotation.Element(0, 2)) * ratio);
1067 break;
1068 case 2:
1069 quaternionRotation.Y() = static_cast<value_type>(sqrt(a2) * 0.5);
1070 ratio = 0.25 / quaternionRotation.Y();
1071 quaternionRotation.R() = static_cast<value_type>((matrixRotation.Element(0, 2) - matrixRotation.Element(2, 0)) * ratio);
1072 quaternionRotation.X() = static_cast<value_type>((matrixRotation.Element(1, 0) + matrixRotation.Element(0, 1)) * ratio);
1073 quaternionRotation.Z() = static_cast<value_type>((matrixRotation.Element(2, 1) + matrixRotation.Element(1, 2)) * ratio);
1074 break;
1075 case 3:
1076 quaternionRotation.Z() = static_cast<value_type>(sqrt(a3) * 0.5);
1077 ratio = 0.25 / quaternionRotation.Z();
1078 quaternionRotation.R() = static_cast<value_type>((matrixRotation.Element(1, 0) - matrixRotation.Element(0, 1)) * ratio);
1079 quaternionRotation.X() = static_cast<value_type>((matrixRotation.Element(0, 2) + matrixRotation.Element(2, 0)) * ratio);
1080 quaternionRotation.Y() = static_cast<value_type>((matrixRotation.Element(2, 1) + matrixRotation.Element(1, 2)) * ratio);
1081 break;
1082 default:
1083 break;
1084 }
1085}
1086
1087#endif // _vctQuaternionRotation3Base_h
A collection of useful information about the C++ basic types, represented in a generic programming wa...
Definition cmnTypeTraits.h:155
static Type Tolerance(void)
Definition cmnTypeTraits.h:170
_elementType value_type
Definition mtsGenericObjectProxy.h:329
Define a rotation based on an axis and an angle for a space of dimension 3.
Definition vctAxisAngleRotation3.h:93
const AxisType & Axis(void) const
Definition vctAxisAngleRotation3.h:312
ThisType Normalized(void) const
Definition vctAxisAngleRotation3.h:540
const AngleType & Angle(void) const
Definition vctAxisAngleRotation3.h:322
Definition vctForwardDeclarations.h:145
Definition vctForwardDeclarations.h:119
Dynamic vector referencing existing memory (const).
Definition vctDynamicConstVectorRef.h:79
Definition vctDynamicMatrixBase.h:43
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition vctDynamicMatrixBase.h:143
ColumnRefType Column(size_type index) CISST_THROW(std
Definition vctDynamicMatrixBase.h:233
Definition vctDynamicVectorBase.h:62
pointer Pointer(index_type index=0)
Definition vctDynamicVectorBase.h:155
value_type & X(void)
Definition vctDynamicVectorBase.h:497
value_type & Y(void)
Definition vctDynamicVectorBase.h:510
value_type & Z(void)
Definition vctDynamicVectorBase.h:523
Dynamic vector referencing existing memory.
Definition vctDynamicVectorRef.h:78
A template for a fixed size matrix with fixed spacing in memory.
Definition vctFixedSizeConstMatrixBase.h:104
const_pointer Pointer(size_type rowIndex, size_type colIndex) const
Definition vctFixedSizeConstMatrixBase.h:329
size_type cols() const
Definition vctFixedSizeConstMatrixBase.h:282
ConstColumnRefType Column(size_type index) const
Definition vctFixedSizeConstMatrixBase.h:406
A template for a fixed length vector with fixed spacing in memory.
Definition vctFixedSizeConstVectorBase.h:108
const value_type & Y(void) const
Definition vctFixedSizeConstVectorBase.h:306
const value_type & X(void) const
Definition vctFixedSizeConstVectorBase.h:298
NormType Norm(void) const
Definition vctFixedSizeConstVectorBase.h:453
const value_type & Z(void) const
Definition vctFixedSizeConstVectorBase.h:314
const_pointer Pointer(size_type index=0) const
Definition vctFixedSizeConstVectorBase.h:268
Definition vctForwardDeclarations.h:86
A template for a fixed size matrix with fixed spacings in memory.
Definition vctFixedSizeMatrixBase.h:60
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition vctFixedSizeMatrixBase.h:161
ColumnRefType Column(size_type index)
Definition vctFixedSizeMatrixBase.h:249
A template for a fixed length vector with fixed spacing in memory.
Definition vctFixedSizeVectorBase.h:77
value_type & Y(void)
Definition vctFixedSizeVectorBase.h:572
value_type & Z(void)
Definition vctFixedSizeVectorBase.h:585
pointer Pointer(size_type index=0)
Definition vctFixedSizeVectorBase.h:226
value_type & X(void)
Definition vctFixedSizeVectorBase.h:559
Implementation of a fixed-size vector using template metaprogramming.
Definition vctFixedSizeVector.h:54
Definition vctForwardDeclarations.h:89
Define a rotation matrix for a space of dimension 3.
Definition vctMatrixRotation3Base.h:71
ThisType Conjugate(void) const
Definition vctQuaternionBase.h:136
ThisType & ConjugateSelf(void)
Definition vctQuaternionBase.h:126
ThisType & ProductOf(const vctQuaternionBase< __containerType1 > &quat1, const vctQuaternionBase< __containerType2 > &quat2)
Definition vctQuaternionBase.h:149
const_reference R(void) const
Definition vctQuaternionBase.h:101
vctQuaternionBase(void)
Definition vctQuaternionBase.h:70
ThisType & ConjugateOf(const vctQuaternionBase< __containerTypeOther > &otherQuaternion)
Definition vctQuaternionBase.h:116
Define a rotation quaternion for a space of dimension 3.
Definition vctQuaternionRotation3Base.h:64
vctQuaternionRotation3Base(const value_type &x, const value_type &y, const value_type &z, const value_type &r, bool normalizeInput)
Definition vctQuaternionRotation3Base.h:252
bool AlmostEquivalent(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition vctQuaternionRotation3Base.h:857
ThisType ApplyInverseTo(const ThisType &input) const
Definition vctQuaternionRotation3Base.h:801
ThisType & From(const ThisType &otherRotation)
Definition vctQuaternionRotation3Base.h:506
void ApplyInverseTo(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &input, vctFixedSizeVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &output) const
Definition vctQuaternionRotation3Base.h:725
vctQuaternionRotation3Base(const vctMatrixRotation3Base< __containerType > &matrixRotation) CISST_THROW(std
Definition vctQuaternionRotation3Base.h:170
ThisType & NormalizedOf(const ThisType &otherQuaternion)
Definition vctQuaternionRotation3Base.h:513
ThisType & FromNormalized(value_type x, value_type y, value_type z, value_type r)
Definition vctQuaternionRotation3Base.h:398
ThisType & FromNormalized(const vctMatrixRotation3Base< __containerType > &matrixRotation)
Definition vctQuaternionRotation3Base.h:428
vctQuaternionRotation3Base(const value_type &x, const value_type &y, const value_type &z, const value_type &r) CISST_THROW(std
Definition vctQuaternionRotation3Base.h:157
ThisType & FromNormalized(const vctQuaternionRotation3Base< __containerType > &other)
Definition vctQuaternionRotation3Base.h:389
void ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition vctQuaternionRotation3Base.h:690
vctQuaternionRotation3Base(void)
Definition vctQuaternionRotation3Base.h:112
vctFixedSizeVector< value_type, DIMENSION > ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition vctQuaternionRotation3Base.h:603
void ApplyTo(const ThisType &input, ThisType &output) const
Definition vctQuaternionRotation3Base.h:663
void ApplyTo(const vctDynamicConstMatrixBase< __matrixOwnerType1, value_type > &input, vctDynamicMatrixBase< __matrixOwnerType2, value_type > &output) const
Definition vctQuaternionRotation3Base.h:641
ContainerType ContainerType
Definition vctQuaternionRotation3Base.h:75
ThisType & FromRaw(const vctMatrixRotation3Base< __containerType > &matrixRotation)
Definition vctQuaternionRotation3Base.h:494
ThisType & InverseOf(const ThisType &otherRotation)
Definition vctQuaternionRotation3Base.h:549
vctQuaternionRotation3Base(const vctAxisAngleRotation3< value_type > &axisAngleRotation, bool normalizeInput)
Definition vctQuaternionRotation3Base.h:288
void Allocate(void)
Definition vctQuaternionRotation3Base.h:106
vctQuaternionRotation3Base(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation) CISST_THROW(std
Definition vctQuaternionRotation3Base.h:193
vctQuaternionRotation3Base(const vctAxisAngleRotation3< value_type > &axisAngleRotation) CISST_THROW(std
Definition vctQuaternionRotation3Base.h:181
void ThrowUnlessIsNormalized(void) const CISST_THROW(std
Definition vctQuaternionRotation3Base.h:85
@ SIZE
Definition vctQuaternionRotation3Base.h:66
ThisType Inverse(void) const
Definition vctQuaternionRotation3Base.h:557
vctFixedSizeVector< value_type, DIMENSION > ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition vctQuaternionRotation3Base.h:745
ThisType & NormalizedSelf(void)
Definition vctQuaternionRotation3Base.h:522
@ DIMENSION
Definition vctQuaternionRotation3Base.h:67
void ThrowUnlessIsNormalized(const _inputType &input) const CISST_THROW(std
Definition vctQuaternionRotation3Base.h:96
void ApplyInverseTo(const vctDynamicConstMatrixBase< __matrixOwnerType1, value_type > &input, vctDynamicMatrixBase< __matrixOwnerType2, value_type > &output) const
Definition vctQuaternionRotation3Base.h:831
cmnTypeTraits< value_type > TypeTraits
Definition vctQuaternionRotation3Base.h:80
CISST_DEPRECATED void GetAxisAngle(vctFixedSizeVectorBase< 3, __stride, value_type, __dataPtrType > &axis, value_type &angle)
Definition vctQuaternionRotation3Base.h:955
ThisType & From(value_type x, value_type y, value_type z, value_type r) CISST_THROW(std
Definition vctQuaternionRotation3Base.h:342
void ApplyTo(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &input, vctFixedSizeVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &output) const
Definition vctQuaternionRotation3Base.h:583
vctQuaternionRotation3Base(const ThisType &quaternionRotation)
Definition vctQuaternionRotation3Base.h:122
void ApplyInverseTo(const ThisType &input, ThisType &output) const
Definition vctQuaternionRotation3Base.h:787
void ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctQuaternionRotation3Base.h:572
ThisType & FromRaw(const vctQuaternionRotation3Base< __containerType > &other)
Definition vctQuaternionRotation3Base.h:450
ThisType Normalized(void) const
Definition vctQuaternionRotation3Base.h:532
ThisType & FromRaw(value_type x, value_type y, value_type z, value_type r)
Definition vctQuaternionRotation3Base.h:456
ThisType & FromNormalized(const vctAxisAngleRotation3< value_type > axisAngleRotation)
Definition vctQuaternionRotation3Base.h:406
vctFixedSizeVector< value_type, DIMENSION > ApplyInverseTo(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &input) const
Definition vctQuaternionRotation3Base.h:754
ThisType & FromRaw(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition vctQuaternionRotation3Base.h:480
ThisType ApplyTo(const ThisType &input) const
Definition vctQuaternionRotation3Base.h:677
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:625
vctFixedSizeVector< value_type, DIMENSION > ApplyTo(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &input) const
Definition vctQuaternionRotation3Base.h:612
ThisType & From(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation) CISST_THROW(std
Definition vctQuaternionRotation3Base.h:358
ThisType & operator=(const ThisType &quaternionRotation)
Definition vctQuaternionRotation3Base.h:129
ThisType operator*(const ThisType &input) const
Definition vctQuaternionRotation3Base.h:881
ThisType & FromNormalized(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition vctQuaternionRotation3Base.h:413
vctQuaternionRotation3Base(const vctMatrixRotation3Base< __containerType > &matrixRotation, bool normalizeInput)
Definition vctQuaternionRotation3Base.h:271
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:767
ThisType & From(const vctAxisAngleRotation3< value_type > axisAngleRotation) CISST_THROW(std
Definition vctQuaternionRotation3Base.h:350
ThisType & From(const vctMatrixRotation3Base< __containerType > &matrixRotation) CISST_THROW(std
Definition vctQuaternionRotation3Base.h:366
ThisType & FromRaw(const vctAxisAngleRotation3< value_type > axisAngleRotation)
Definition vctQuaternionRotation3Base.h:462
void ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition vctQuaternionRotation3Base.h:814
vctQuaternionRotation3Base(const ThisType &quaternionRotation, bool normalizeInput)
Definition vctQuaternionRotation3Base.h:231
vctQuaternionBase< ContainerType > BaseType
Definition vctQuaternionRotation3Base.h:70
CISST_DEPRECATED const ThisType & From(const vctFixedSizeConstVectorBase< 3, __stride, value_type, __dataPtrType > &axis, const AngleType &angle)
Definition vctQuaternionRotation3Base.h:906
vctQuaternionRotation3Base(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation, bool normalizeInput)
Definition vctQuaternionRotation3Base.h:307
void ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctQuaternionRotation3Base.h:714
static CISST_EXPORT const ThisType & Identity()
VCT_CONTAINER_TRAITS_TYPEDEFS(typename ContainerType::value_type)
ThisType & InverseSelf(void)
Definition vctQuaternionRotation3Base.h:542
vctQuaternionRotation3Base< ContainerType > ThisType
Definition vctQuaternionRotation3Base.h:76
Define a rotation based on the rodriguez representation for a space of dimension 3.
Definition vctRodriguezRotation3Base.h:68
ThisType Normalized(void) const
Definition vctRodriguezRotation3Base.h:302
static OutputElementType Operate(const InputElementType &input)
Definition vctUnaryOperations.h:86
#define CMN_ASSERT(expr)
Definition cmnAssert.h:97
#define CISST_EXPORT
Definition cmnExportMacros.h:50
#define CISST_DEPRECATED
Definition cmnPortability.h:314
#define CISST_THROW(exceptionParameter)
Somewhat portable compilation warning message. This works with very recent versions of gcc (4....
Definition cmnPortability.h:559
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
Declaration of vctAxisAngleRotation3.
vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > ThisType
Definition vctDynamicConstMatrixBase.h:86
const value_type & Y(void) const
Definition vctDynamicConstVectorBase.h:271
const value_type & Z(void) const
Definition vctDynamicConstVectorBase.h:279
const value_type & X(void) const
Definition vctDynamicConstVectorBase.h:263
bool IsNormalized(void) const
Definition vctDynamicConstVectorBase.h:414
Macros to export the symbols of cisstVector (in a Dll).
Declaration of vctFixedSizeMatrix.
const bool VCT_DO_NOT_NORMALIZE
Definition vctForwardDeclarations.h:67
Declaration of vctMatrixRotation3Base.
Declaration of vctQuaternionBase.
void vctQuaternionRotation3BaseFromRaw(vctQuaternionRotation3Base< _quaternionType > &quaternionRotation, const vctMatrixRotation3Base< _matrixType > &matrixRotation)
Definition vctQuaternionRotation3Base.h:1027
vctFixedSizeVector< _elementType, 3 > operator*(const vctQuaternionRotation3Base< _containerType > &rotationQuaternion, const vctFixedSizeConstVectorBase< 3, _stride, _elementType, _dataPtrType > &vector)
Definition vctQuaternionRotation3Base.h:977
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:1001
Declaration of vctRodriguezRotation3.