CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

GeneralNSurfaceDelimitedBounds Class Reference

#include <GeneralNSurfaceDelimitedBounds.h>

Inheritance diagram for GeneralNSurfaceDelimitedBounds:
Bounds

List of all members.

Public Types

typedef std::pair< const
Surface
*, SurfaceOrientation::Side
SurfaceAndSide
typedef std::vector
< SurfaceAndSide
SurfaceContainer

Public Member Functions

virtual Boundsclone () const
 GeneralNSurfaceDelimitedBounds (const Surface *surf, const std::vector< SurfaceAndSide > &limits)
virtual bool inside (const Local3DPoint &lp) const
 Determine if the point is inside the bounds.
virtual bool inside (const Local3DPoint &, const LocalError &, float scale=1.f) const
 Determine if a point is inside the bounds, taking error into account.
virtual float length () const
virtual float thickness () const
virtual float width () const

Private Member Functions

bool myInside (const Local3DPoint &lp, float tolerance) const

Private Attributes

SurfaceContainer theLimits
const SurfacetheSurface

Detailed Description

Bounds for a surface of any type, delimited by N other surfaces of any type. A point is "inside" if it is on the correct side of all delimiting surfaces. This way of computing "inside" is relatively expensive, and should only be applied to situations where there is no specialized implementation for the concrete surface types.

Definition at line 16 of file GeneralNSurfaceDelimitedBounds.h.


Member Typedef Documentation

Definition at line 19 of file GeneralNSurfaceDelimitedBounds.h.

Definition at line 20 of file GeneralNSurfaceDelimitedBounds.h.


Constructor & Destructor Documentation

GeneralNSurfaceDelimitedBounds::GeneralNSurfaceDelimitedBounds ( const Surface surf,
const std::vector< SurfaceAndSide > &  limits 
) [inline]

Definition at line 22 of file GeneralNSurfaceDelimitedBounds.h.

Referenced by clone().

                                                                             :
        theLimits( limits), theSurface(surf) {}

Member Function Documentation

virtual Bounds* GeneralNSurfaceDelimitedBounds::clone ( void  ) const [inline, virtual]

Implements Bounds.

Definition at line 37 of file GeneralNSurfaceDelimitedBounds.h.

References GeneralNSurfaceDelimitedBounds().

{return new GeneralNSurfaceDelimitedBounds(*this);}
bool GeneralNSurfaceDelimitedBounds::inside ( const Local3DPoint ,
const LocalError ,
float  scale = 1.f 
) const [virtual]

Determine if a point is inside the bounds, taking error into account.

Implements Bounds.

Definition at line 6 of file GeneralNSurfaceDelimitedBounds.cc.

References myInside(), mathSSE::sqrt(), LocalError::xx(), and LocalError::yy().

{
    // derive on-surface tolerance from LocalError in a very approximate way
    float tolerance = scale * sqrt( le.xx()*le.xx() + le.yy()*le.yy());

    return myInside( lp, tolerance);
}
virtual bool GeneralNSurfaceDelimitedBounds::inside ( const Local3DPoint ) const [inline, virtual]

Determine if the point is inside the bounds.

Implements Bounds.

Definition at line 31 of file GeneralNSurfaceDelimitedBounds.h.

References myInside().

                                                     {
    return myInside(lp,0);
  }
virtual float GeneralNSurfaceDelimitedBounds::length ( ) const [inline, virtual]

"Lenght" of the bounded volume; refer to the concrete class documentation for the specific definition.

Implements Bounds.

Definition at line 26 of file GeneralNSurfaceDelimitedBounds.h.

{ return 0;}
bool GeneralNSurfaceDelimitedBounds::myInside ( const Local3DPoint lp,
float  tolerance 
) const [private]

Definition at line 15 of file GeneralNSurfaceDelimitedBounds.cc.

References i, SurfaceOrientation::onSurface, theLimits, theSurface, and Surface::toGlobal().

Referenced by inside().

{
    // cout << "GeneralNSurfaceDelimitedBounds::myInside called with local point " << lp << endl;

    Surface::GlobalPoint gp = theSurface->toGlobal(lp);

    // cout << "corresponding Global point " << gp << endl;

    for (SurfaceContainer::const_iterator i=theLimits.begin(); i!=theLimits.end(); i++) {

//      cout << "Local pos in boundary surface " <<  i->first->toLocal(gp) 
//           << " side " << i->first->side(gp, tolerance) << " should be " 
//           << i->second << endl;

        SurfaceOrientation::Side side = i->first->side(gp, tolerance);
        if (side != i->second && side != SurfaceOrientation::onSurface) return false;
    }
    return true;
}
virtual float GeneralNSurfaceDelimitedBounds::thickness ( ) const [inline, virtual]

"Thickness" of the bound around the surface; refer to the concrete class documentation for the specific definition.

Implements Bounds.

Definition at line 28 of file GeneralNSurfaceDelimitedBounds.h.

{ return 0;}
virtual float GeneralNSurfaceDelimitedBounds::width ( ) const [inline, virtual]

"width" of the bounds; refer to the concrete class documentation for the specific definition.

Implements Bounds.

Definition at line 27 of file GeneralNSurfaceDelimitedBounds.h.

{ return 0;}

Member Data Documentation

Definition at line 41 of file GeneralNSurfaceDelimitedBounds.h.

Referenced by myInside().

Definition at line 42 of file GeneralNSurfaceDelimitedBounds.h.

Referenced by myInside().