CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

BoundingBox Class Reference

#include <BoundingBox.h>

List of all members.

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.

{}
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().

                                                {
 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));
 
}

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.

                                                   {
    return  m_corners[i];
  }
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 NavVolume6Faces::computeBounds(), PlaneBuilderForGluedDet::computeRectBounds(), BarrelDetLayer::computeSurface(), ForwardDetLayer::computeSurface(), AlignableSiStripDet::consistifyAlignments(), and PhiBorderFinder::PhiBorderFinder().

{
   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;
}
GlobalPoint const& BoundingBox::operator[] ( unsigned int  i) const [inline]

Definition at line 22 of file BoundingBox.h.

References i, and m_corners.

                                                       {
    return  m_corners[i];
  }

Member Data Documentation

Definition at line 33 of file BoundingBox.h.

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