cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vctMatrixRotation3.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Anton Deguet
7  Created on: 2004-01-12
8 
9  (C) Copyright 2004-2012 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 */
20 
21 #pragma once
22 #ifndef _vctMatrixRotation3_h
23 #define _vctMatrixRotation3_h
24 
33 
34 // Always include last
35 #include <cisstVector/vctExport.h>
36 
51 template <class _elementType, bool _rowMajor>
52 class vctMatrixRotation3: public vctMatrixRotation3Base<vctFixedSizeMatrix<_elementType, 3, 3, _rowMajor> >
53 {
54  public:
55  /* no need to document, inherit doxygen documentation from base class */
56  VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType);
57  enum {ROWS = 3, COLS = 3};
58  enum {DIMENSION = 3};
64 
66  inline vctMatrixRotation3(void):
67  BaseType()
68  {
69  this->Assign(this->Identity());
70  }
71 
72  inline vctMatrixRotation3(const ThisType & other):
73  BaseType()
74  {
75  this->Assign(other);
76  }
77 
78  explicit inline vctMatrixRotation3(const BaseType & other):
79  BaseType()
80  {
81  this->Assign(other);
82  }
83 
84  explicit inline vctMatrixRotation3(const vctDynamicMatrixRef<value_type> & other):
85  BaseType()
86  {
87  this->Assign(other);
88  }
89 
96  inline ThisType & operator = (const ContainerType & other) {
97  return reinterpret_cast<ThisType &>(this->Assign(other));
98  }
99 
100  inline ThisType & operator = (const ThisType & other) {
101  return reinterpret_cast<ThisType &>(this->Assign(other));
102  }
103 
104  inline ThisType & operator = (const BaseType & other) {
105  return reinterpret_cast<ThisType &>(this->Assign(other));
106  }
107 
108 
122 
123 
135  inline vctMatrixRotation3(const value_type & element00, const value_type & element01, const value_type & element02,
136  const value_type & element10, const value_type & element11, const value_type & element12,
137  const value_type & element20, const value_type & element21, const value_type & element22)
138  throw(std::runtime_error)
139  {
140  this->From(element00, element01, element02,
141  element10, element11, element12,
142  element20, element21, element22);
143  }
144 
151  template <stride_type __stride1, class __dataPtrType1,
152  stride_type __stride2, class __dataPtrType2,
153  stride_type __stride3, class __dataPtrType3>
157  bool vectorsAreColumns = true)
158  throw(std::runtime_error)
159  {
160  this->From(v1, v2, v3, vectorsAreColumns);
161  }
162 
169  template <class __vectorOwnerType1,
170  class __vectorOwnerType2,
171  class __vectorOwnerType3>
175  bool vectorsAreColumns = true)
176  throw(std::runtime_error)
177  {
178  this->From(v1, v2, v3, vectorsAreColumns);
179  }
180 
182  explicit inline vctMatrixRotation3(const vctAxisAngleRotation3<value_type> & axisAngleRotation)
183  throw(std::runtime_error)
184  {
185  this->From(axisAngleRotation);
186  }
187 
195  template <class __containerType>
196  explicit inline vctMatrixRotation3(const vctQuaternionRotation3Base<__containerType> & quaternionRotation)
197  throw(std::runtime_error)
198  {
199  this->From(quaternionRotation);
200  }
201 
203  template <class __containerType>
204  explicit inline vctMatrixRotation3(const vctRodriguezRotation3Base<__containerType> & rodriguezRotation)
205  throw(std::runtime_error)
206  {
207  this->From(rodriguezRotation);
208  }
209 
211  template <vctEulerRotation3Order::OrderType __order>
212  explicit inline vctMatrixRotation3(const vctEulerRotation3<__order> & eulerRotation)
213  throw(std::runtime_error)
214  {
215  this->From(eulerRotation);
216  }
217 
239 
240 
252  inline vctMatrixRotation3(const value_type & element00, const value_type & element01, const value_type & element02,
253  const value_type & element10, const value_type & element11, const value_type & element12,
254  const value_type & element20, const value_type & element21, const value_type & element22,
255  bool normalizeInput)
256  {
257  if (normalizeInput) {
258  this->FromNormalized(element00, element01, element02,
259  element10, element11, element12,
260  element20, element21, element22);
261  } else {
262  this->FromRaw(element00, element01, element02,
263  element10, element11, element12,
264  element20, element21, element22);
265  }
266  }
267 
274  template <stride_type __stride1, class __dataPtrType1,
275  stride_type __stride2, class __dataPtrType2,
276  stride_type __stride3, class __dataPtrType3>
280  bool vectorsAreColumns, bool normalizeInput)
281  {
282  if (normalizeInput) {
283  this->FromNormalized(v1, v2, v3, vectorsAreColumns);
284  } else {
285  this->FromRaw(v1, v2, v3, vectorsAreColumns);
286  }
287  }
288 
295  template <class __vectorOwnerType1,
296  class __vectorOwnerType2,
297  class __vectorOwnerType3>
301  bool vectorsAreColumns, bool normalizeInput)
302  {
303  if (normalizeInput) {
304  this->FromNormalized(v1, v2, v3, vectorsAreColumns);
305  } else {
306  this->FromRaw(v1, v2, v3, vectorsAreColumns);
307  }
308  }
309 
311  inline vctMatrixRotation3(const vctAxisAngleRotation3<value_type> & axisAngleRotation,
312  bool normalizeInput)
313  {
314  if (normalizeInput) {
315  this->FromNormalized(axisAngleRotation);
316  } else {
317  this->FromRaw(axisAngleRotation);
318  }
319  }
320 
329  template <class __containerType>
331  bool normalizeInput)
332  {
333  if (normalizeInput) {
334  this->FromNormalized(quaternionRotation);
335  } else {
336  this->FromRaw(quaternionRotation);
337  }
338  }
339 
341  template <class __containerType>
343  bool normalizeInput)
344  {
345  if (normalizeInput) {
346  this->FromNormalized(rodriguezRotation);
347  } else {
348  this->FromRaw(rodriguezRotation);
349  }
350  }
351 
353  template <vctEulerRotation3Order::OrderType __order>
354  inline vctMatrixRotation3(const vctEulerRotation3<__order> & eulerRotation,
355  bool normalizeInput)
356  {
357  if (normalizeInput) {
358  this->FromNormalized(eulerRotation);
359  } else {
360  this->FromRaw(eulerRotation);
361  }
362  }
363 
365 
376  template <stride_type __rowStride, stride_type __colStride, class __dataPtrType>
377  explicit inline
379  {
380  this->Assign(matrix);
381  }
382 
383 };
384 
385 
386 // declared in vctMatrixRotation3ConstBase.h
387 template <class _containerType>
390  RotationValueType result(*this);
391  result.NormalizedSelf();
392  return result;
393 }
394 
395 // declared in vctMatrixRotation3ConstBase.h
396 template <class _containerType>
399  RotationValueType result(*this);
400  result.InverseSelf();
401  return result;
402 }
403 
404 
405 #endif // _vctMatrixRotation3_h
vctMatrixRotation3(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, bool normalizeInput)
Definition: vctMatrixRotation3.h:252
A template for a fixed size matrix with fixed spacing in memory.
Definition: vctFixedSizeConstMatrixBase.h:103
Definition: vctEulerRotation3.h:153
vctMatrixRotation3(void)
Definition: vctMatrixRotation3.h:66
RotationValueType Normalized(void) const
Definition: vctMatrixRotation3.h:389
vctMatrixRotation3(const ThisType &other)
Definition: vctMatrixRotation3.h:72
vctMatrixRotation3(const vctAxisAngleRotation3< value_type > &axisAngleRotation)
Definition: vctMatrixRotation3.h:182
vctMatrixRotation3(const vctFixedSizeMatrixBase< ROWS, COLS, __rowStride, __colStride, value_type, __dataPtrType > &matrix)
Definition: vctMatrixRotation3.h:378
vctMatrixRotation3(const BaseType &other)
Definition: vctMatrixRotation3.h:78
vctFixedSizeMatrix< value_type, ROWS, COLS, _rowMajor > ContainerType
Definition: vctMatrixRotation3.h:59
ThisType & Assign(const vctFixedSizeConstMatrixBase< _rows, _cols, __rowStride, __colStride, __elementType, __dataPtrType > &other)
Definition: vctFixedSizeMatrixBase.h:475
vctMatrixRotation3(const vctDynamicMatrixRef< value_type > &other)
Definition: vctMatrixRotation3.h:84
Declaration of vctFixedSizeMatrix.
Definition: vctMatrixRotation3.h:58
vctMatrixRotation3(const vctQuaternionRotation3Base< __containerType > &quaternionRotation)
Definition: vctMatrixRotation3.h:196
vctMatrixRotation3(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, const vctDynamicConstVectorBase< __vectorOwnerType3, value_type > &v3, bool vectorsAreColumns=true)
Definition: vctMatrixRotation3.h:172
vctMatrixRotation3Base< ContainerType > BaseType
Definition: vctMatrixRotation3.h:60
ThisType & InverseSelf(void)
Definition: vctMatrixRotation3Base.h:515
vctMatrixRotation3(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, bool normalizeInput)
Definition: vctMatrixRotation3.h:277
Dynamic matrix referencing existing memory.
Definition: vctDynamicMatrixRef.h:74
ThisType & From(const vctMatrixRotation3Base< __containerType > &other)
Definition: vctMatrixRotation3Base.h:108
vctMatrixRotation3(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation)
Definition: vctMatrixRotation3.h:204
Define a rotation based on an axis and an angle for a space of dimension 3.
Definition: vctAxisAngleRotation3.h:94
vctMatrixRotation3(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: vctMatrixRotation3.h:154
vctMatrixRotation3(const vctRodriguezRotation3Base< __containerType > &rodriguezRotation, bool normalizeInput)
Definition: vctMatrixRotation3.h:342
A template for a fixed size matrix with fixed spacings in memory.
Definition: vctFixedSizeMatrixBase.h:58
RotationValueType Inverse(void) const
Definition: vctMatrixRotation3.h:398
vctMatrixRotation3(const vctEulerRotation3< __order > &eulerRotation)
Definition: vctMatrixRotation3.h:212
Define a rotation matrix for a space of dimension 3.
Definition: vctForwardDeclarations.h:199
vctMatrixRotation3< value_type, _rowMajor > ThisType
Definition: vctMatrixRotation3.h:61
vctMatrixRotation3(const vctDynamicConstVectorBase< __vectorOwnerType1, value_type > &v1, const vctDynamicConstVectorBase< __vectorOwnerType2, value_type > &v2, const vctDynamicConstVectorBase< __vectorOwnerType3, value_type > &v3, bool vectorsAreColumns, bool normalizeInput)
Definition: vctMatrixRotation3.h:298
Definition: vctMatrixRotation3.h:57
cmnTypeTraits< value_type > TypeTraits
Definition: vctMatrixRotation3.h:63
Declaration of vctDynamicMatrixRef.
vctMatrixRotation3(const vctAxisAngleRotation3< value_type > &axisAngleRotation, bool normalizeInput)
Definition: vctMatrixRotation3.h:311
ThisType & FromRaw(const vctMatrixRotation3Base< __containerType > &other)
Definition: vctMatrixRotation3Base.h:354
Implementation of a fixed-size matrix using template metaprogramming.
Definition: vctFixedSizeMatrix.h:52
Definition: vctMatrixRotation3.h:57
vctMatrixRotation3(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: vctMatrixRotation3.h:135
Declaration of vctMatrixRotation3Base.
vctMatrixRotation3(const vctQuaternionRotation3Base< __containerType > &quaternionRotation, bool normalizeInput)
Definition: vctMatrixRotation3.h:330
ThisType & operator=(const ContainerType &other)
Definition: vctMatrixRotation3.h:96
ptrdiff_t stride_type
Definition: vctContainerTraits.h:37
Definition: vctDynamicConstVectorBase.h:77
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeConstVectorBase.h:107
ThisType & NormalizedSelf(void)
Definition: vctMatrixRotation3Base.h:493
Define a rotation quaternion for a space of dimension 3.
Definition: vctForwardDeclarations.h:208
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 & FromNormalized(const vctMatrixRotation3Base< __containerType > &other)
Definition: vctMatrixRotation3Base.h:234
Define a rotation based on the rodriguez representation for a space of dimension 3.
Definition: vctForwardDeclarations.h:214
vctMatrixRotation3(const vctEulerRotation3< __order > &eulerRotation, bool normalizeInput)
Definition: vctMatrixRotation3.h:354
Define a rotation matrix for a space of dimension 3.
Definition: vctForwardDeclarations.h:200