Functions | |
void | computeSpan (BoundSurface &plane) |
void boundSpan::computeSpan | ( | BoundSurface & | plane | ) |
Definition at line 10 of file BoundSpan.cc.
References PV3DBase< T, PVType, FrameType >::barePhi(), BoundSurface::bounds(), i, BoundSurface::m_phiSpan, BoundSurface::m_zSpan, Parameters::parameters, Geom::phiLess(), Surface::toGlobal(), tablePrinter::width, and z.
{ typedef std::pair<float, float> return_type; const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds()))); const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds()))); Surface::GlobalPoint corners[8]; if (trapezoidalBounds) { std::vector<float> const & parameters = (*trapezoidalBounds).parameters(); float hbotedge = parameters[0]; float htopedge = parameters[1]; float hapothem = parameters[3]; float thickness = (*trapezoidalBounds).thickness(); corners[0] = plane.toGlobal( LocalPoint( -htopedge, hapothem, thickness/2)); corners[1] = plane.toGlobal( LocalPoint( htopedge, hapothem, thickness/2)); corners[2] = plane.toGlobal( LocalPoint( hbotedge, -hapothem, thickness/2)); corners[3] = plane.toGlobal( LocalPoint( -hbotedge, -hapothem, thickness/2)); corners[4] = plane.toGlobal( LocalPoint( -htopedge, hapothem, -thickness/2)); corners[5] = plane.toGlobal( LocalPoint( htopedge, hapothem, -thickness/2)); corners[6] = plane.toGlobal( LocalPoint( hbotedge, -hapothem, -thickness/2)); corners[7] = plane.toGlobal( LocalPoint( -hbotedge, -hapothem, -thickness/2)); }else if(rectangularBounds) { float length = rectangularBounds->length(); float width = rectangularBounds->width(); float thickness = (*rectangularBounds).thickness(); corners[0] = plane.toGlobal( LocalPoint( -width/2, -length/2, thickness/2)); corners[1] = plane.toGlobal( LocalPoint( -width/2, +length/2, thickness/2)); corners[2] = plane.toGlobal( LocalPoint( +width/2, -length/2, thickness/2)); corners[3] = plane.toGlobal( LocalPoint( +width/2, +length/2, thickness/2)); corners[4] = plane.toGlobal( LocalPoint( -width/2, -length/2, -thickness/2)); corners[5] = plane.toGlobal( LocalPoint( -width/2, +length/2, -thickness/2)); corners[6] = plane.toGlobal( LocalPoint( +width/2, -length/2, -thickness/2)); corners[7] = plane.toGlobal( LocalPoint( +width/2, +length/2, -thickness/2)); }else{ } float phimin = corners[0].barePhi(); float phimax = phimin; float zmin = corners[0].z(); float zmax = zmin; for ( int i = 1; i < 8; i++ ) { float cPhi = corners[i].barePhi(); if ( Geom::phiLess( cPhi, phimin)) { phimin = cPhi; } if ( Geom::phiLess( phimax, cPhi)) { phimax = cPhi; } float z = corners[i].z(); if ( z < zmin) zmin = z; if ( z > zmax) zmax = z; } plane.m_zSpan.first = zmin; plane.m_zSpan.second = zmax; plane.m_phiSpan.first = phimin; plane.m_phiSpan.second = phimax; }