1 #ifndef H_J_PHOTON_PATH
2 #define H_J_PHOTON_PATH
27 namespace JPP {
using namespace JMARKOV; }
31 using namespace JGEOMETRY3D ;
32 using namespace JGEOMETRY2D ;
80 for(
iterator it=begin() ; it!=end() ; ++it )
92 for( const_iterator it=begin() ; it!=end() ; ++it )
109 for( ; v2!=end() ; ++v1,++v2 ) {
111 L += (*v2-*v1).getLength() ;
125 for(
unsigned int i=1 ; i<size() ; ++i ) {
128 if( (v1.
getX()>x) != (v2.
getX()>x) ) {
130 res.push_back( v1+frac*(v2-v1) ) ;
138 for(
unsigned int i=0 ; i<size() ; ++i ) {
140 if( i+1!=size() ) oss <<
", " ;
149 for(
unsigned int i=1 ; i<size() ; ++i ) {
152 if( (v1.
getY()>y) != (v2.
getY()>y) ) {
154 res.push_back( v1+frac*(v2-v1) ) ;
164 for(
unsigned int i=1 ; i<size() ; ++i ) {
167 if( (v1.
getZ()>z) != (v2.
getZ()>z) ) {
169 res.push_back( v1+frac*(v2-v1) ) ;
178 for(
unsigned int i=1 ; i<size() ; ++i ) {
189 double r_to_center = to_center.
getLength() ;
192 double ct = dir_seg.
getDot(dir_to_center) ;
195 if( 1-ct*ct > r*r/(r_to_center*r_to_center) ) {
204 double D = sqrt( r_to_center*r_to_center*(ct*ct-1) + r*r ) ;
205 double xi1 = -r_to_center*ct +
D ;
206 if( xi1>0 && xi1<Lseg )
return true ;
207 double xi2 = -r_to_center*ct -
D ;
208 if( xi2>0 && xi2<Lseg )
return true ;
215 for(
unsigned int i=1 ; i<size() ; ++i ) {
226 double r_to_center = to_center.
getLength() ;
229 double ct = dir_seg.
getDot(dir_to_center) ;
232 if( 1-ct*ct > r*r/(r_to_center*r_to_center) ) {
241 double D = sqrt( r_to_center*r_to_center*(ct*ct-1) + r*r ) ;
244 double xi1 = -r_to_center*ct +
D ;
245 if( xi1<0 || xi1>Lseg ) {
250 double xi2 = -r_to_center*ct -
D ;
252 if( xi2>0 && xi2<Lseg ) {
254 if( xi2<xi1 ) xi1 = xi2 ;
257 if( xi1>0 && xi1<Lseg ) {
Interface for binary output.
do echo Generating $dir eval D
JIO::JReader & read(JIO::JReader &in)
Read from input.
std::vector< JPosition3D > getPointsWithZ(double z)
return all coordinates where the photon path has the given z
bool hitsSphere(const JPosition3D &pos, double r)
Returns whether the photon path intersects a sphere of radius r at position pos.
Forward declaration of binary output.
JPhotonPath(int _nscat)
constructor to actually be used
string getString()
get a string with the path vertex positions
std::vector< JPosition3D > getPointsWithY(double y)
return all coordinates where the photon path has the given y
JPhotonPath()
default constructor
double getY() const
Get y position.
Interface for binary input.
double getLength() const
Get length.
alias put_queue eval echo n
JIO::JWriter & write(JIO::JWriter &out) const
Write to output.
JPosition3D getSphereHitPosition(const JPosition3D &pos, double r)
Returns the position where the photon hits a sphere of radius r at position pos. If the photon does n...
double getX() const
Get x position.
double getDot(const JVersor3D &versor) const
Get dot product.
Data structure for polyline in three dimensions.
Data structure for position in three dimensions.
std::vector< JPosition3D > getPointsWithX(double x)
return all coordinates where the photon path has the given x
Data structure for normalised vector in three dimensions.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
double getZ() const
Get z position.
double getLength()
get the total path length
std::vector< double > weight