Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:31

0001 #include "DataFormats/GeometrySurface/interface/BoundingBox.h"
0002 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
0003 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0004 
0005 BoundingBox::BoundingBox(const BoundPlane& plane) {
0006   float hLen = plane.bounds().length() / 2;
0007   float hWid = plane.bounds().width() / 2;
0008   float hThick = plane.bounds().thickness() / 2;
0009 
0010   m_corners[0] = plane.toGlobal(LocalPoint(hWid, hLen, hThick));
0011   m_corners[1] = plane.toGlobal(LocalPoint(hWid, hLen, -hThick));
0012   m_corners[2] = plane.toGlobal(LocalPoint(hWid, -hLen, hThick));
0013   m_corners[3] = plane.toGlobal(LocalPoint(hWid, -hLen, -hThick));
0014   m_corners[4] = plane.toGlobal(LocalPoint(-hWid, hLen, hThick));
0015   m_corners[5] = plane.toGlobal(LocalPoint(-hWid, hLen, -hThick));
0016   m_corners[6] = plane.toGlobal(LocalPoint(-hWid, -hLen, hThick));
0017   m_corners[7] = plane.toGlobal(LocalPoint(-hWid, -hLen, -hThick));
0018 }
0019 
0020 std::vector<GlobalPoint> BoundingBox::corners(const BoundPlane& plane) {
0021   std::vector<GlobalPoint> result;
0022   result.reserve(8);
0023 
0024   float hLen = plane.bounds().length() / 2;
0025   float hWid = plane.bounds().width() / 2;
0026   float hThick = plane.bounds().thickness() / 2;
0027 
0028   result.push_back(plane.toGlobal(LocalPoint(hWid, hLen, hThick)));
0029   result.push_back(plane.toGlobal(LocalPoint(hWid, hLen, -hThick)));
0030   result.push_back(plane.toGlobal(LocalPoint(hWid, -hLen, hThick)));
0031   result.push_back(plane.toGlobal(LocalPoint(hWid, -hLen, -hThick)));
0032   result.push_back(plane.toGlobal(LocalPoint(-hWid, hLen, hThick)));
0033   result.push_back(plane.toGlobal(LocalPoint(-hWid, hLen, -hThick)));
0034   result.push_back(plane.toGlobal(LocalPoint(-hWid, -hLen, hThick)));
0035   result.push_back(plane.toGlobal(LocalPoint(-hWid, -hLen, -hThick)));
0036 
0037   return result;
0038 }