20#ifndef _vctMatrixRotation2Base_h
21#define _vctMatrixRotation2Base_h
54template <
class _containerType>
76 cmnThrow(std::runtime_error(
"vctMatrixRotation2Base: This rotation is not normalized"));
84 template <
class _inputType>
86 if (! input.IsNormalized()) {
87 cmnThrow(std::runtime_error(
"vctMatrixRotation2Base: Input is not normalized"));
115 return reinterpret_cast<ThisType &
>(this->Assign(other));
119 return reinterpret_cast<ThisType &
>(this->Assign(other));
167 this->
From(element00, element01,
168 element10, element11);
179 template <stride_type __stride1,
class __dataPtrType1,
180 stride_type __stride2,
class __dataPtrType2>
183 bool vectorsAreColumns =
true)
187 this->
From(v1, v2, vectorsAreColumns);
196 template <
class __vectorOwnerType1,
197 class __vectorOwnerType2>
200 bool vectorsAreColumns =
true)
204 this->
From(v1, v2, vectorsAreColumns);
212 this->
From(angleRotation);
257 if (normalizeInput) {
259 element10, element11);
261 this->
FromRaw(element00, element01,
262 element10, element11);
274 template <stride_type __stride1,
class __dataPtrType1,
275 stride_type __stride2,
class __dataPtrType2>
278 bool vectorsAreColumns,
bool normalizeInput)
281 if (normalizeInput) {
284 this->
FromRaw(v1, v2, vectorsAreColumns);
294 template <
class __vectorOwnerType1,
295 class __vectorOwnerType2>
298 bool vectorsAreColumns,
bool normalizeInput)
301 if (normalizeInput) {
304 this->
FromRaw(v1, v2, vectorsAreColumns);
313 if (normalizeInput) {
332 template <str
ide_type __rowStr
ide, str
ide_type __colStr
ide,
class __dataPtrType>
336 this->Assign(matrix);
369 this->
FromRaw(element00, element01,
370 element10, element11);
381 template <stride_type __stride1,
class __dataPtrType1,
382 stride_type __stride2,
class __dataPtrType2>
386 bool vectorsAreColumns =
true)
389 this->
FromRaw(v1, v2, vectorsAreColumns);
400 template <
class __vectorOwnerType1,
401 class __vectorOwnerType2>
405 bool vectorsAreColumns =
true)
408 this->
FromRaw(v1, v2, vectorsAreColumns);
419 return this->
FromRaw(angleRotation);
443 this->
FromRaw(element00, element01,
444 element10, element11);
455 template <stride_type __stride1,
class __dataPtrType1,
456 stride_type __stride2,
class __dataPtrType2>
460 bool vectorsAreColumns =
true)
463 this->
FromRaw(v1, v2, vectorsAreColumns);
475 template <
class __vectorOwnerType1,
476 class __vectorOwnerType2>
480 bool vectorsAreColumns =
true)
482 this->
FromRaw(v1, v2, vectorsAreColumns);
516 this->Assign(element00, element01,
517 element10, element11);
527 template <stride_type __stride1,
class __dataPtrType1,
528 stride_type __stride2,
class __dataPtrType2>
532 bool vectorsAreColumns =
true)
534 if (vectorsAreColumns) {
535 this->
Column(0).Assign(v1);
536 this->
Column(1).Assign(v2);
538 this->
Row(0).Assign(v1);
539 this->
Row(1).Assign(v2);
550 template <
class __vectorOwnerType1,
551 class __vectorOwnerType2>
555 bool vectorsAreColumns =
true)
560 if (vectorsAreColumns) {
561 this->
Column(0).Assign(v1);
562 this->
Column(1).Assign(v2);
564 this->
Row(0).Assign(v1);
565 this->
Row(1).Assign(v2);
579 return reinterpret_cast<ThisType &
>(this->Assign(otherRotation));
591 template <str
ide_type __rowStr
ide, str
ide_type __colStr
ide,
class __dataPtrType>
594 this->Assign(matrix);
658 this->TransposeOf(otherRotation);
680 template <str
ide_type __str
ide1,
class __dataPtrType1, str
ide_type __str
ide2,
class __dataPtrType2>
697 template <str
ide_type __str
ide,
class __dataPtrType>
715 CMN_ASSERT(input.Pointer() != output.Pointer());
716 output.ProductOf(*
this, input);
730 CMN_ASSERT(input.Pointer() != this->Pointer());
741 template <
class _vectorOwnerType1,
class _vectorOwnerType2>
748 output[0] = this->
Element(0, 0) * input[0] + this->
Element(0, 1) * input[1];
749 output[1] = this->
Element(1, 0) * input[0] + this->
Element(1, 1) * input[1];
760 template <str
ide_type __str
ide1,
class __dataPtrType1, str
ide_type __str
ide2,
class __dataPtrType2>
777 template <str
ide_type __str
ide,
class __dataPtrType>
794 CMN_ASSERT(input.Pointer() != output.Pointer());
808 CMN_ASSERT(input.Pointer() != this->Pointer());
819 template <
class _vectorOwnerType1,
class _vectorOwnerType2>
827 output[0] = this->
Element(0, 0) * input[0] + this->
Element(1, 0) * input[1];
828 output[1] = this->
Element(0, 1) * input[0] + this->
Element(1, 1) * input[1];
846 template <str
ide_type __str
ide,
class __dataPtrType>
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 angle for a space of dimension 2.
Definition vctAngleRotation2.h:45
ThisType Normalized(void) const
Definition vctAngleRotation2.h:317
Definition vctForwardDeclarations.h:119
Definition vctDynamicVectorBase.h:62
pointer Pointer(index_type index=0)
Definition vctDynamicVectorBase.h:155
A template for a fixed length vector with fixed spacing in memory.
Definition vctFixedSizeConstVectorBase.h:108
const_pointer Pointer(size_type index=0) const
Definition vctFixedSizeConstVectorBase.h:268
A template for a fixed size matrix with fixed spacings in memory.
Definition vctFixedSizeMatrixBase.h:60
A template for a fixed length vector with fixed spacing in memory.
Definition vctFixedSizeVectorBase.h:77
ThisType & ProductOf(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type scalar)
Definition vctFixedSizeVectorBase.h:1003
pointer Pointer(size_type index=0)
Definition vctFixedSizeVectorBase.h:226
Implementation of a fixed-size vector using template metaprogramming.
Definition vctFixedSizeVector.h:54
ThisType & FromRaw(const ThisType &otherRotation)
Definition vctMatrixRotation2Base.h:578
ThisType & From(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation2Base.h:403
@ COLS
Definition vctMatrixRotation2Base.h:59
@ ROWS
Definition vctMatrixRotation2Base.h:59
void ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition vctMatrixRotation2Base.h:743
ThisType Normalized(void) const
Definition vctMatrixRotation2Base.h:617
ThisType & FromRaw(const vctFixedSizeMatrixBase< DIMENSION, DIMENSION, __rowStride, __colStride, value_type, __dataPtrType > &matrix)
Definition vctMatrixRotation2Base.h:593
vctMatrixRotation2Base(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns, bool normalizeInput)
Definition vctMatrixRotation2Base.h:296
ThisType ApplyTo(const ThisType &input) const
Definition vctMatrixRotation2Base.h:729
void ApplyInverseTo(const ThisType &input, ThisType &output) const
Definition vctMatrixRotation2Base.h:793
vctFixedSizeVector< value_type, 2 > ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition vctMatrixRotation2Base.h:699
bool AlmostEquivalent(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition vctMatrixRotation2Base.h:860
ThisType & From(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation2Base.h:384
ThisType & InverseOf(const ThisType &otherRotation)
Definition vctMatrixRotation2Base.h:657
vctMatrixRotation2Base(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation2Base.h:198
ContainerType BaseType
Definition vctMatrixRotation2Base.h:61
ThisType ApplyInverseTo(const ThisType &input) const
Definition vctMatrixRotation2Base.h:807
vctMatrixRotation2Base(const vctFixedSizeMatrixBase< ROWS, COLS, __rowStride, __colStride, value_type, __dataPtrType > &matrix)
Definition vctMatrixRotation2Base.h:334
vctMatrixRotation2Base< ContainerType > ThisType
Definition vctMatrixRotation2Base.h:63
vctMatrixRotation2Base(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11) CISST_THROW(std
Definition vctMatrixRotation2Base.h:162
void ThrowUnlessIsNormalized(void) const CISST_THROW(std
Definition vctMatrixRotation2Base.h:74
ThisType & FromNormalized(const vctAngleRotation2 &angleRotation)
Definition vctMatrixRotation2Base.h:489
void ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctMatrixRotation2Base.h:682
vctMatrixRotation2Base(const BaseType &other)
Definition vctMatrixRotation2Base.h:129
VCT_CONTAINER_TRAITS_TYPEDEFS(typename ContainerType::value_type)
void ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition vctMatrixRotation2Base.h:821
void ApplyTo(const ThisType &input, ThisType &output) const
Definition vctMatrixRotation2Base.h:714
vctMatrixRotation2Base()
Definition vctMatrixRotation2Base.h:102
ThisType & FromNormalized(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11)
Definition vctMatrixRotation2Base.h:440
vctMatrixRotation2Base(const vctAngleRotation2 &angleRotation, bool normalizeInput)
Definition vctMatrixRotation2Base.h:309
ThisType & From(const vctAngleRotation2 &angleRotation) CISST_THROW(std
Definition vctMatrixRotation2Base.h:415
ThisType & FromRaw(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11)
Definition vctMatrixRotation2Base.h:513
vctMatrixRotation2Base(const vctFixedSizeConstVectorBase< 2, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< 2, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation2Base.h:181
ThisType & FromRaw(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation2Base.h:553
@ DIMENSION
Definition vctMatrixRotation2Base.h:60
ThisType & operator=(const ContainerType &other)
Definition vctMatrixRotation2Base.h:114
ThisType & From(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11) CISST_THROW(std
Definition vctMatrixRotation2Base.h:365
void ThrowUnlessIsNormalized(const _inputType &input) const CISST_THROW(std
Definition vctMatrixRotation2Base.h:85
vctMatrixRotation2Base(const ThisType &other)
Definition vctMatrixRotation2Base.h:122
ThisType operator*(const ThisType &input) const
Definition vctMatrixRotation2Base.h:837
ThisType & FromNormalized(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns=true) CISST_THROW(std
Definition vctMatrixRotation2Base.h:458
ThisType Inverse(void) const
Definition vctMatrixRotation2Base.h:666
CISST_EXPORT ThisType & FromRaw(const vctAngleRotation2 &angleRotation)
static CISST_EXPORT const ThisType & Identity()
cmnTypeTraits< value_type > TypeTraits
Definition vctMatrixRotation2Base.h:69
CISST_EXPORT ThisType & NormalizedSelf(void)
ContainerType ContainerType
Definition vctMatrixRotation2Base.h:62
ThisType & FromNormalized(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns=true)
Definition vctMatrixRotation2Base.h:478
vctMatrixRotation2Base(const vctAngleRotation2 &angleRotation) CISST_THROW(std
Definition vctMatrixRotation2Base.h:208
vctMatrixRotation2Base(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11, bool normalizeInput)
Definition vctMatrixRotation2Base.h:252
ThisType & NormalizedOf(const ThisType &otherMatrix)
Definition vctMatrixRotation2Base.h:608
void ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctMatrixRotation2Base.h:762
vctMatrixRotation2Base(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns, bool normalizeInput)
Definition vctMatrixRotation2Base.h:276
ThisType & FromRaw(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns=true)
Definition vctMatrixRotation2Base.h:530
bool IsNormalized(value_type tolerance=TypeTraits::Tolerance()) const
Definition vctMatrixRotation2Base.h:631
ThisType & InverseSelf(void)
Definition vctMatrixRotation2Base.h:645
void Allocate(void)
Definition vctMatrixRotation2Base.h:96
vctFixedSizeVector< value_type, 2 > ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition vctMatrixRotation2Base.h:779
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_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 vctAngleRotation2.
ConstRowRefType Row(size_type index) const CISST_THROW(std
Definition vctDynamicConstMatrixBase.h:367
bool AlmostEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix, value_type tolerance) const
Definition vctDynamicConstMatrixBase.h:721
ConstRefTransposeType TransposeRef(void) const
Definition vctDynamicConstMatrixBase.h:980
const_reference Element(size_type rowIndex, size_type colIndex) const
Definition vctDynamicConstMatrixBase.h:362
NormType Norm(void) const
Definition vctDynamicConstMatrixBase.h:467
ConstColumnRefType Column(size_type index) const CISST_THROW(std
Definition vctDynamicConstMatrixBase.h:372
vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > ThisType
Definition vctDynamicConstMatrixBase.h:86
value_type DotProduct(const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector) const
Definition vctDynamicConstVectorBase.h:633
Declaration of vctDynamicMatrix.
Macros to export the symbols of cisstVector (in a Dll).
Declaration of vctFixedSizeMatrix.