cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vctFrame4x4.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: 2007-09-13
8 
9  (C) Copyright 2007-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 _vctFrame4x4_h
23 #define _vctFrame4x4_h
24 
32 #include <cisstVector/vctExport.h>
33 
48 template <class _elementType, bool _rowMajor>
49 class vctFrame4x4:
50  public vctFrame4x4Base<vctFixedSizeMatrix<_elementType, 4, 4, _rowMajor> >
51 {
52 public:
53  /* define most types from vctContainerTraits */
54  VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType);
55 
56  enum {ROWS = 4, COLS = 4};
57  enum {DIMENSION = 3};
58 
62 
65 
66 
67 public:
68 
69 
71  vctFrame4x4(void):
72  BaseType()
73  {
74  this->Assign(this->Identity());
75  }
76 
78  vctFrame4x4(const ThisType & other):
79  BaseType()
80  {
81  this->Assign(other);
82  }
83 
84  inline ThisType & operator = (const ThisType & other) {
85  return reinterpret_cast<ThisType &>(this->Assign(other));
86  }
87 
89  template <bool __rowMajor>
91  BaseType()
92  {
93  this->Assign(other);
94  }
95 
96  template <bool __rowMajor>
98  return reinterpret_cast<ThisType &>(this->Assign(other));
99  }
100 
101 
104  template <class __containerType>
106  BaseType()
107  {
108  this->Assign(other);
109  }
110 
111  template <class __containerType>
113  return reinterpret_cast<ThisType &>(this->Assign(other));
114  }
115 
116 
118  vctFrame4x4(const ContainerType & other):
119  BaseType()
120  {
121  this->Assign(other);
122  }
123 
124  inline ThisType & operator = (const ContainerType & other) {
125  return reinterpret_cast<ThisType &>(this->Assign(other));
126  }
127 
128 
130  template <class _rotationType, class _translationType>
131  vctFrame4x4(const _rotationType & rotation,
132  const _translationType & translation):
133  BaseType()
134  {
135  this->From(rotation, translation);
136  }
137 
142  template <class __containerType>
143  explicit inline
145  BaseType()
146  {
147  this->From(other);
148  }
149 
153  template <class __containerType>
154  inline
156  bool normalizeInput):
157  BaseType()
158  {
159  if (normalizeInput) {
160  this->FromNormalized(other);
161  } else {
162  this->FromRaw(other);
163  }
164  }
165 };
166 
167 
168 // declared in vctFrame4x4ConstBase.h
169 template <class _containerType>
172  FrameValueType result;
173  result.InverseOf(*this);
174  return result;
175 }
176 
177 
178 // operators
179 template <class _containerType,
180  vct::stride_type _stride, class _dataPtrType>
185  frame.ApplyTo(vector, result);
186  return result;
187 }
188 
189 template <class _containerType1, class _containerType2>
192  const vctFrame4x4ConstBase<_containerType2> & frame2) {
194  frame1.ApplyTo(frame2, result);
195  return result;
196 }
197 
198 template <class _containerType,
199  vct::size_type _cols, vct::stride_type _rowStride, vct::stride_type _colStride, class _dataPtrType>
203 {
205  frame.ApplyTo(matrix, result);
206  return result;
207 }
208 
209 
210 #endif // _vctFrame4x4_h
Template base class for a 4x4 frame.
Definition: vctForwardDeclarations.h:234
A template for a fixed size matrix with fixed spacing in memory.
Definition: vctFixedSizeConstMatrixBase.h:103
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
Definition: vctFrame4x4.h:56
ThisType & operator=(const ThisType &other)
Definition: vctFrame4x4.h:84
ThisType & FromNormalized(const __rotationType &rotation, const __translationType &translation)
Definition: vctFrame4x4Base.h:133
vctFrame4x4(void)
Definition: vctFrame4x4.h:71
cmnTypeTraits< value_type > TypeTraits
Definition: vctFrame4x4.h:64
ThisType & From(const __rotationType &rotation, const __translationType &translation)
Definition: vctFrame4x4Base.h:121
ThisType & Assign(const vctFixedSizeConstMatrixBase< _rows, _cols, __rowStride, __colStride, __elementType, __dataPtrType > &other)
Definition: vctFixedSizeMatrixBase.h:475
Declaration of vctFixedSizeMatrix.
vctFrame4x4< value_type, _rowMajor > ThisType
Definition: vctFrame4x4.h:61
size_t size_type
Definition: vctContainerTraits.h:35
vctFixedSizeMatrix< value_type, ROWS, COLS, _rowMajor > ContainerType
Definition: vctFrame4x4.h:59
vctFrame4x4(const vctFrame4x4ConstBase< __containerType > &other)
Definition: vctFrame4x4.h:105
Template base class for a 4x4 frame.
Definition: vctForwardDeclarations.h:236
Template base class for a 4x4 frame.
Definition: vctForwardDeclarations.h:235
Implementation of a fixed-size vector using template metaprogramming.
Definition: vctFixedSizeVector.h:52
Definition: vctFrame4x4.h:57
vctFrame4x4(const ContainerType &other)
Definition: vctFrame4x4.h:118
vctFixedSizeVector< typename _containerType::value_type, 3 > operator*(const vctFrame4x4ConstBase< _containerType > &frame, const vctFixedSizeConstVectorBase< 3, _stride, typename _containerType::value_type, _dataPtrType > &vector)
Definition: vctFrame4x4.h:182
vctFrame4x4(const ThisType &other)
Definition: vctFrame4x4.h:78
vctFrame4x4(const vctFrame4x4< value_type, __rowMajor > &other)
Definition: vctFrame4x4.h:90
Implementation of a fixed-size matrix using template metaprogramming.
Definition: vctFixedSizeMatrix.h:52
ptrdiff_t stride_type
Definition: vctContainerTraits.h:37
void ApplyTo(const vctFixedSizeConstVectorBase< DIMENSION, __stride1, value_type, __dataPtrType1 > &input, vctFixedSizeVectorBase< DIMENSION, __stride2, value_type, __dataPtrType2 > &output) const
Definition: vctFrame4x4ConstBase.h:161
Declaration of vctFrame4x4Base.
Definition: vctFrame4x4.h:56
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeConstVectorBase.h:107
Template base class for a frame.
Definition: vctForwardDeclarations.h:232
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
vctFrame4x4(const vctFrameBase< __containerType > &other, bool normalizeInput)
Definition: vctFrame4x4.h:155
vctFrame4x4(const _rotationType &rotation, const _translationType &translation)
Definition: vctFrame4x4.h:131
FrameValueType Inverse(void) const
Definition: vctFrame4x4.h:171
static CISST_EXPORT const FrameValueType & Identity(void)
ThisType & FromRaw(const __rotationType &rotation, const __translationType &translation)
Definition: vctFrame4x4Base.h:144
vctFrame4x4Base< ContainerType > BaseType
Definition: vctFrame4x4.h:60
vctFrame4x4(const vctFrameBase< __containerType > &other)
Definition: vctFrame4x4.h:144