CMS 3D CMS Logo

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

LinearSearchNavSurfaceImpl Class Reference

#include <LinearSearchNavSurfaceImpl.h>

List of all members.

Public Member Functions

void addVolume (const NavVolume *vol, const Bounds *bounds, SurfaceOrientation::Side side)
const Boundsbounds (const NavVolume *vol)
const NavVolumenextVolume (const NavSurface::LocalPoint &point, SurfaceOrientation::Side side) const

Private Types

typedef std::pair< const
NavVolume *, const Bounds * > 
VolumeAndBounds
typedef std::vector
< VolumeAndBounds
VolumeContainer

Private Member Functions

const NavVolumefindVolume (const NavSurface::LocalPoint &point, const VolumeContainer &volumes) const

Private Attributes

VolumeContainer theNegVolumes
VolumeContainer thePosVolumes

Detailed Description

Definition at line 10 of file LinearSearchNavSurfaceImpl.h.


Member Typedef Documentation

typedef std::pair< const NavVolume*, const Bounds*> LinearSearchNavSurfaceImpl::VolumeAndBounds [private]

Definition at line 23 of file LinearSearchNavSurfaceImpl.h.

Definition at line 24 of file LinearSearchNavSurfaceImpl.h.


Member Function Documentation

void LinearSearchNavSurfaceImpl::addVolume ( const NavVolume vol,
const Bounds bounds,
SurfaceOrientation::Side  side 
)

Definition at line 41 of file LinearSearchNavSurfaceImpl.cc.

References Bounds::clone(), SurfaceOrientation::positiveSide, theNegVolumes, and thePosVolumes.

{
    if (side == SurfaceOrientation::positiveSide) {
        thePosVolumes.push_back( VolumeAndBounds( vol, bounds->clone()));
    }
    else {
        theNegVolumes.push_back( VolumeAndBounds( vol, bounds->clone()));
    }
}
const Bounds * LinearSearchNavSurfaceImpl::bounds ( const NavVolume vol)

Definition at line 30 of file LinearSearchNavSurfaceImpl.cc.

References i, theNegVolumes, and thePosVolumes.

{
    for (VolumeContainer::const_iterator i=thePosVolumes.begin(); i!=thePosVolumes.end(); i++) {
        if (i->first == vol) return i->second;
    }
    for (VolumeContainer::const_iterator i=theNegVolumes.begin(); i!=theNegVolumes.end(); i++) {
        if (i->first == vol) return i->second;
    }
    return 0; // if volume not found
}
const NavVolume * LinearSearchNavSurfaceImpl::findVolume ( const NavSurface::LocalPoint point,
const VolumeContainer volumes 
) const [private]

Definition at line 16 of file LinearSearchNavSurfaceImpl.cc.

References i.

Referenced by nextVolume().

{
// simple linear search for volume who's bounds contain the point

//MM:return 0 if no volume was defined on this side! 
  if (vols.size()==0) return 0;

    for (VolumeContainer::const_iterator i=vols.begin(); i!=vols.end(); i++) {
        if (i->second->inside(point)) return i->first;
    }
    return 0; // if point outside of all bounds on this side
}
const NavVolume * LinearSearchNavSurfaceImpl::nextVolume ( const NavSurface::LocalPoint point,
SurfaceOrientation::Side  side 
) const

Definition at line 4 of file LinearSearchNavSurfaceImpl.cc.

References findVolume(), SurfaceOrientation::negativeSide, SurfaceOrientation::positiveSide, theNegVolumes, and thePosVolumes.

{
    if (side == SurfaceOrientation::positiveSide) {
        return findVolume( point, thePosVolumes);
    }
    else if (side == SurfaceOrientation::negativeSide) {
        return findVolume( point, theNegVolumes);
    }
    else return 0;  // should not be called with SurfaceOrientation::onSurface
}

Member Data Documentation

Definition at line 27 of file LinearSearchNavSurfaceImpl.h.

Referenced by addVolume(), bounds(), and nextVolume().

Definition at line 26 of file LinearSearchNavSurfaceImpl.h.

Referenced by addVolume(), bounds(), and nextVolume().