22 #ifndef _vctMatrixRotation2Base_h
23 #define _vctMatrixRotation2Base_h
56 template <
class _containerType>
78 cmnThrow(std::runtime_error(
"vctMatrixRotation2Base: This rotation is not normalized"));
86 template <
class _inputType>
88 if (! input.IsNormalized()) {
89 cmnThrow(std::runtime_error(
"vctMatrixRotation2Base: Input is not normalized"));
165 const value_type & element10,
const value_type & element11)
166 throw(std::runtime_error)
169 this->
From(element00, element01,
170 element10, element11);
181 template <
stride_type __stride1,
class __dataPtrType1,
185 bool vectorsAreColumns =
true)
186 throw(std::runtime_error)
189 this->
From(v1, v2, vectorsAreColumns);
198 template <
class __vectorOwnerType1,
199 class __vectorOwnerType2>
202 bool vectorsAreColumns =
true)
203 throw(std::runtime_error)
206 this->
From(v1, v2, vectorsAreColumns);
211 throw(std::runtime_error)
214 this->
From(angleRotation);
255 const value_type & element10,
const value_type & element11,
259 if (normalizeInput) {
261 element10, element11);
263 this->
FromRaw(element00, element01,
264 element10, element11);
276 template <
stride_type __stride1,
class __dataPtrType1,
280 bool vectorsAreColumns,
bool normalizeInput)
283 if (normalizeInput) {
286 this->
FromRaw(v1, v2, vectorsAreColumns);
296 template <
class __vectorOwnerType1,
297 class __vectorOwnerType2>
300 bool vectorsAreColumns,
bool normalizeInput)
303 if (normalizeInput) {
306 this->
FromRaw(v1, v2, vectorsAreColumns);
315 if (normalizeInput) {
334 template <str
ide_type __rowStr
ide, str
ide_type __colStr
ide,
class __dataPtrType>
367 From(
const value_type & element00,
const value_type & element01,
368 const value_type & element10,
const value_type & element11)
369 throw(std::runtime_error)
371 this->
FromRaw(element00, element01,
372 element10, element11);
383 template <
stride_type __stride1,
class __dataPtrType1,
388 bool vectorsAreColumns =
true)
389 throw(std::runtime_error)
391 this->
FromRaw(v1, v2, vectorsAreColumns);
402 template <
class __vectorOwnerType1,
403 class __vectorOwnerType2>
407 bool vectorsAreColumns =
true)
408 throw (std::runtime_error)
410 this->
FromRaw(v1, v2, vectorsAreColumns);
418 throw(std::runtime_error)
421 return this->
FromRaw(angleRotation);
443 const value_type & element10,
const value_type & element11)
445 this->
FromRaw(element00, element01,
446 element10, element11);
457 template <
stride_type __stride1,
class __dataPtrType1,
462 bool vectorsAreColumns =
true)
463 throw(std::runtime_error)
465 this->
FromRaw(v1, v2, vectorsAreColumns);
477 template <
class __vectorOwnerType1,
478 class __vectorOwnerType2>
482 bool vectorsAreColumns =
true)
484 this->
FromRaw(v1, v2, vectorsAreColumns);
515 FromRaw(
const value_type & element00,
const value_type & element01,
516 const value_type & element10,
const value_type & element11)
518 this->
Assign(element00, element01,
519 element10, element11);
529 template <
stride_type __stride1,
class __dataPtrType1,
534 bool vectorsAreColumns =
true)
536 if (vectorsAreColumns) {
537 this->Column(0).Assign(v1);
538 this->Column(1).Assign(v2);
540 this->Row(0).Assign(v1);
541 this->Row(1).Assign(v2);
552 template <
class __vectorOwnerType1,
553 class __vectorOwnerType2>
557 bool vectorsAreColumns =
true)
558 throw (std::runtime_error)
562 if (vectorsAreColumns) {
563 this->Column(0).Assign(v1);
564 this->Column(1).Assign(v2);
566 this->Row(0).Assign(v1);
567 this->Row(1).Assign(v2);
593 template <str
ide_type __rowStr
ide, str
ide_type __colStr
ide,
class __dataPtrType>
621 result.NormalizedSelf();
650 tmp = this->Element(0, 1);
651 this->Element(0, 1) = this->Element(1, 0);
652 this->Element(1, 0) = tmp;
660 this->TransposeOf(otherRotation);
670 result.InverseOf(*
this);
682 template <str
ide_type __str
ide1,
class __dataPtrType1, str
ide_type __str
ide2,
class __dataPtrType2>
699 template <str
ide_type __str
ide,
class __dataPtrType>
717 CMN_ASSERT(input.Pointer() != output.Pointer());
718 output.ProductOf(*
this, input);
732 CMN_ASSERT(input.Pointer() != this->Pointer());
743 template <
class _vectorOwnerType1,
class _vectorOwnerType2>
750 output[0] = this->Element(0, 0) * input[0] + this->Element(0, 1) * input[1];
751 output[1] = this->Element(1, 0) * input[0] + this->Element(1, 1) * input[1];
762 template <str
ide_type __str
ide1,
class __dataPtrType1, str
ide_type __str
ide2,
class __dataPtrType2>
767 output.
ProductOf(this->TransposeRef(), input);
779 template <str
ide_type __str
ide,
class __dataPtrType>
796 CMN_ASSERT(input.Pointer() != output.Pointer());
797 output.ProductOf(this->TransposeRef(), input);
810 CMN_ASSERT(input.Pointer() != this->Pointer());
821 template <
class _vectorOwnerType1,
class _vectorOwnerType2>
829 output[0] = this->Element(0, 0) * input[0] + this->Element(1, 0) * input[1];
830 output[1] = this->Element(0, 1) * input[0] + this->Element(1, 1) * input[1];
848 template <str
ide_type __str
ide,
class __dataPtrType>
864 return this->AlmostEqual(other, tolerance);
870 #endif // _vctMatrixRotation2Base_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
A template for a fixed size matrix with fixed spacing in memory.
Definition: vctFixedSizeConstMatrixBase.h:103
Definition: vctMatrixRotation2Base.h:61
void ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition: vctMatrixRotation2Base.h:823
Declaration of vctDynamicMatrix.
#define CMN_ASSERT(expr)
Definition: cmnAssert.h:90
vctMatrixRotation2Base(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns=true)
Definition: vctMatrixRotation2Base.h:200
void ApplyTo(const ThisType &input, ThisType &output) const
Definition: vctMatrixRotation2Base.h:716
ThisType & FromRaw(const vctFixedSizeMatrixBase< DIMENSION, DIMENSION, __rowStride, __colStride, value_type, __dataPtrType > &matrix)
Definition: vctMatrixRotation2Base.h:595
Define a rotation based on an angle for a space of dimension 2.
Definition: vctAngleRotation2.h:46
vctMatrixRotation2Base(const vctAngleRotation2 &angleRotation, bool normalizeInput)
Definition: vctMatrixRotation2Base.h:311
cmnTypeTraits< value_type > TypeTraits
Definition: vctMatrixRotation2Base.h:71
ThisType & From(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns=true)
Definition: vctMatrixRotation2Base.h:405
vctFixedSizeVector< value_type, 2 > ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition: vctMatrixRotation2Base.h:701
ThisType Normalized(void) const
Definition: vctMatrixRotation2Base.h:619
ThisType & FromRaw(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns=true)
Definition: vctMatrixRotation2Base.h:555
static Type Tolerance(void)
Definition: cmnTypeTraits.h:170
Definition: vctMatrixRotation2Base.h:62
Declaration of vctFixedSizeMatrix.
ThisType & InverseSelf(void)
Definition: vctMatrixRotation2Base.h:647
bool IsNormalized(value_type tolerance=TypeTraits::Tolerance()) const
Definition: vctMatrixRotation2Base.h:633
void ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctMatrixRotation2Base.h:764
CISST_EXPORT ThisType & NormalizedSelf(void)
static CISST_EXPORT const ThisType & Identity()
void ThrowUnlessIsNormalized(const _inputType &input) const
Definition: vctMatrixRotation2Base.h:87
vctFixedSizeVector< value_type, 2 > ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition: vctMatrixRotation2Base.h:781
ThisType operator*(const ThisType &input) const
Definition: vctMatrixRotation2Base.h:839
ThisType ApplyTo(const ThisType &input) const
Definition: vctMatrixRotation2Base.h:731
vctMatrixRotation2Base(const vctFixedSizeConstVectorBase< 2, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< 2, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns=true)
Definition: vctMatrixRotation2Base.h:183
void ThrowUnlessIsNormalized(void) const
Definition: vctMatrixRotation2Base.h:76
Implementation of a fixed-size vector using template metaprogramming.
Definition: vctFixedSizeVector.h:52
vctMatrixRotation2Base(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns, bool normalizeInput)
Definition: vctMatrixRotation2Base.h:298
_containerType ContainerType
Definition: vctMatrixRotation2Base.h:64
vctMatrixRotation2Base(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11, bool normalizeInput)
Definition: vctMatrixRotation2Base.h:254
Define unary operations on an object as classes.
Definition: vctUnaryOperations.h:55
size_type size(void) const
Definition: vctDynamicConstVectorBase.h:164
ThisType & FromRaw(const ThisType &otherRotation)
Definition: vctMatrixRotation2Base.h:580
A template for a fixed size matrix with fixed spacings in memory.
Definition: vctFixedSizeMatrixBase.h:58
vctMatrixRotation2Base(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns, bool normalizeInput)
Definition: vctMatrixRotation2Base.h:278
ThisType & FromRaw(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns=true)
Definition: vctMatrixRotation2Base.h:532
ThisType & NormalizedOf(const ThisType &otherMatrix)
Definition: vctMatrixRotation2Base.h:610
void Assign(const OtherT &other)
Definition: cisstVectorEigenAddons.h:3
Define a rotation matrix for a space of dimension 2.
Definition: vctForwardDeclarations.h:227
vctMatrixRotation2Base(const vctFixedSizeMatrixBase< ROWS, COLS, __rowStride, __colStride, value_type, __dataPtrType > &matrix)
Definition: vctMatrixRotation2Base.h:336
ThisType & FromNormalized(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11)
Definition: vctMatrixRotation2Base.h:442
ThisType & From(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns=true)
Definition: vctMatrixRotation2Base.h:386
const_pointer Pointer(size_type index=0) const
Definition: vctFixedSizeConstVectorBase.h:268
_containerType BaseType
Definition: vctMatrixRotation2Base.h:63
ThisType & FromNormalized(const vctAngleRotation2 &angleRotation)
Definition: vctMatrixRotation2Base.h:491
void ApplyInverseTo(const ThisType &input, ThisType &output) const
Definition: vctMatrixRotation2Base.h:795
#define cmnThrow(a)
Definition: MinimalCmn.h:4
ThisType Normalized(void) const
Definition: vctAngleRotation2.h:319
ThisType & FromNormalized(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &v1, const vctFixedSizeConstVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &v2, bool vectorsAreColumns=true)
Definition: vctMatrixRotation2Base.h:460
const_pointer Pointer(index_type index=0) const
Definition: vctDynamicConstVectorBase.h:221
pointer Pointer(index_type index=0)
Definition: vctDynamicVectorBase.h:155
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeVectorBase.h:76
Definition: vctMatrixRotation2Base.h:61
ptrdiff_t stride_type
Definition: vctContainerTraits.h:37
void Allocate(void)
Definition: vctMatrixRotation2Base.h:98
VCT_CONTAINER_TRAITS_TYPEDEFS(typename ContainerType::value_type)
vctMatrixRotation2Base< ContainerType > ThisType
Definition: vctMatrixRotation2Base.h:65
ThisType & operator=(const ContainerType &other)
Definition: vctMatrixRotation2Base.h:116
Definition: vctDynamicConstVectorBase.h:77
ThisType & FromNormalized(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, bool vectorsAreColumns=true)
Definition: vctMatrixRotation2Base.h:480
vctMatrixRotation2Base(const BaseType &other)
Definition: vctMatrixRotation2Base.h:131
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeConstVectorBase.h:107
ThisType & InverseOf(const ThisType &otherRotation)
Definition: vctMatrixRotation2Base.h:659
ThisType Inverse(void) const
Definition: vctMatrixRotation2Base.h:668
void ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctMatrixRotation2Base.h:684
pointer Pointer(size_type index=0)
Definition: vctFixedSizeVectorBase.h:226
vctMatrixRotation2Base()
Definition: vctMatrixRotation2Base.h:104
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
ThisType ApplyInverseTo(const ThisType &input) const
Definition: vctMatrixRotation2Base.h:809
Declaration of vctAngleRotation2.
vctMatrixRotation2Base(const ThisType &other)
Definition: vctMatrixRotation2Base.h:124
vctMatrixRotation2Base(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11)
Definition: vctMatrixRotation2Base.h:164
void ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition: vctMatrixRotation2Base.h:745
vctMatrixRotation2Base(const vctAngleRotation2 &angleRotation)
Definition: vctMatrixRotation2Base.h:210
ThisType & ProductOf(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type scalar)
Definition: vctFixedSizeVectorBase.h:1003
Definition: vctDynamicVectorBase.h:61
ThisType & FromRaw(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11)
Definition: vctMatrixRotation2Base.h:515
ThisType & From(const vctAngleRotation2 &angleRotation)
Definition: vctMatrixRotation2Base.h:417
ThisType & From(const value_type &element00, const value_type &element01, const value_type &element10, const value_type &element11)
Definition: vctMatrixRotation2Base.h:367
bool AlmostEquivalent(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition: vctMatrixRotation2Base.h:862