#include <LinearSearchNavSurfaceImpl.h>
Public Member Functions | |
void | addVolume (const NavVolume *vol, const Bounds *bounds, SurfaceOrientation::Side side) |
const Bounds * | bounds (const NavVolume *vol) |
const NavVolume * | nextVolume (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 NavVolume * | findVolume (const NavSurface::LocalPoint &point, const VolumeContainer &volumes) const |
Private Attributes | |
VolumeContainer | theNegVolumes |
VolumeContainer | thePosVolumes |
Definition at line 10 of file LinearSearchNavSurfaceImpl.h.
typedef std::pair< const NavVolume*, const Bounds*> LinearSearchNavSurfaceImpl::VolumeAndBounds [private] |
Definition at line 23 of file LinearSearchNavSurfaceImpl.h.
typedef std::vector< VolumeAndBounds> LinearSearchNavSurfaceImpl::VolumeContainer [private] |
Definition at line 24 of file LinearSearchNavSurfaceImpl.h.
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.
Referenced by NavCone::addVolume(), NavPlane::addVolume(), and NavCylinder::addVolume().
{ if (side == SurfaceOrientation::positiveSide) { thePosVolumes.push_back( VolumeAndBounds( vol, bounds->clone())); } else { theNegVolumes.push_back( VolumeAndBounds( vol, bounds->clone())); } }
Definition at line 30 of file LinearSearchNavSurfaceImpl.cc.
References i, theNegVolumes, and thePosVolumes.
Referenced by NavCone::bounds(), NavCylinder::bounds(), and NavPlane::bounds().
{ 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.
Referenced by NavCone::nextVolume(), NavCylinder::nextVolume(), and NavPlane::nextVolume().
{ 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 }
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().