20#ifndef _vctFrameBase_h
21#define _vctFrameBase_h
47template <
class _rotationType>
71 template <str
ide_type __str
ide,
class __dataPtrType>
82 template <
class __containerType>
91 template <
class __containerType>
94 bool normalizeInput) {
115 template <str
ide_type __str
ide,
class __dataPtrType>
130 template <
class __rotationType>
134 this->
Rotation().From(other.Rotation());
139 template <
class __rotationType>
146 template <
class __rotationType>
161 template <
class __containerType>
165 this->
Rotation().From(other.Rotation());
170 template <
class __containerType>
177 template <
class __containerType>
227 return this->
Rotation().IsNormalized(tolerance);
269 template <str
ide_type __str
ide1,
class __dataPtrType1, str
ide_type __str
ide2,
class __dataPtrType2>
286 template <str
ide_type __str
ide,
class __dataPtrType>
299 template<
class _vectorOwnerType>
353 template <
class _vectorOwnerType1,
class _vectorOwnerType2>
359 cmnThrow(
"vctFrameBase::ApplyTo: size of output is too small");
370 output[0] = result[0];
372 output[1] = result[1];
374 output[2] = result[2];
381 template <
class _vectorOwnerType1, str
ide_type __str
ide2,
class __dataPtrType2>
387 cmnThrow(
"vctFrameBase::ApplyTo: size of input is too small");
397 template <size_type __cols,
398 stride_type __rowStride1, stride_type __colStride1,
class __dataPtrType1,
399 stride_type __rowStride2, stride_type __colStride2,
class __dataPtrType2>
423 for (index = 0; index < inputSize; ++index) {
424 this->
ApplyTo(input[index], output[index]);
431 template <
class __matrixOwnerType1,
class __matrixOwnerType2>
447 template <stride_type __stride1,
class __dataPtrType1,
448 stride_type __stride2,
class __dataPtrType2>
464 template <
class _vectorOwnerType1,
class _vectorOwnerType2>
478 output[0] = result[0];
480 output[1] = result[1];
482 output[2] = result[2];
490 template <
class _vectorOwnerType1, str
ide_type __str
ide2,
class __dataPtrType2>
513 template <str
ide_type __str
ide,
class __dataPtrType>
527 template <
class _vectorOwnerType>
539 inverse.
ApplyTo(input, output);
550 template <size_type __cols,
551 stride_type __rowStride1, stride_type __colStride1,
class __dataPtrType1,
552 stride_type __rowStride2, stride_type __colStride2,
class __dataPtrType2>
559 output.
Row(0).Add(invTranslation[0]);
561 output.
Row(1).Add(invTranslation[1]);
563 output.
Row(2).Add(invTranslation[2]);
569 template <
class __matrixOwnerType1,
class __matrixOwnerType2>
578 output.
Row(0).Add(invTranslation[0]);
580 output.
Row(1).Add(invTranslation[1]);
582 output.
Row(2).Add(invTranslation[2]);
590 template <str
ide_type _str
ide,
class _dataPtrType>
600 template<
class _vectorOwnerType>
625 return this->
Equal(other);
667 std::stringstream outputStream;
669 return outputStream.str();
674 outputStream <<
"translation: "
683 void ToStreamRaw(std::ostream & outputStream,
const char delimiter =
' ',
684 bool headerOnly =
false,
const std::string & headerPrefix =
"")
const {
686 outputStream << delimiter;
687 this->
Rotation().ToStreamRaw(outputStream, delimiter, headerOnly, headerPrefix);
697 if ((valid) && !isspace(delimiter)) {
700 valid = (c == delimiter);
703 valid = rot.FromStreamRaw(inputStream, delimiter);
715 this->
Rotation().SerializeRaw(outputStream);
722 this->
Rotation().DeSerializeRaw(inputStream);
728template <
class _rotationType>
733 frame1.
ApplyTo(frame2, result);
737template <vct::
size_type _cols, vct::str
ide_type _rowStr
ide, vct::str
ide_type _colStr
ide,
class _rotationType,
class _elementType,
class _dataPtrType>
748template <
class _rotationType>
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
Definition vctForwardDeclarations.h:145
Definition vctForwardDeclarations.h:119
Definition vctDynamicMatrixBase.h:43
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition vctDynamicMatrixBase.h:143
RowRefType Row(size_type index) CISST_THROW(std
Definition vctDynamicMatrixBase.h:227
Definition vctDynamicVectorBase.h:62
A template for a fixed size matrix with fixed spacing in memory.
Definition vctFixedSizeConstMatrixBase.h:104
A template for a fixed length vector with fixed spacing in memory.
Definition vctFixedSizeConstVectorBase.h:108
void ToStreamRaw(std::ostream &outputStream, const char delimiter=' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition vctFixedSizeConstVectorBase.h:1118
void SerializeRaw(std::ostream &outputStream) const
Definition vctFixedSizeConstVectorBase.h:1141
bool Equal(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
Definition vctFixedSizeConstVectorBase.h:684
bool AlmostEqual(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector, value_type tolerance) const
Definition vctFixedSizeConstVectorBase.h:701
A template for a fixed size matrix with fixed spacings in memory.
Definition vctFixedSizeMatrixBase.h:60
RowRefType Row(size_type index)
Definition vctFixedSizeMatrixBase.h:244
Implementation of a fixed-size matrix using template metaprogramming.
Definition vctFixedSizeMatrix.h:54
A template for a fixed length vector with fixed spacing in memory.
Definition vctFixedSizeVectorBase.h:77
ThisType & SumOf(const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
Definition vctFixedSizeVectorBase.h:809
ThisType & Assign(const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
Definition vctFixedSizeVectorBase.h:274
ThisType & DifferenceOf(const vctFixedSizeConstVectorBase< _size, __stride1, value_type, __dataPtrType1 > &vector1, const vctFixedSizeConstVectorBase< _size, __stride2, value_type, __dataPtrType2 > &vector2)
Definition vctFixedSizeVectorBase.h:820
ThisType & Add(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector)
Definition vctFixedSizeVectorBase.h:886
Implementation of a fixed-size vector using template metaprogramming.
Definition vctFixedSizeVector.h:54
bool FromStreamRaw(std::istream &inputStream, const char delimiter=' ')
Definition vctFixedSizeVector.h:268
void DeSerializeRaw(std::istream &inputStream)
Definition vctFixedSizeVector.h:301
Template base class for a 4x4 frame.
Definition vctFrame4x4ConstBase.h:51
ConstTranslationRefType Translation(void) const
Definition vctFrame4x4ConstBase.h:120
ConstRotationRefType Rotation(void) const
Definition vctFrame4x4ConstBase.h:124
Template base class for a frame.
Definition vctFrameBase.h:49
void ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition vctFrameBase.h:466
_rotationType RotationType
Definition vctFrameBase.h:54
vctFrameBase< _rotationType > ThisType
Definition vctFrameBase.h:53
void ApplyInverseTo(const vctDynamicConstMatrixBase< __matrixOwnerType1, value_type > &input, vctDynamicMatrixBase< __matrixOwnerType2, value_type > &output) const
Definition vctFrameBase.h:570
TranslationType GetTranslation(void) const
Definition vctFrameBase.h:197
ThisType & From(const vctFrame4x4ConstBase< __containerType > &other) CISST_THROW(std
Definition vctFrameBase.h:162
@ DIMENSION
Definition vctFrameBase.h:51
void SerializeRaw(std::ostream &outputStream) const
Definition vctFrameBase.h:712
RotationType GetRotation(void) const
Definition vctFrameBase.h:216
ThisType & InverseOf(const ThisType &otherFrame)
Definition vctFrameBase.h:248
ThisType & FromRaw(const vctFrame4x4ConstBase< __containerType > &other)
Definition vctFrameBase.h:178
void ApplyTo(const vctDynamicConstMatrixBase< __matrixOwnerType1, value_type > &input, vctDynamicMatrixBase< __matrixOwnerType2, value_type > &output) const
Definition vctFrameBase.h:432
void ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctFrameBase.h:450
void ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctFrameBase.h:271
bool operator==(const ThisType &other) const
Definition vctFrameBase.h:624
ThisType & FromRaw(const vctFrameBase< __rotationType > &other)
Definition vctFrameBase.h:147
ThisType & From(const vctFrameBase< __rotationType > &other) CISST_THROW(std
Definition vctFrameBase.h:131
vctFixedSizeVector< value_type, DIMENSION > TranslationType
Definition vctFrameBase.h:55
void SetRotation(const RotationType &rot)
Definition vctFrameBase.h:220
void ApplyInverseTo(const ThisType &input, ThisType &output) const
Definition vctFrameBase.h:536
void ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctFrameBase.h:383
vctFixedSizeVector< value_type, DIMENSION > ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &input) const
Definition vctFrameBase.h:301
RotationType RotationMember
Definition vctFrameBase.h:59
vctFrameBase(const vctFrame4x4ConstBase< __containerType > &other, bool normalizeInput)
Definition vctFrameBase.h:93
vctFrameBase(const RotationType &rotation, const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &translation)
Definition vctFrameBase.h:72
ThisType ApplyTo(const ThisType &input) const
Definition vctFrameBase.h:342
const RotationType & Rotation(void) const
Definition vctFrameBase.h:205
ThisType & FromNormalized(const vctFrameBase< __rotationType > &other)
Definition vctFrameBase.h:140
ThisType & Assign(const ThisType &otherFrame)
Definition vctFrameBase.h:109
void ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctFrameBase.h:492
vctFixedSizeVector< value_type, DIMENSION > ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition vctFrameBase.h:288
vctFixedSizeVector< value_type, DIMENSION > operator*(const vctFixedSizeConstVectorBase< DIMENSION, _stride, value_type, _dataPtrType > &vector) const
Definition vctFrameBase.h:592
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:400
void ToStreamRaw(std::ostream &outputStream, const char delimiter=' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition vctFrameBase.h:683
TranslationType TranslationMember
Definition vctFrameBase.h:60
const TranslationType & Translation(void) const
Definition vctFrameBase.h:186
void ToStream(std::ostream &outputStream) const
Definition vctFrameBase.h:673
bool IsNormalized(value_type tolerance=TypeTraits::Tolerance()) const
Definition vctFrameBase.h:226
vctFixedSizeVector< value_type, DIMENSION > ApplyInverseTo(const vctDynamicConstVectorBase< _vectorOwnerType, value_type > &input) const
Definition vctFrameBase.h:529
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:553
ThisType ApplyInverseTo(const ThisType &input) const
Definition vctFrameBase.h:543
bool FromStreamRaw(std::istream &inputStream, const char delimiter=' ')
Definition vctFrameBase.h:692
ThisType & Assign(const RotationType &rotation, const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &translation)
Definition vctFrameBase.h:116
void SetTranslation(const TranslationType &trans)
Definition vctFrameBase.h:201
ThisType Inverse(void) const
Definition vctFrameBase.h:255
void ApplyTo(const ThisType &input, ThisType &output) const
Definition vctFrameBase.h:317
bool Equal(const ThisType &other) const
Definition vctFrameBase.h:619
static CISST_EXPORT const ThisType & Identity()
vctFrameBase(void)
Definition vctFrameBase.h:66
void ApplyTo(const vctDynamicConstVectorBase< _vectorOwnerType1, value_type > &input, vctDynamicVectorBase< _vectorOwnerType2, value_type > &output) const
Definition vctFrameBase.h:355
ThisType & InverseSelf(void)
Definition vctFrameBase.h:238
vctFrameBase(const vctFrame4x4ConstBase< __containerType > &other)
Definition vctFrameBase.h:84
cmnTypeTraits< value_type > TypeTraits
Definition vctFrameBase.h:56
bool AlmostEquivalent(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition vctFrameBase.h:659
VCT_CONTAINER_TRAITS_TYPEDEFS(typename _rotationType::value_type)
bool AlmostEqual(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition vctFrameBase.h:641
TranslationType & Translation(void)
Definition vctFrameBase.h:190
void ProductOf(const ThisType &left, ThisType &right)
Definition vctFrameBase.h:329
std::string ToString(void) const
Definition vctFrameBase.h:666
ThisType & FromNormalized(const vctFrame4x4ConstBase< __containerType > &other)
Definition vctFrameBase.h:171
void ApplyTo(size_type inputSize, const vctFixedSizeVector< value_type, DIMENSION > *input, vctFixedSizeVector< value_type, DIMENSION > *output) const
Definition vctFrameBase.h:419
ThisType & NormalizedSelf(void)
Definition vctFrameBase.h:232
void DeSerializeRaw(std::istream &inputStream)
Definition vctFrameBase.h:719
RotationType & Rotation(void)
Definition vctFrameBase.h:209
vctFixedSizeVector< value_type, DIMENSION > ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride, value_type, __dataPtrType > &input) const
Definition vctFrameBase.h:515
bool AlmostEquivalent(const ThisType &other, value_type tolerance=TypeTraits::Tolerance()) const
Definition vctQuaternionRotation3Base.h:857
void ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctQuaternionRotation3Base.h:572
void ApplyInverseTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition vctQuaternionRotation3Base.h:714
ThisType & InverseSelf(void)
Definition vctQuaternionRotation3Base.h:542
#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
Macros to export the symbols of cisstVector (in a Dll).
Declaration of vctFixedSizeMatrixBase.
std::ostream & operator<<(std::ostream &output, const vctFrameBase< _rotationType > &frame)
Definition vctFrameBase.h:749
vctFrameBase< _rotationType > operator*(const vctFrameBase< _rotationType > &frame1, const vctFrameBase< _rotationType > &frame2)
Definition vctFrameBase.h:730