22 #ifndef _vctFrameBase_h
23 #define _vctFrameBase_h
49 template <
class _rotationType>
73 template <str
ide_type __str
ide,
class __dataPtrType>
84 template <
class __containerType>
93 template <
class __containerType>
96 bool normalizeInput) {
117 template <str
ide_type __str
ide,
class __dataPtrType>
132 template <
class __rotationType>
134 throw (std::runtime_error)
136 this->
Rotation().From(other.Rotation());
141 template <
class __rotationType>
148 template <
class __rotationType>
163 template <
class __containerType>
165 throw (std::runtime_error)
167 this->
Rotation().From(other.Rotation());
172 template <
class __containerType>
179 template <
class __containerType>
207 return this->
Rotation().IsNormalized(tolerance);
249 template <str
ide_type __str
ide1,
class __dataPtrType1, str
ide_type __str
ide2,
class __dataPtrType2>
266 template <str
ide_type __str
ide,
class __dataPtrType>
279 template<
class _vectorOwnerType>
333 template <
class _vectorOwnerType1,
class _vectorOwnerType2>
339 cmnThrow(
"vctFrameBase::ApplyTo: size of output is too small");
350 output[0] = result[0];
352 output[1] = result[1];
354 output[2] = result[2];
361 template <
class _vectorOwnerType1, str
ide_type __str
ide2,
class __dataPtrType2>
367 cmnThrow(
"vctFrameBase::ApplyTo: size of input is too small");
403 for (index = 0; index < inputSize; ++index) {
404 this->
ApplyTo(input[index], output[index]);
411 template <
class __matrixOwnerType1,
class __matrixOwnerType2>
427 template <
stride_type __stride1,
class __dataPtrType1,
444 template <
class _vectorOwnerType1,
class _vectorOwnerType2>
453 temp[1] = input[1] - TranslationMember[1];
455 temp[2] = input[2] - TranslationMember[2];
458 output[0] = result[0];
460 output[1] = result[1];
462 output[2] = result[2];
470 template <
class _vectorOwnerType1, str
ide_type __str
ide2,
class __dataPtrType2>
479 temp[1] = input[1] - TranslationMember[1];
481 temp[2] = input[2] - TranslationMember[2];
493 template <str
ide_type __str
ide,
class __dataPtrType>
507 template <
class _vectorOwnerType>
519 inverse.
ApplyTo(input, output);
539 output.
Row(0).
Add(invTranslation[0]);
541 output.
Row(1).
Add(invTranslation[1]);
543 output.
Row(2).
Add(invTranslation[2]);
549 template <
class __matrixOwnerType1,
class __matrixOwnerType2>
558 output.
Row(0).
Add(invTranslation[0]);
560 output.
Row(1).
Add(invTranslation[1]);
562 output.
Row(2).
Add(invTranslation[2]);
570 template <str
ide_type _str
ide,
class _dataPtrType>
580 template<
class _vectorOwnerType>
605 return this->
Equal(other);
647 std::stringstream outputStream;
649 return outputStream.str();
654 outputStream <<
"translation: "
663 void ToStreamRaw(std::ostream & outputStream,
const char delimiter =
' ',
664 bool headerOnly =
false,
const std::string & headerPrefix =
"")
const {
666 outputStream << delimiter;
667 this->
Rotation().ToStreamRaw(outputStream, delimiter, headerOnly, headerPrefix);
677 if ((valid) && !isspace(delimiter)) {
680 valid = (c == delimiter);
695 this->
Rotation().SerializeRaw(outputStream);
702 this->
Rotation().DeSerializeRaw(inputStream);
708 template <
class _rotationType>
713 frame1.
ApplyTo(frame2, result);
717 template <vct::
size_type _cols, vct::str
ide_type _rowStr
ide, vct::str
ide_type _colStr
ide,
class _rotationType,
class _elementType,
class _dataPtrType>
728 template <
class _rotationType>
735 #endif // _vctFrameBase_h
size_t index_type
Definition: vctContainerTraits.h:36
Template base class for a 4x4 frame.
Definition: vctForwardDeclarations.h:234
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
A template for a fixed size matrix with fixed spacing in memory.
Definition: vctFixedSizeConstMatrixBase.h:103
ThisType & FromRaw(const vctFrame4x4ConstBase< __containerType > &other)
Definition: vctFrameBase.h:180
#define CMN_ASSERT(expr)
Definition: cmnAssert.h:90
bool Equal(const ThisType &other) const
Definition: vctFrameBase.h:599
Definition: vctDynamicMatrixBase.h:42
RotationType & Rotation(void)
Definition: vctFrameBase.h:200
ThisType & FromNormalized(const vctFrame4x4ConstBase< __containerType > &other)
Definition: vctFrameBase.h:173
void ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctFrameBase.h:251
vctFrameBase(const vctFrame4x4ConstBase< __containerType > &other)
Definition: vctFrameBase.h:86
bool FromStreamRaw(std::istream &inputStream, const char delimiter= ' ')
Definition: vctFrameBase.h:672
void ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition: vctFrameBase.h:446
vctFrameBase(const vctFrame4x4ConstBase< __containerType > &other, bool normalizeInput)
Definition: vctFrameBase.h:95
void ProductOf(const ThisType &left, ThisType &right)
Definition: vctFrameBase.h:309
void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition: vctFixedSizeConstVectorBase.h:1118
Declaration of vctFixedSizeMatrixBase.
static Type Tolerance(void)
Definition: cmnTypeTraits.h:170
void SerializeRaw(std::ostream &outputStream) const
Definition: vctFixedSizeConstVectorBase.h:1141
void ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition: vctFrameBase.h:335
void ApplyTo(const vctFixedSizeConstMatrixBase< DIMENSION, __cols, __rowStride1, __colStride1, value_type, __dataPtrType1 > &input, vctFixedSizeMatrixBase< DIMENSION, __cols, __rowStride2, __colStride2, value_type, __dataPtrType2 > &output) const
Definition: vctFrameBase.h:380
ThisType & NormalizedSelf(void)
Definition: vctFrameBase.h:212
ThisType & Add(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
Definition: vctFixedSizeVectorBase.h:886
vctFrameBase< _rotationType > operator*(const vctFrameBase< _rotationType > &frame1, const vctFrameBase< _rotationType > &frame2)
Definition: vctFrameBase.h:710
void ToStream(std::ostream &outputStream) const
Definition: vctFrameBase.h:653
size_t size_type
Definition: vctContainerTraits.h:35
ThisType & InverseOf(const ThisType &otherFrame)
Definition: vctFrameBase.h:228
void ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctFrameBase.h:430
vctFixedSizeVector< value_type, DIMENSION > ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &input) const
Definition: vctFrameBase.h:509
vctFrameBase< _rotationType > ThisType
Definition: vctFrameBase.h:55
bool operator==(const ThisType &other) const
Definition: vctFrameBase.h:604
ThisType & Assign(const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
Definition: vctFixedSizeVectorBase.h:274
Definition: vctFrameBase.h:53
Definition: vctDynamicConstMatrixBase.h:77
ThisType Inverse(void) const
Definition: vctFrameBase.h:235
ThisType & Assign(const ThisType &otherFrame)
Definition: vctFrameBase.h:111
ThisType ApplyInverseTo(const ThisType &input) const
Definition: vctFrameBase.h:523
RowRefType Row(size_type index)
Definition: vctDynamicMatrixBase.h:227
bool AlmostEqual(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector, value_type tolerance) const
Definition: vctFixedSizeConstVectorBase.h:701
bool AlmostEqual(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition: vctFrameBase.h:621
size_type size(void) const
Definition: vctDynamicConstVectorBase.h:164
TranslationType TranslationMember
Definition: vctFrameBase.h:62
A template for a fixed size matrix with fixed spacings in memory.
Definition: vctFixedSizeMatrixBase.h:58
bool IsNormalized(value_type tolerance=TypeTraits::Tolerance()) const
Definition: vctFrameBase.h:206
TranslationType & Translation(void)
Definition: vctFrameBase.h:192
ThisType ApplyTo(const ThisType &input) const
Definition: vctFrameBase.h:322
void ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctFrameBase.h:472
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition: vctDynamicMatrixBase.h:143
void ApplyTo(const ThisType &input, ThisType &output) const
Definition: vctFrameBase.h:297
size_type rows() const
Definition: vctDynamicConstMatrixBase.h:238
void ApplyInverseTo(const vctFixedSizeConstMatrixBase< DIMENSION, __cols, __rowStride1, __colStride1, value_type, __dataPtrType1 > &input, vctFixedSizeMatrixBase< DIMENSION, __cols, __rowStride2, __colStride2, value_type, __dataPtrType2 > &output) const
Definition: vctFrameBase.h:533
RotationType RotationMember
Definition: vctFrameBase.h:61
size_type cols() const
Definition: vctDynamicConstMatrixBase.h:243
cmnTypeTraits< value_type > TypeTraits
Definition: vctFrameBase.h:58
void SerializeRaw(std::ostream &outputStream) const
Definition: vctFrameBase.h:692
vctFixedSizeVector< value_type, DIMENSION > ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition: vctFrameBase.h:495
bool FromStreamRaw(std::istream &inputStream, const char delimiter= ' ')
Definition: vctFixedSizeVector.h:266
void DeSerializeRaw(std::istream &inputStream)
Definition: vctFixedSizeVector.h:299
void ApplyTo(size_type inputSize, const vctFixedSizeVector< value_type, DIMENSION > *input, vctFixedSizeVector< value_type, DIMENSION > *output) const
Definition: vctFrameBase.h:399
const TranslationType & Translation(void) const
Definition: vctFrameBase.h:188
ThisType & FromNormalized(const vctFrameBase< __rotationType > &other)
Definition: vctFrameBase.h:142
RowRefType Row(size_type index)
Definition: vctFixedSizeMatrixBase.h:244
const_pointer Pointer(index_type rowIndex, index_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:306
ThisType & Add(const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
Definition: vctDynamicVectorBase.h:816
ThisType & InverseSelf(void)
Definition: vctFrameBase.h:218
std::ostream & operator<<(std::ostream &output, const vctFrameBase< _rotationType > &frame)
Definition: vctFrameBase.h:729
vctFrameBase(const RotationType &rotation, const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &translation)
Definition: vctFrameBase.h:74
#define cmnThrow(a)
Definition: MinimalCmn.h:4
Implementation of a fixed-size matrix using template metaprogramming.
Definition: vctFixedSizeMatrix.h:52
void DeSerializeRaw(std::istream &inputStream)
Definition: vctFrameBase.h:699
ConstRotationRefType Rotation(void) const
Definition: vctFrame4x4ConstBase.h:124
vctFixedSizeVector< value_type, DIMENSION > TranslationType
Definition: vctFrameBase.h:57
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeVectorBase.h:76
void ApplyInverseTo(const vctDynamicConstMatrixBase< __matrixOwnerType1, value_type > &input, vctDynamicMatrixBase< __matrixOwnerType2, value_type > &output) const
Definition: vctFrameBase.h:550
void ApplyInverseTo(const ThisType &input, ThisType &output) const
Definition: vctFrameBase.h:516
bool FromStreamRaw(std::istream &inputStream, const char delimiter= ' ')
Definition: vctFixedSizeMatrixBase.h:1302
std::string ToString(void) const
Definition: vctFrameBase.h:646
ptrdiff_t stride_type
Definition: vctContainerTraits.h:37
vctFixedSizeVector< value_type, DIMENSION > ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition: vctFrameBase.h:268
ThisType & From(const vctFrame4x4ConstBase< __containerType > &other)
Definition: vctFrameBase.h:164
ThisType & SumOf(const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
Definition: vctFixedSizeVectorBase.h:809
vctFrameBase(void)
Definition: vctFrameBase.h:68
vctFixedSizeVector< value_type, DIMENSION > operator*(const vctFixedSizeConstVectorBase< DIMENSION, _stride, value_type, _dataPtrType > &vector) const
Definition: vctFrameBase.h:572
Definition: vctDynamicConstVectorBase.h:77
void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition: vctFrameBase.h:663
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeConstVectorBase.h:107
void SumOf(const PlainObjectBase< OtherDerived1 > &other1, const PlainObjectBase< OtherDerived2 > &other2)
Definition: cisstVectorEigenAddons.h:24
Template base class for a frame.
Definition: vctForwardDeclarations.h:232
bool Equal(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
Definition: vctFixedSizeConstVectorBase.h:684
ThisType & From(const vctFrameBase< __rotationType > &other)
Definition: vctFrameBase.h:133
ConstTranslationRefType Translation(void) const
Definition: vctFrame4x4ConstBase.h:120
bool AlmostEquivalent(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition: vctFrameBase.h:639
void ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctFrameBase.h:363
VCT_CONTAINER_TRAITS_TYPEDEFS(typename _rotationType::value_type)
static CISST_EXPORT const ThisType & Identity()
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 & DifferenceOf(const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
Definition: vctFixedSizeVectorBase.h:820
ThisType & FromRaw(const vctFrameBase< __rotationType > &other)
Definition: vctFrameBase.h:149
void ApplyTo(const vctDynamicConstMatrixBase< __matrixOwnerType1, value_type > &input, vctDynamicMatrixBase< __matrixOwnerType2, value_type > &output) const
Definition: vctFrameBase.h:412
ThisType & Assign(const RotationType &rotation, const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &translation)
Definition: vctFrameBase.h:118
const RotationType & Rotation(void) const
Definition: vctFrameBase.h:196
_rotationType RotationType
Definition: vctFrameBase.h:56
Definition: vctDynamicVectorBase.h:61
vctFixedSizeVector< value_type, DIMENSION > ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &input) const
Definition: vctFrameBase.h:281