CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
BoundingBox Class Reference

#include <BoundingBox.h>

Public Member Functions

 BoundingBox ()
 
 BoundingBox (const BoundPlane &plane)
 
GlobalPoint const & corner (unsigned int i) const
 
GlobalPoint const & operator[] (unsigned int i) const
 

Static Public Member Functions

static std::vector< GlobalPointcorners (const BoundPlane &)
 

Private Attributes

GlobalPoint m_corners [8]
 

Detailed Description

A helper class that returns the corners of a rectangle that fully contains a bound plane.

Definition at line 12 of file BoundingBox.h.

Constructor & Destructor Documentation

BoundingBox::BoundingBox ( )
inline

Definition at line 15 of file BoundingBox.h.

15 {}
BoundingBox::BoundingBox ( const BoundPlane plane)

Definition at line 6 of file BoundingBox.cc.

References BoundSurface::bounds(), Bounds::length(), m_corners, Bounds::thickness(), Surface::toGlobal(), and Bounds::width().

6  {
7  float hLen = plane.bounds().length() / 2;
8  float hWid = plane.bounds().width() / 2;
9  float hThick = plane.bounds().thickness() / 2;
10 
11  m_corners[0] = plane.toGlobal( LocalPoint( hWid, hLen, hThick));
12  m_corners[1] = plane.toGlobal( LocalPoint( hWid, hLen,-hThick));
13  m_corners[2] = plane.toGlobal( LocalPoint( hWid,-hLen, hThick));
14  m_corners[3] = plane.toGlobal( LocalPoint( hWid,-hLen,-hThick));
15  m_corners[4] = plane.toGlobal( LocalPoint(-hWid, hLen, hThick));
16  m_corners[5] = plane.toGlobal( LocalPoint(-hWid, hLen,-hThick));
17  m_corners[6] = plane.toGlobal( LocalPoint(-hWid,-hLen, hThick));
18  m_corners[7] = plane.toGlobal( LocalPoint(-hWid,-hLen,-hThick));
19 
20 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
virtual float length() const =0
virtual float thickness() const =0
const Bounds & bounds() const
Definition: BoundSurface.h:89
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
virtual float width() const =0
GlobalPoint m_corners[8]
Definition: BoundingBox.h:33

Member Function Documentation

GlobalPoint const& BoundingBox::corner ( unsigned int  i) const
inline

Definition at line 25 of file BoundingBox.h.

References i, and m_corners.

25  {
26  return m_corners[i];
27  }
int i
Definition: DBlmapReader.cc:9
GlobalPoint m_corners[8]
Definition: BoundingBox.h:33
std::vector< GlobalPoint > BoundingBox::corners ( const BoundPlane plane)
static

Definition at line 24 of file BoundingBox.cc.

References BoundSurface::bounds(), Bounds::length(), query::result, Bounds::thickness(), Surface::toGlobal(), and Bounds::width().

Referenced by RodPlaneBuilderFromDet::computeBounds(), BladeShapeBuilderFromDet::computeBounds(), ForwardRingDiskBuilderFromDet::computeBounds(), PlaneBuilderForGluedDet::computeRectBounds(), ForwardDetLayer::computeSurface(), BarrelDetLayer::computeSurface(), CylinderBuilderFromDet::operator()(), and PhiBorderFinder::PhiBorderFinder().

25 {
26  std::vector<GlobalPoint> result;
27  result.reserve(8);
28 
29  float hLen = plane.bounds().length() / 2;
30  float hWid = plane.bounds().width() / 2;
31  float hThick = plane.bounds().thickness() / 2;
32 
33  result.push_back( plane.toGlobal( LocalPoint( hWid, hLen, hThick)));
34  result.push_back( plane.toGlobal( LocalPoint( hWid, hLen,-hThick)));
35  result.push_back( plane.toGlobal( LocalPoint( hWid,-hLen, hThick)));
36  result.push_back( plane.toGlobal( LocalPoint( hWid,-hLen,-hThick)));
37  result.push_back( plane.toGlobal( LocalPoint(-hWid, hLen, hThick)));
38  result.push_back( plane.toGlobal( LocalPoint(-hWid, hLen,-hThick)));
39  result.push_back( plane.toGlobal( LocalPoint(-hWid,-hLen, hThick)));
40  result.push_back( plane.toGlobal( LocalPoint(-hWid,-hLen,-hThick)));
41 
42  return result;
43 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
virtual float length() const =0
virtual float thickness() const =0
tuple result
Definition: query.py:137
const Bounds & bounds() const
Definition: BoundSurface.h:89
virtual float width() const =0
GlobalPoint const& BoundingBox::operator[] ( unsigned int  i) const
inline

Definition at line 22 of file BoundingBox.h.

References i, and m_corners.

22  {
23  return m_corners[i];
24  }
int i
Definition: DBlmapReader.cc:9
GlobalPoint m_corners[8]
Definition: BoundingBox.h:33

Member Data Documentation

GlobalPoint BoundingBox::m_corners[8]
private

Definition at line 33 of file BoundingBox.h.

Referenced by BoundingBox(), corner(), and operator[]().