@@ -111,12 +111,13 @@ double mass_attenuation_coef( float atomic_number, float energy );
111111double transmition_coefficient_generic ( float atomic_number, float areal_density,
112112 float energy );
113113
114+
115+ void example_integration ();
116+
114117// When debugging we will grab a static mutex so we dont get jumbled stdout
115118#define DEBUG_RAYTRACE_CALCS 0
116119
117120
118- void example_integration ();
119-
120121/* * Runs some simple test cases for #cylinder_exit_position, and cause assert(0) on error. */
121122void test_cylinder_exit_position ();
122123
@@ -144,6 +145,16 @@ double exit_point_of_sphere_z( const double source_point[3],
144145 double observation_dist,
145146 bool postiveSolution = true );
146147
148+ /* * An enum to to tell #cylinder_exit_position which exit point from sphere you want.
149+
150+ A better name would be CylinderIntersectionDirection, but thats too long.
151+ */
152+ enum class CylExitDir
153+ {
154+ TowardDetector,
155+ AwayFromDetector
156+ };
157+
147158/* * Starting from a 'source_point' within the volume of the cylinder, and heading towards the 'detector_point' (think center
148159 of the detector face), returns the total attenuation coefficient along the path, including recursing into any sub-tubes, as well as
149160 sets the point where the ray leaves the cylinder.
@@ -156,7 +167,9 @@ double exit_point_of_sphere_z( const double source_point[3],
156167 @param[in] detector The {x, y, z} point on the detector face we care about (so center of detector, unless you are integrating over
157168 the detector face), in the coordinate system where cylinder is centered at {0,0,0}.
158169 @param[out] exit_point The final exit point from the cylinder, where the path will no longer go through the volume.
159- @returns the attenuation coefficient from the path through the cylinder and its sub-cylinders. E.g.,
170+ @returns The distance from source location to exit point. Returns 0.0 if line does not intersect cylinder. Note that this is not the
171+ distance in the cylinder, but the total distance from source to exit point, so if source is outside volume, may be larger than cylinder
172+ dimensions.
160173 \code{.cpp}
161174 double exit_point[3];
162175 const double distance_in_m = cylinder_exit_position( 0.5*m, 100*cm, {0,0.1*m,20*cm}, {0,0,10*m}, exit_point );
@@ -166,6 +179,7 @@ double exit_point_of_sphere_z( const double source_point[3],
166179double cylinder_exit_position ( const double radius, const double half_length,
167180 const double source[3 ],
168181 const double detector[3 ],
182+ const CylExitDir direction,
169183 double exit_point[3 ] );
170184
171185
@@ -199,7 +213,7 @@ struct DistributedSrcCalc
199213 void eval_spherical ( const double xx[], const int *ndimptr,
200214 double ff[], const int *ncompptr ) const ;
201215
202- void eval_cyl_end_on ( const double xx[], const int *ndimptr,
216+ void eval_single_cyl_end_on ( const double xx[], const int *ndimptr,
203217 double ff[], const int *ncompptr ) const ;
204218
205219 void eval_cylinder ( const double xx[], const int *ndimptr,
0 commit comments