00001 #ifndef FrameChanger_H 00002 #define FrameChanger_H 00003 00004 #include "DataFormats/GeometrySurface/interface/Plane.h" 00005 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h" 00006 00007 class FrameChanger { 00008 public: 00012 template <typename T> 00013 static 00014 Plane transformPlane( const Plane& plane, const GloballyPositioned<T>& frame) { 00015 typedef GloballyPositioned<T> Frame; 00016 typename Plane::RotationType rot = plane.rotation() * frame.rotation().transposed(); 00017 typename Frame::LocalPoint lpos = frame.toLocal(plane.position()); 00018 typename Plane::PositionType pos( lpos.basicVector()); // cheat! 00019 return Plane(pos, rot); 00020 } 00021 00022 00026 template <typename T, typename U> 00027 static 00028 GloballyPositioned<T> toFrame( const GloballyPositioned<T>& plane, 00029 const GloballyPositioned<U>& frame) { 00030 typedef GloballyPositioned<T> Plane; 00031 typedef GloballyPositioned<U> Frame; 00032 00033 typename Plane::RotationType rot = plane.rotation() * frame.rotation().transposed(); 00034 typename Frame::LocalPoint lpos = frame.toLocal(plane.position()); 00035 typename Plane::PositionType pos( lpos.basicVector()); // cheat! 00036 return Plane( pos, rot); 00037 00038 } 00039 00040 }; 00041 00042 #endif