1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "DataFormats/GeometrySurface/interface/BoundingBox.h"
#include "DataFormats/GeometrySurface/interface/BoundPlane.h"
#include "DataFormats/GeometryVector/interface/LocalPoint.h"
BoundingBox::BoundingBox(const BoundPlane& plane) {
float hLen = plane.bounds().length() / 2;
float hWid = plane.bounds().width() / 2;
float hThick = plane.bounds().thickness() / 2;
m_corners[0] = plane.toGlobal(LocalPoint(hWid, hLen, hThick));
m_corners[1] = plane.toGlobal(LocalPoint(hWid, hLen, -hThick));
m_corners[2] = plane.toGlobal(LocalPoint(hWid, -hLen, hThick));
m_corners[3] = plane.toGlobal(LocalPoint(hWid, -hLen, -hThick));
m_corners[4] = plane.toGlobal(LocalPoint(-hWid, hLen, hThick));
m_corners[5] = plane.toGlobal(LocalPoint(-hWid, hLen, -hThick));
m_corners[6] = plane.toGlobal(LocalPoint(-hWid, -hLen, hThick));
m_corners[7] = plane.toGlobal(LocalPoint(-hWid, -hLen, -hThick));
}
std::vector<GlobalPoint> BoundingBox::corners(const BoundPlane& plane) {
std::vector<GlobalPoint> result;
result.reserve(8);
float hLen = plane.bounds().length() / 2;
float hWid = plane.bounds().width() / 2;
float hThick = plane.bounds().thickness() / 2;
result.push_back(plane.toGlobal(LocalPoint(hWid, hLen, hThick)));
result.push_back(plane.toGlobal(LocalPoint(hWid, hLen, -hThick)));
result.push_back(plane.toGlobal(LocalPoint(hWid, -hLen, hThick)));
result.push_back(plane.toGlobal(LocalPoint(hWid, -hLen, -hThick)));
result.push_back(plane.toGlobal(LocalPoint(-hWid, hLen, hThick)));
result.push_back(plane.toGlobal(LocalPoint(-hWid, hLen, -hThick)));
result.push_back(plane.toGlobal(LocalPoint(-hWid, -hLen, hThick)));
result.push_back(plane.toGlobal(LocalPoint(-hWid, -hLen, -hThick)));
return result;
}
|