CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DataFormats/GeometrySurface/interface/Plane.h

Go to the documentation of this file.
00001 #ifndef Geom_Plane_H
00002 #define Geom_Plane_H
00003 
00014 #include "DataFormats/GeometrySurface/interface/Surface.h"
00015 #include "boost/intrusive_ptr.hpp" 
00016 
00017 class Plane : public virtual Surface {
00018 public:
00019   typedef ReferenceCountingPointer<Plane> PlanePointer;
00020   typedef ConstReferenceCountingPointer<Plane> ConstPlanePointer;
00021 
00025   static PlanePointer build(const PositionType& pos,
00026                                     const RotationType& rot,
00027                                     MediumProperties* mp=0) {
00028     return PlanePointer(new Plane(pos, rot, mp));
00029   }
00030 
00031   // -- DEPRECATED CONSTRUCTORS
00032 
00036   Plane( const PositionType& pos, const RotationType& rot) :
00037     Surface( pos, rot) {}
00038 
00042   Plane( const PositionType& pos, const RotationType& rot, MediumProperties* mp) : 
00043     Surface( pos, rot, mp) {}
00044 
00045 // extension of Surface interface for planes
00046 
00047   GlobalVector normalVector() const {
00048     return GlobalVector( rotation().zx(), rotation().zy(), rotation().zz());
00049   }
00050 
00052   float localZ (const GlobalPoint& gp) const {
00053     return normalVector().dot(gp-position());
00054   }
00055 
00057   float localZ (const GlobalVector& gv) const {
00058     return normalVector().dot(gv);
00059   }
00060 
00061 // implementation of Surface interface    
00062 
00063   virtual SurfaceOrientation::Side side( const LocalPoint& p, Scalar toler) const {
00064     return (std::abs(p.z())<toler) ? SurfaceOrientation::onSurface : 
00065         (p.z()>0 ? SurfaceOrientation::positiveSide : SurfaceOrientation::negativeSide);
00066   }
00067 
00068   virtual SurfaceOrientation::Side side( const GlobalPoint& p, Scalar toler) const {
00069     Scalar lz = localZ(p);
00070     return (std::abs(lz)<toler ? SurfaceOrientation::onSurface : 
00071             (lz>0 ? SurfaceOrientation::positiveSide : SurfaceOrientation::negativeSide));
00072   }
00073 
00075   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const;
00076 
00078   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const;
00079 
00080 
00081 
00082 
00083 };
00084 
00085 #endif