Box3DIntersector Class Reference

#include <Specific_Box3DIntersector.h>

Inheritance diagram for Box3DIntersector:

VolumeIntersectorB IVolumeIntersector List of all members.

Public Member Functions

 Box3DIntersector ()
 default constructor
 Box3DIntersector (int verb)
 constructor providing the verbosity level
virtual ~Box3DIntersector ()
 default destructor
bool enterInVolume (const IState &iniState, const IVolume &volume, IModel &model, int sens, std::string &intersectedSurf, HyperVector &natHV)
 computes the state when exiting from this volume
bool exitFromVolume (const IState &iniState, const IVolume &volume, IModel &model, int sens, std::string &intersectedSurf, HyperVector &natHV)
 computes the state when entering from this volume

Detailed Description

Definition at line 10 of file Specific_Box3DIntersector.h.


Constructor & Destructor Documentation

Box3DIntersector::Box3DIntersector (  )  [inline]

default constructor

Definition at line 15 of file Specific_Box3DIntersector.h.

00015 {}

Box3DIntersector::Box3DIntersector ( int  verb  )  [inline]

constructor providing the verbosity level

Definition at line 18 of file Specific_Box3DIntersector.h.

00018 :VolumeIntersectorB(verb){}

virtual Box3DIntersector::~Box3DIntersector (  )  [inline, virtual]

default destructor

Definition at line 22 of file Specific_Box3DIntersector.h.

00022 {};


Member Function Documentation

bool Box3DIntersector::enterInVolume ( const IState iniState,
const IVolume volume,
IModel model,
int  sens,
std::string &  intersectedSurf,
HyperVector natHV 
) [virtual]

computes the state when exiting from this volume

Implements VolumeIntersectorB.

Definition at line 8 of file Volume_Box3DIntersector.cxx.

References IVolume::borderSurfaceMap(), VolumeIntersectorB::m_verbosity, MINDIST, IVolume::name(), IModel::naturalHVAtFiniteSurface(), p, and HyperVector::vector().

00014 {
00015   bool intersected;
00016   std::string surfName = "";
00017   HyperVector natHV;
00018   double nat_min = 1e10;
00019   double nat_max = -1e10;
00020   ISurface* surf;
00021   // select the apropriate sens of propagation
00022   // forward = 1, backward = -1
00023 
00024 
00025   typedef std::map<std::string, ISurface*>::const_iterator CI;
00026   for (CI p = vol.borderSurfaceMap().begin(); p!= vol.borderSurfaceMap().end();p++){
00027     surf = p->second;
00028     intersected = model.naturalHVAtFiniteSurface(iniState, *surf, natHV);
00029     if (m_verbosity > 1) cout << "   '" << p->first << "'\t natural = "  << natHV.vector()[0] << endl;
00030     if(intersected){       
00031       if(sens == 1 && natHV.vector()[0] > MINDIST && natHV.vector()[0] <= nat_min){
00032     nat_min = natHV.vector()[0]; 
00033     surfName = p->first;
00034     natHVfinal = natHV;
00035       }
00036       else if(sens == -1 && natHV.vector()[0] < -MINDIST && natHV.vector()[0] >= nat_max){
00037     nat_max = natHV.vector()[0]; 
00038     surfName = p->first;
00039     natHVfinal = natHV;
00040       }
00041     }
00042   }
00043 
00044   if (surfName != ""){ 
00045     intersectedSurf = surfName;
00046     if (m_verbosity > 1){
00047       cout << "Volume Intersector:   intersecting volume  '" << vol.name() <<  "'  by  '"<< surfName 
00048        <<"'  surface  in natural = " << natHVfinal.vector()[0]  
00049        << endl;
00050     }
00051     return true;
00052   }
00053   else{
00054       if (m_verbosity > 1)
00055     cout << "Volume Intersector:   fail to intersect volume  '" << vol.name() << "'  !!!!!!!!!" << endl;
00056     return false;
00057   }
00058 
00059 }

bool Box3DIntersector::exitFromVolume ( const IState iniState,
const IVolume volume,
IModel model,
int  sens,
std::string &  intersectedSurf,
HyperVector natHV 
) [virtual]

computes the state when entering from this volume

Implements VolumeIntersectorB.

Definition at line 63 of file Volume_Box3DIntersector.cxx.

References IVolume::borderSurfaceMap(), VolumeIntersectorB::m_verbosity, MINDIST, IModel::naturalHVAtFiniteSurface(), p, and HyperVector::vector().

00069 {
00070 
00071 
00072 
00073   bool intersected;
00074   std::string surfName = "";
00075   HyperVector natHV;
00076   double nat_min = 1e10;
00077   double nat_max = -1e10;
00078   ISurface* surf;
00079 
00080 
00081   typedef std::map<std::string, ISurface*>::const_iterator CI;
00082   for (CI p = vol.borderSurfaceMap().begin(); p!= vol.borderSurfaceMap().end();p++){
00083     surf = p->second;
00084     intersected = model.naturalHVAtFiniteSurface(iniState,*surf,natHV);
00085     if (m_verbosity > 1) cout << "   '" << p->first << "'\t natural = "  << natHV.vector()[0] << endl;
00086     
00087     if(intersected && fabs(natHV.vector()[0]) > MINDIST){      
00088       if(sens == 1 && natHV.vector()[0] > MINDIST && natHV.vector()[0] <= nat_min){
00089     nat_min = natHV.vector()[0]; 
00090     surfName = p->first;
00091     natHVfinal = natHV;
00092       }
00093       else if(sens == -1 && natHV.vector()[0] < -MINDIST && natHV.vector()[0] >= nat_max){
00094     nat_max = natHV.vector()[0]; 
00095     surfName = p->first;
00096     natHVfinal = natHV;
00097       }
00098     }
00099   }
00100 
00101   if (surfName != ""){ 
00102     intersectedSurf = surfName;
00103     return true;
00104   }
00105   else{
00106     return false;
00107   }
00108 
00109 }


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 08:03:59 2009 for MIPP(E907) by  doxygen 1.4.7