Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:14

0001 
0002 
0003 #include "DataFormats/GeometrySurface/interface/GeneralNSurfaceDelimitedBounds.h"
0004 #include "DataFormats/GeometrySurface/interface/LocalError.h"
0005 
0006 bool GeneralNSurfaceDelimitedBounds::inside(const Local3DPoint& lp, const LocalError& le, float scale) const {
0007   // derive on-surface tolerance from LocalError in a very approximate way
0008   float tolerance = scale * sqrt(le.xx() * le.xx() + le.yy() * le.yy());
0009 
0010   return myInside(lp, tolerance);
0011 }
0012 
0013 bool GeneralNSurfaceDelimitedBounds::myInside(const Local3DPoint& lp, float tolerance) const {
0014   // cout << "GeneralNSurfaceDelimitedBounds::myInside called with local point " << lp << endl;
0015 
0016   Surface::GlobalPoint gp = theSurface->toGlobal(lp);
0017 
0018   // cout << "corresponding Global point " << gp << endl;
0019 
0020   for (SurfaceContainer::const_iterator i = theLimits.begin(); i != theLimits.end(); i++) {
0021     //  cout << "Local pos in boundary surface " <<  i->first->toLocal(gp)
0022     //       << " side " << i->first->side(gp, tolerance) << " should be "
0023     //       << i->second << endl;
0024 
0025     SurfaceOrientation::Side side = i->first->side(gp, tolerance);
0026     if (side != i->second && side != SurfaceOrientation::onSurface)
0027       return false;
0028   }
0029   return true;
0030 }