CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/DataFormats/GeometrySurface/src/BoundingBox.cc

Go to the documentation of this file.
00001 #include "DataFormats/GeometrySurface/interface/BoundingBox.h"
00002 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00003 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00004 
00005 
00006 BoundingBox::BoundingBox(const BoundPlane& plane) {
00007  float hLen = plane.bounds().length() / 2;
00008  float hWid = plane.bounds().width() / 2;
00009  float hThick = plane.bounds().thickness() / 2;
00010 
00011   m_corners[0]  = plane.toGlobal( LocalPoint( hWid, hLen, hThick));
00012   m_corners[1]  = plane.toGlobal( LocalPoint( hWid, hLen,-hThick));
00013   m_corners[2]  = plane.toGlobal( LocalPoint( hWid,-hLen, hThick));
00014   m_corners[3]  = plane.toGlobal( LocalPoint( hWid,-hLen,-hThick));
00015   m_corners[4]  = plane.toGlobal( LocalPoint(-hWid, hLen, hThick));
00016   m_corners[5]  = plane.toGlobal( LocalPoint(-hWid, hLen,-hThick));
00017   m_corners[6]  = plane.toGlobal( LocalPoint(-hWid,-hLen, hThick));
00018   m_corners[7]  = plane.toGlobal( LocalPoint(-hWid,-hLen,-hThick));
00019  
00020 }
00021 
00022 
00023 std::vector<GlobalPoint>
00024 BoundingBox::corners( const BoundPlane& plane) 
00025 {
00026    std::vector<GlobalPoint> result;
00027    result.reserve(8);
00028 
00029   float hLen = plane.bounds().length() / 2;
00030   float hWid = plane.bounds().width() / 2;
00031   float hThick = plane.bounds().thickness() / 2;
00032   
00033   result.push_back( plane.toGlobal( LocalPoint( hWid, hLen, hThick)));
00034   result.push_back( plane.toGlobal( LocalPoint( hWid, hLen,-hThick)));
00035   result.push_back( plane.toGlobal( LocalPoint( hWid,-hLen, hThick)));
00036   result.push_back( plane.toGlobal( LocalPoint( hWid,-hLen,-hThick)));
00037   result.push_back( plane.toGlobal( LocalPoint(-hWid, hLen, hThick)));
00038   result.push_back( plane.toGlobal( LocalPoint(-hWid, hLen,-hThick)));
00039   result.push_back( plane.toGlobal( LocalPoint(-hWid,-hLen, hThick)));
00040   result.push_back( plane.toGlobal( LocalPoint(-hWid,-hLen,-hThick)));
00041 
00042   return result;
00043 }