20#ifndef _vctMatrixRotation3Base_h
21#define _vctMatrixRotation3Base_h
40template <
class _matrixType,
class _quaternionType>
69template <
class _containerType>
104 template <
class __containerType>
122 this->
FromRaw(element00, element01, element02,
123 element10, element11, element12,
124 element20, element21, element22);
135 template <stride_type __stride1,
class __dataPtrType1,
136 stride_type __stride2,
class __dataPtrType2,
137 stride_type __stride3,
class __dataPtrType3>
142 bool vectorsAreColumns =
true)
145 this->
FromRaw(v1, v2, v3, vectorsAreColumns);
157 template <
class __vectorOwnerType1,
158 class __vectorOwnerType2,
159 class __vectorOwnerType3>
164 bool vectorsAreColumns =
true)
167 this->
FromRaw(v1, v2, v3, vectorsAreColumns);
178 return this->
FromRaw(axisAngleRotation);
182 template <
class __containerType>
188 return this->
FromRaw(quaternionRotation);
193 template <
class __containerType>
199 return this->
FromRaw(rodriguezRotation);
203 template <vctEulerRotation3Order::OrderType __order>
209 return this->
FromRaw(eulerRotation);
230 template <
class __containerType>
247 this->
FromRaw(element00, element01, element02,
248 element10, element11, element12,
249 element20, element21, element22);
260 template <stride_type __stride1,
class __dataPtrType1,
261 stride_type __stride2,
class __dataPtrType2,
262 stride_type __stride3,
class __dataPtrType3>
267 bool vectorsAreColumns =
true)
270 this->
FromRaw(v1, v2, v3, vectorsAreColumns);
282 template <
class __vectorOwnerType1,
283 class __vectorOwnerType2,
284 class __vectorOwnerType3>
289 bool vectorsAreColumns =
true)
291 this->
FromRaw(v1, v2, v3, vectorsAreColumns);
308 template <
class __containerType>
317 template <
class __containerType>
326 template <vctEulerRotation3Order::OrderType __order>
350 template <
class __containerType>
366 this->Assign(element00, element01, element02,
367 element10, element11, element12,
368 element20, element21, element22);
379 template <stride_type __stride1,
class __dataPtrType1,
380 stride_type __stride2,
class __dataPtrType2,
381 stride_type __stride3,
class __dataPtrType3>
386 bool vectorsAreColumns =
true)
388 if (vectorsAreColumns) {
389 this->
Column(0).Assign(v1);
390 this->
Column(1).Assign(v2);
391 this->
Column(2).Assign(v3);
393 this->
Row(0).Assign(v1);
394 this->
Row(1).Assign(v2);
395 this->
Row(2).Assign(v3);
407 template <
class __vectorOwnerType1,
408 class __vectorOwnerType2,
409 class __vectorOwnerType3>
414 bool vectorsAreColumns =
true)
420 if (vectorsAreColumns) {
421 this->
Column(0).Assign(v1);
422 this->
Column(1).Assign(v2);
423 this->
Column(2).Assign(v3);
425 this->
Row(0).Assign(v1);
426 this->
Row(1).Assign(v2);
427 this->
Row(2).Assign(v3);
439 template <
class __containerType>
448 template <
class __containerType>
455 template <vctEulerRotation3Order::OrderType __order>
458 vctEulerToMatrixRotation3(eulerRotation, *
this);
467 return reinterpret_cast<ThisType &
>(this->Assign(otherRotation));
480 template <str
ide_type __rowStr
ide, str
ide_type __colStr
ide,
class __dataPtrType>
483 this->Assign(matrix);
495 this->
From(quaternion);
503 CMN_ASSERT(otherMatrix.Pointer() != this->Pointer());
527 CMN_ASSERT(otherRotation.Pointer() != this->Pointer());
528 this->TransposeOf(otherRotation);
535template <
class _containerType>
541 const typename AxisAngleType::AngleType angle = axisAngleRotation.
Angle();
542 const typename AxisAngleType::AxisType axis = axisAngleRotation.
Axis();
544 const AngleType sinAngle = AngleType(sin(angle));
545 const AngleType cosAngle = AngleType(cos(angle));
546 const AngleType CompCosAngle = 1 - cosAngle;
550 this->
Element(1, 0) =
value_type(axis[0] * axis[1] * CompCosAngle + axis[2] * sinAngle);
551 this->
Element(2, 0) =
value_type(axis[0] * axis[2] * CompCosAngle - axis[1] * sinAngle);
554 this->
Element(0, 1) =
value_type(axis[1] * axis[0] * CompCosAngle - axis[2] * sinAngle);
556 this->
Element(2, 1) =
value_type(axis[1] * axis[2] * CompCosAngle + axis[0] * sinAngle);
559 this->
Element(0, 2) =
value_type(axis[2] * axis[0] * CompCosAngle + axis[1] * sinAngle);
560 this->
Element(1, 2) =
value_type(axis[2] * axis[1] * CompCosAngle - axis[0] * sinAngle);
567template <
class _matrixType,
class _quaternionType>
572 typedef typename _matrixType::value_type
value_type;
574 value_type xx = quaternionRotation.X() * quaternionRotation.X();
575 value_type xy = quaternionRotation.X() * quaternionRotation.Y();
576 value_type xz = quaternionRotation.X() * quaternionRotation.Z();
577 value_type xr = quaternionRotation.X() * quaternionRotation.
R();
578 value_type yy = quaternionRotation.Y() * quaternionRotation.Y();
579 value_type yz = quaternionRotation.Y() * quaternionRotation.Z();
580 value_type yr = quaternionRotation.Y() * quaternionRotation.
R();
581 value_type zz = quaternionRotation.Z() * quaternionRotation.Z();
582 value_type zr = quaternionRotation.Z() * quaternionRotation.
R();
583 matrixRotation.Assign(1 - 2 * (yy + zz), 2 * (xy - zr), 2 * (xz + yr),
584 2 * (xy + zr), 1 - 2 * (xx + zz), 2 * (yz - xr),
585 2 * (xz - yr), 2 * (yz + xr), 1 - 2 * (xx + yy));
A collection of useful information about the C++ basic types, represented in a generic programming wa...
Definition cmnTypeTraits.h:155
_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:119
Definition vctEulerRotation3.h:154
ThisType Normalized(void) const
Definition vctEulerRotation3.h:248
A template for a fixed length vector with fixed spacing in memory.
Definition vctFixedSizeConstVectorBase.h:108
A template for a fixed size matrix with fixed spacings in memory.
Definition vctFixedSizeMatrixBase.h:60
Define a rotation matrix for a space of dimension 3.
Definition vctMatrixRotation3Base.h:71
vctMatrixRotation3Base< ContainerType > ThisType
Definition vctMatrixRotation3Base.h:77
ThisType & FromRaw(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, const vctFixedSizeConstVectorBase< DIMENSION, __stride3, value_type, __dataPtrType3 > &v3, bool vectorsAreColumns=true)
Definition vctMatrixRotation3Base.h:383
ThisType & FromNormalized(const vctEulerRotation3< __order > &eulerRotation)
Definition vctMatrixRotation3Base.h:328
ThisType & FromRaw(const value_type &element00, const value_type &element01, const value_type &element02, const value_type &element10, const value_type &element11, const value_type &element12, const value_type &element20, const value_type &element21, const value_type &element22)
Definition vctMatrixRotation3Base.h:362
@ ROWS
Definition vctMatrixRotation3Base.h:73
@ COLS
Definition vctMatrixRotation3Base.h:73
ThisType & FromRaw(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, const vctDynamicConstVectorBase< __vectorOwnerType3, value_type > &v3, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation3Base.h:411
vctMatrixRotation3Base()
Definition vctMatrixRotation3Base.h:87
ThisType & From(const value_type &element00, const value_type &element01, const value_type &element02, const value_type &element10, const value_type &element11, const value_type &element12, const value_type &element20, const value_type &element21, const value_type &element22) CISST_THROW(std
Definition vctMatrixRotation3Base.h:117
ThisType & FromNormalized(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition vctMatrixRotation3Base.h:319
ThisType & From(const vctQuaternionRotation3Base< __containerType > &quaternionRotation) CISST_THROW(std
Definition vctMatrixRotation3Base.h:184
ThisType & FromNormalized(const vctMatrixRotation3Base< __containerType > &other) CISST_THROW(std
Definition vctMatrixRotation3Base.h:232
ThisType & From(const vctMatrixRotation3Base< __containerType > &other) CISST_THROW(std
Definition vctMatrixRotation3Base.h:106
ThisType & FromRaw(const vctAxisAngleRotation3< value_type > &axisAngleRotation)
@ DIMENSION
Definition vctMatrixRotation3Base.h:74
ThisType & From(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation) CISST_THROW(std
Definition vctMatrixRotation3Base.h:195
vctMatrixRotation3ConstBase< ContainerType > BaseType
Definition vctMatrixRotation3Base.h:76
VCT_CONTAINER_TRAITS_TYPEDEFS(typename ContainerType::value_type)
ThisType & FromNormalized(const vctQuaternionRotation3Base< __containerType > &quaternionRotation)
Definition vctMatrixRotation3Base.h:310
ThisType & InverseOf(const ThisType &otherRotation)
Definition vctMatrixRotation3Base.h:526
ThisType & FromRaw(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition vctMatrixRotation3Base.h:450
ThisType & From(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, const vctDynamicConstVectorBase< __vectorOwnerType3, value_type > &v3, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation3Base.h:161
ThisType & NormalizedOf(ThisType &otherMatrix)
Definition vctMatrixRotation3Base.h:502
vctMatrixRotation3Base< typename ContainerType::MatrixValueType > RotationValueType
Definition vctMatrixRotation3Base.h:78
ThisType & From(const vctAxisAngleRotation3< value_type > &axisAngleRotation) CISST_THROW(std
Definition vctMatrixRotation3Base.h:174
cmnTypeTraits< value_type > TypeTraits
Definition vctMatrixRotation3Base.h:84
ThisType & FromRaw(const vctMatrixRotation3Base< __containerType > &other) CISST_THROW(std
Definition vctMatrixRotation3Base.h:352
ThisType & FromRaw(const ThisType &otherRotation)
Definition vctMatrixRotation3Base.h:466
ThisType & FromRaw(const vctQuaternionRotation3Base< __containerType > &quaternionRotation)
Definition vctMatrixRotation3Base.h:441
ContainerType ContainerType
Definition vctMatrixRotation3Base.h:75
ThisType & FromNormalized(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, const vctDynamicConstVectorBase< __vectorOwnerType3, value_type > &v3, bool vectorsAreColumns=true)
Definition vctMatrixRotation3Base.h:286
ThisType & FromRaw(const vctFixedSizeMatrixBase< ROWS, COLS, __rowStride, __colStride, value_type, __dataPtrType > &matrix)
Definition vctMatrixRotation3Base.h:482
ThisType & From(const vctEulerRotation3< __order > &eulerRotation) CISST_THROW(std
Definition vctMatrixRotation3Base.h:205
ThisType & From(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, const vctFixedSizeConstVectorBase< DIMENSION, __stride3, value_type, __dataPtrType3 > &v3, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation3Base.h:139
ThisType & NormalizedSelf(void)
Definition vctMatrixRotation3Base.h:491
ThisType & InverseSelf(void)
Definition vctMatrixRotation3Base.h:513
ThisType & FromNormalized(const vctAxisAngleRotation3< value_type > &axisAngleRotation)
Definition vctMatrixRotation3Base.h:298
ThisType & FromNormalized(const value_type &element00, const value_type &element01, const value_type &element02, const value_type &element10, const value_type &element11, const value_type &element12, const value_type &element20, const value_type &element21, const value_type &element22)
Definition vctMatrixRotation3Base.h:243
ThisType & FromRaw(const vctEulerRotation3< __order > &eulerRotation)
Definition vctMatrixRotation3Base.h:457
ThisType & FromNormalized(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, const vctFixedSizeConstVectorBase< DIMENSION, __stride3, value_type, __dataPtrType3 > &v3, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation3Base.h:264
Define a rotation matrix for a space of dimension 3.
Definition vctMatrixRotation3ConstBase.h:56
void ThrowUnlessIsNormalized(void) const CISST_THROW(std
Definition vctMatrixRotation3ConstBase.h:76
const_reference R(void) const
Definition vctQuaternionBase.h:101
Define a rotation quaternion for a space of dimension 3.
Definition vctQuaternionRotation3Base.h:64
ThisType & NormalizedSelf(void)
Definition vctQuaternionRotation3Base.h:522
ThisType & FromRaw(const vctQuaternionRotation3Base< __containerType > &other)
Definition vctQuaternionRotation3Base.h:450
ThisType Normalized(void) const
Definition vctQuaternionRotation3Base.h:532
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
#define CMN_ASSERT(expr)
Definition cmnAssert.h:97
#define CISST_THROW(exceptionParameter)
Somewhat portable compilation warning message. This works with very recent versions of gcc (4....
Definition cmnPortability.h:559
Declaration of vctAxisAngleRotation3.
ConstRowRefType Row(size_type index) const CISST_THROW(std
Definition vctDynamicConstMatrixBase.h:367
const_reference Element(size_type rowIndex, size_type colIndex) const
Definition vctDynamicConstMatrixBase.h:362
ConstColumnRefType Column(size_type index) const CISST_THROW(std
Definition vctDynamicConstMatrixBase.h:372
vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > ThisType
Definition vctDynamicConstMatrixBase.h:86
Declaration of vctEulerRotation3.
Macros to export the symbols of cisstVector (in a Dll).
const bool VCT_DO_NOT_NORMALIZE
Definition vctForwardDeclarations.h:67
void vctMatrixRotation3BaseFromRaw(vctMatrixRotation3Base< _matrixType > &matrixRotation, const vctQuaternionRotation3Base< _quaternionType > &quaternionRotation)
Definition vctMatrixRotation3Base.h:569
Declaration of vctMatrixRotation3ConstBase.
Declaration of vctQuaternionRotation3Base.
Declaration of vctRodriguezRotation3Base.