LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
LocalTransformation.h
Go to the documentation of this file.
1 
10 #ifndef LARCOREALG_GEOMETRY_LOCALTRANSFORMATION_H
11 #define LARCOREALG_GEOMETRY_LOCALTRANSFORMATION_H
12 
13 
14 // ROOT libraries
15 // (none)
16 
17 // C/C++ standard libraries
18 #include <vector>
19 #include <utility> // std::move()
20 #include <type_traits> // std::enable_if_t<>
21 #include <cstdlib> // std::size_t
22 
23 
24 // forward declarations
25 class TGeoNode;
26 
27 
28 namespace geo {
29 
44  template <typename StoredMatrix>
46  public:
47 
49  using TransformationMatrix_t = StoredMatrix;
50 
52 
59  : fGeoMatrix(matrix) {}
61  : fGeoMatrix(std::move(matrix)) {}
63 
71  LocalTransformation(std::vector<TGeoNode const*> const& path, size_t depth)
72  : fGeoMatrix(transformationFromPath(path, depth)) {}
73 
93  void LocalToWorld(double const* local, double* world) const;
94 
95 
96  // @{
115  template <
116  typename DestPoint, typename SrcPoint,
118  >
119  DestPoint LocalToWorld(SrcPoint const& local) const
120  { return LocalToWorldImpl<DestPoint>(local); }
121  template <typename Point>
122  Point LocalToWorld(Point const& local) const
123  { return LocalToWorldImpl<Point>(local); }
124  // @}
125 
137  void LocalToWorldVect(double const* local, double* world) const;
138 
140 
150  template <
151  typename DestVector, typename SrcVector,
153  >
154  DestVector LocalToWorldVect(SrcVector const& local) const
155  { return LocalToWorldVectImpl<DestVector>(local); }
156  template <typename Vector>
157  Vector LocalToWorldVect(Vector const& local) const
158  { return LocalToWorldVectImpl<Vector>(local); }
160 
161 
179  void WorldToLocal(double const* world, double* local) const;
180 
182 
198  template <
199  typename DestPoint, typename SrcPoint,
201  >
202  DestPoint WorldToLocal(SrcPoint const& world) const
203  { return WorldToLocalImpl<DestPoint>(world); }
204  template <typename Point>
205  Point WorldToLocal(Point const& world) const
206  { return WorldToLocalImpl<Point>(world); }
208 
220  void WorldToLocalVect(const double* world, double* local) const;
221 
222 
224 
234  template <
235  typename DestVector, typename SrcVector,
237  >
238  DestVector WorldToLocalVect(SrcVector const& world) const
239  { return WorldToLocalVectImpl<DestVector>(world); }
240  template <typename Vector>
241  Vector WorldToLocalVect(Vector const& world) const
242  { return WorldToLocalVectImpl<Vector>(world); }
244 
245 
247  TransformationMatrix_t const& Matrix() const { return fGeoMatrix; }
248 
249 
252  (std::vector<TGeoNode const*> const& path, size_t depth);
253 
254 
255  protected:
256 
258 
259 
260  template <typename DestPoint, typename SrcPoint>
261  DestPoint LocalToWorldImpl(SrcPoint const& local) const;
262 
263  template <typename DestVector, typename SrcVector>
264  DestVector LocalToWorldVectImpl(SrcVector const& local) const;
265 
266  template <typename DestPoint, typename SrcPoint>
267  DestPoint WorldToLocalImpl(SrcPoint const& world) const;
268 
269  template <typename DestVector, typename SrcVector>
270  DestVector WorldToLocalVectImpl(SrcVector const& world) const;
271 
272  }; // class LocalTransformation<>
273 
274 
275 } // namespace geo
276 
277 
278 //------------------------------------------------------------------------------
279 // template implementation
280 
281 #include "LocalTransformation.tcc"
282 
283 //------------------------------------------------------------------------------
284 
285 
286 #endif // LARCOREALG_GEOMETRY_LOCALTRANSFORMATION_H
DestPoint WorldToLocalImpl(SrcPoint const &world) const
DestPoint WorldToLocal(SrcPoint const &world) const
Transforms a point from world frame to local frame.
TGeoHMatrix TransformationMatrix_t
Type of transformation matrix.
static TransformationMatrix_t transformationFromPath(std::vector< TGeoNode const * > const &path, size_t depth)
Builds a matrix to go from local to world coordinates in one step.
TransformationMatrix_t const & Matrix() const
Direct access to the transformation matrix.
STL namespace.
DestVector LocalToWorldVect(SrcVector const &local) const
Transforms a vector from local frame to world frame.
void LocalToWorld(double const *local, double *world) const
Transforms a point from local frame to world frame.
Vector LocalToWorldVect(Vector const &local) const
Transforms a vector from local frame to world frame.
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
DestVector WorldToLocalVect(SrcVector const &world) const
Transforms a vector from world frame to local frame.
LocalTransformation(std::vector< TGeoNode const * > const &path, size_t depth)
Constructor: uses the specified transformation matrix.
Class to transform between world and local coordinates.
DestVector LocalToWorldVectImpl(SrcVector const &local) const
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
TransformationMatrix_t fGeoMatrix
local to world transform
LocalTransformation(TransformationMatrix_t const &matrix)
Constructor: uses the specified transformation matrix.
std::string value(boost::any const &)
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
DestPoint LocalToWorld(SrcPoint const &local) const
Transforms a point from local frame to world frame.
Vector WorldToLocalVect(Vector const &world) const
Transforms a vector from world frame to local frame.
Point LocalToWorld(Point const &local) const
Transforms a point from local frame to world frame.
Point WorldToLocal(Point const &world) const
Transforms a point from world frame to local frame.
DestVector WorldToLocalVectImpl(SrcVector const &world) const
LocalTransformation(TransformationMatrix_t &&matrix)
Constructor: uses the specified transformation matrix.
Namespace collecting geometry-related classes utilities.
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.
DestPoint LocalToWorldImpl(SrcPoint const &local) const