From 3d0656dbdee52b85ee384bd23c852dcefa8565c6 Mon Sep 17 00:00:00 2001 From: albertoesmp Date: Thu, 5 Oct 2023 16:53:03 +0200 Subject: [PATCH] Subray rotation precomptuation is now cached --- scripts/debug/hda_pulse_records_plotter.py | 211 +++++++++--------- src/dataanalytics/HDA_PulseRecorder.h | 32 ++- src/scanner/MultiScanner.cpp | 6 +- src/scanner/MultiScanner.h | 4 +- src/scanner/Scanner.h | 4 +- src/scanner/ScanningDevice.cpp | 110 ++++----- src/scanner/ScanningDevice.h | 21 +- src/scanner/SingleScanner.cpp | 6 +- src/scanner/SingleScanner.h | 4 +- .../detector/FullWaveformPulseRunnable.cpp | 41 ++-- .../detector/FullWaveformPulseRunnable.h | 12 +- 11 files changed, 229 insertions(+), 222 deletions(-) diff --git a/scripts/debug/hda_pulse_records_plotter.py b/scripts/debug/hda_pulse_records_plotter.py index e96252a40..dce2d5025 100755 --- a/scripts/debug/hda_pulse_records_plotter.py +++ b/scripts/debug/hda_pulse_records_plotter.py @@ -92,22 +92,19 @@ def read_records(path, sep=','): 'received_power': intensity_calc[:, 9], # Subray simulation records 'subray_hit': subray_sim[:, 0].astype(bool), - 'radius_step': subray_sim[:, 1], - 'circle_steps': subray_sim[:, 2], - 'circle_step': subray_sim[:, 3], - 'divergence_angle_rad': subray_sim[:, 4], - 'ray_dir_norm': subray_sim[:, 5], - 'subray_dir_norm': subray_sim[:, 6], - 'ray_subray_angle_rad': subray_sim[:, 7], - 'ray_subray_sign_check': subray_sim[:, 8], - 'subray_tmin': subray_sim[:, 9], - 'subray_tmax': subray_sim[:, 10], - 'subray_dir_x': subray_sim[:, 11], - 'subray_dir_y': subray_sim[:, 12], - 'subray_dir_z': subray_sim[:, 13], - 'ray_dir_x': subray_sim[:, 14], - 'ray_dir_y': subray_sim[:, 15], - 'ray_dir_z': subray_sim[:, 16] + 'divergence_angle_rad': subray_sim[:, 1], + 'ray_dir_norm': subray_sim[:, 2], + 'subray_dir_norm': subray_sim[:, 3], + 'ray_subray_angle_rad': subray_sim[:, 4], + 'ray_subray_sign_check': subray_sim[:, 5], + 'subray_tmin': subray_sim[:, 6], + 'subray_tmax': subray_sim[:, 7], + 'subray_dir_x': subray_sim[:, 8], + 'subray_dir_y': subray_sim[:, 9], + 'subray_dir_z': subray_sim[:, 10], + 'ray_dir_x': subray_sim[:, 11], + 'ray_dir_y': subray_sim[:, 12], + 'ray_dir_z': subray_sim[:, 13] } @@ -490,14 +487,8 @@ def do_subray_hit_subplot_hist( def do_subray_hit_plots(arec, brec, outdir): # Validate subray hit data if(not validate_record('subray_hit', arec, 'a') or - not validate_record('radius_step', arec, 'a') or - not validate_record('circle_steps', arec, 'a') or - not validate_record('circle_step', arec, 'a') or not validate_record('divergence_angle_rad', arec, 'a') or not validate_record('subray_hit', brec, 'b') or - not validate_record('radius_step', brec, 'b') or - not validate_record('circle_steps', brec, 'b') or - not validate_record('circle_step', brec, 'b') or not validate_record('divergence_angle_rad', brec, 'b') ): print('Cannot do subray hit plots') @@ -507,58 +498,66 @@ def do_subray_hit_plots(arec, brec, outdir): fig = init_figure() # Initialize figure # CASE A ax = fig.add_subplot(4, 5, 1) # Initialize hit2Dhist on (radstep,circstep) - do_subray_hit_subplot_hist2d( - fig, ax, - arec['circle_step'][arec['subray_hit']], - arec['radius_step'][arec['subray_hit']], - title='Hit distribution (100%) (A)', - ) + #do_subray_hit_subplot_hist2d( + # fig, ax, + # arec['circle_step'][arec['subray_hit']], + # arec['radius_step'][arec['subray_hit']], + # title='Hit distribution (100%) (A)', + #) + # Removed because radstep and circstep are no longer exported ax = fig.add_subplot(4, 5, 2) # Initialize a hist on radius step by hit - do_subray_hit_subplot_hist( - fig, ax, arec['subray_hit'], arec['radius_step'], - ylabel='Absolute' - ) + #do_subray_hit_subplot_hist( + # fig, ax, arec['subray_hit'], arec['radius_step'], + # ylabel='Absolute' + #) + # Removed because radstep is no longer exported ax = fig.add_subplot(4, 5, 3) # Initialize a hist on circle steps by hit - do_subray_hit_subplot_hist( - fig, ax, arec['subray_hit'], arec['circle_steps'], - ) + #do_subray_hit_subplot_hist( + # fig, ax, arec['subray_hit'], arec['circle_steps'], + #) + # Removed because circstep is no longer exported ax = fig.add_subplot(4, 5, 4) # Initialize a hist on circle step by hit - do_subray_hit_subplot_hist( - fig, ax, arec['subray_hit'], arec['circle_step'], - ) + #do_subray_hit_subplot_hist( + # fig, ax, arec['subray_hit'], arec['circle_step'], + #) + # Removed because circstep is no longer exported ax = fig.add_subplot(4, 5, 5) # Initialize a hist on div. angle by hit do_subray_hit_subplot_hist( fig, ax, arec['subray_hit'], 1e03*arec['divergence_angle_rad']*180/np.pi, ) ax = fig.add_subplot(4, 5, 6) # Initialize non-hit 2D hist on (rs, cs) - do_subray_hit_subplot_hist2d( - fig, ax, - arec['circle_step'][~arec['subray_hit']], - arec['radius_step'][~arec['subray_hit']], - title='No-hit distribution (100%)', - xlabel='Circle step', - ylabel='Radius step' - ) + #do_subray_hit_subplot_hist2d( + # fig, ax, + # arec['circle_step'][~arec['subray_hit']], + # arec['radius_step'][~arec['subray_hit']], + # title='No-hit distribution (100%)', + # xlabel='Circle step', + # ylabel='Radius step' + #) + # Removed because radstep and circstep are no longer exported ax = fig.add_subplot(4, 5, 7) # Initialize a hist on radius step by hit - do_subray_hit_subplot_hist( - fig, ax, arec['subray_hit'], arec['radius_step'], - ylabel='Relative ($100\\%$)', - relative=True, - xlabel='Radius step' - ) + #do_subray_hit_subplot_hist( + # fig, ax, arec['subray_hit'], arec['radius_step'], + # ylabel='Relative ($100\\%$)', + # relative=True, + # xlabel='Radius step' + #) + # Removed because radstep is no longer exported ax = fig.add_subplot(4, 5, 8) # Initialize a hist on circle steps by hit - do_subray_hit_subplot_hist( - fig, ax, arec['subray_hit'], arec['circle_steps'], - relative=True, - xlabel='Circle steps' - ) + #do_subray_hit_subplot_hist( + # fig, ax, arec['subray_hit'], arec['circle_steps'], + # relative=True, + # xlabel='Circle steps' + #) + # Removed because circstep is no longer exported ax = fig.add_subplot(4, 5, 9) # Initialize a hist on circle step by hit - do_subray_hit_subplot_hist( - fig, ax, arec['subray_hit'], arec['circle_step'], - relative=True, - xlabel='Circle step' - ) + #do_subray_hit_subplot_hist( + # fig, ax, arec['subray_hit'], arec['circle_step'], + # relative=True, + # xlabel='Circle step' + #) + # Removed because circstep is no longer exported ax = fig.add_subplot(4, 5, 10) # Initialize a hist on div. angle by hit do_subray_hit_subplot_hist( fig, ax, arec['subray_hit'], @@ -568,58 +567,66 @@ def do_subray_hit_plots(arec, brec, outdir): ) # CASE B ax = fig.add_subplot(4, 5, 11) # Initialize hit2Dhist on (radstep,circstep) - do_subray_hit_subplot_hist2d( - fig, ax, - brec['circle_step'][brec['subray_hit']], - brec['radius_step'][brec['subray_hit']], - title='Hit distribution (100%) (B)', - ) + #do_subray_hit_subplot_hist2d( + # fig, ax, + # brec['circle_step'][brec['subray_hit']], + # brec['radius_step'][brec['subray_hit']], + # title='Hit distribution (100%) (B)', + #) + # Removed because radstep and circstep are no longer exported ax = fig.add_subplot(4, 5, 12) # Initialize a hist on radius step by hit - do_subray_hit_subplot_hist( - fig, ax, brec['subray_hit'], brec['radius_step'], - ylabel='Absolute' - ) + #do_subray_hit_subplot_hist( + # fig, ax, brec['subray_hit'], brec['radius_step'], + # ylabel='Absolute' + #) + # Removed because radstep is no longer exported ax = fig.add_subplot(4, 5, 13) # Initialize a hist on circle steps by hit - do_subray_hit_subplot_hist( - fig, ax, brec['subray_hit'], brec['circle_steps'], - ) + #do_subray_hit_subplot_hist( + # fig, ax, brec['subray_hit'], brec['circle_steps'], + #) + # Removed because circstep is no longer exported ax = fig.add_subplot(4, 5, 14) # Initialize a hist on circle step by hit - do_subray_hit_subplot_hist( - fig, ax, brec['subray_hit'], brec['circle_step'], - ) + #do_subray_hit_subplot_hist( + # fig, ax, brec['subray_hit'], brec['circle_step'], + #) + # Removed because circstep is no longer exported ax = fig.add_subplot(4, 5, 15) # Initialize a hist on div. angle by hit do_subray_hit_subplot_hist( fig, ax, brec['subray_hit'], 1e03*brec['divergence_angle_rad']*180/np.pi, ) ax = fig.add_subplot(4, 5, 16) # Initialize non-hit 2D hist on (rs, cs) - do_subray_hit_subplot_hist2d( - fig, ax, - brec['circle_step'][~brec['subray_hit']], - brec['radius_step'][~brec['subray_hit']], - title='No-hit distribution (100%)', - xlabel='Circle step', - ylabel='Radius step' - ) + #do_subray_hit_subplot_hist2d( + # fig, ax, + # brec['circle_step'][~brec['subray_hit']], + # brec['radius_step'][~brec['subray_hit']], + # title='No-hit distribution (100%)', + # xlabel='Circle step', + # ylabel='Radius step' + #) + # Removed because radstep and circstep are no longer exported ax = fig.add_subplot(4, 5, 17) # Initialize a hist on radius step by hit - do_subray_hit_subplot_hist( - fig, ax, brec['subray_hit'], brec['radius_step'], - ylabel='Relative ($100\\%$)', - relative=True, - xlabel='Radius step' - ) + #do_subray_hit_subplot_hist( + # fig, ax, brec['subray_hit'], brec['radius_step'], + # ylabel='Relative ($100\\%$)', + # relative=True, + # xlabel='Radius step' + #) + # Removed because radstep is no longer exported ax = fig.add_subplot(4, 5, 18) # Initialize a hist on circle steps by hit - do_subray_hit_subplot_hist( - fig, ax, brec['subray_hit'], brec['circle_steps'], - relative=True, - xlabel='Circle steps' - ) + #do_subray_hit_subplot_hist( + # fig, ax, brec['subray_hit'], brec['circle_steps'], + # relative=True, + # xlabel='Circle steps' + #) + # Removed because circstep is no longer exported ax = fig.add_subplot(4, 5, 19) # Initialize a hist on circle step by hit - do_subray_hit_subplot_hist( - fig, ax, brec['subray_hit'], brec['circle_step'], - relative=True, - xlabel='Circle step' - ) + #do_subray_hit_subplot_hist( + # fig, ax, brec['subray_hit'], brec['circle_step'], + # relative=True, + # xlabel='Circle step' + #) + # Removed because circstep is no longer exported ax = fig.add_subplot(4, 5, 20) # Initialize a hist on div. angle by hit do_subray_hit_subplot_hist( fig, ax, brec['subray_hit'], diff --git a/src/dataanalytics/HDA_PulseRecorder.h b/src/dataanalytics/HDA_PulseRecorder.h index dce8fb55e..9f39d6b5a 100644 --- a/src/dataanalytics/HDA_PulseRecorder.h +++ b/src/dataanalytics/HDA_PulseRecorder.h @@ -53,37 +53,31 @@ class HDA_PulseRecorder : public HDA_Recorder{ * * [0] -> Subray hit (0 does not hit, 1 hit) * - * [1] -> Radius step + * [1] -> Divergence angle (in rad) * - * [2] -> Circle steps + * [2] -> Ray direction norm * - * [3] -> Circle step + * [3] -> Subray direction norm * - * [4] -> Divergence angle (in rad) + * [4] -> Angle between ray and subray (in rad) * - * [5] -> Ray direction norm + * [5] -> Ray-subray sign check (1 if sign match, 0 otherwise) * - * [6] -> Subray direction norm + * [6] -> Min time for subray intersection * - * [7] -> Angle between ray and subray (in rad) + * [7] -> Max time for subray intersection * - * [8] -> Ray-subray sign check (1 if sign match, 0 otherwise) + * [8] -> Subray direction (x component) * - * [9] -> Min time for subray intersection + * [9] -> Subray direction (y component) * - * [10] -> Max time for subray intersection + * [10] -> Subray direction (z component) * - * [11] -> Subray direction (x component) + * [11] -> Ray direction (x component) * - * [12] -> Subray direction (y component) + * [12] -> Ray direction (y component) * - * [13] -> Subray direction (z component) - * - * [14] -> Ray direction (x component) - * - * [15] -> Ray direction (y component) - * - * [16] -> Ray direction (z component) + * [13] -> Ray direction (z component) */ std::shared_ptr>> subraySim; diff --git a/src/scanner/MultiScanner.cpp b/src/scanner/MultiScanner.cpp index b1cb5ed4f..f5ef8c018 100644 --- a/src/scanner/MultiScanner.cpp +++ b/src/scanner/MultiScanner.cpp @@ -66,6 +66,8 @@ void MultiScanner::prepareSimulation() { sh->setDeflectorAnglePtr(&pmbd->state_currentBeamAngle_rad); } } + // Prepare scanning device + scanDevs[i].prepareSimulation(); } } @@ -158,9 +160,7 @@ Rotation MultiScanner::calcAbsoluteBeamAttitude(size_t const idx){ } void MultiScanner::computeSubrays( std::function &intersectionHandlingNoiseSource, std::map &reflections, diff --git a/src/scanner/MultiScanner.h b/src/scanner/MultiScanner.h index b96b731db..609dc9d7e 100644 --- a/src/scanner/MultiScanner.h +++ b/src/scanner/MultiScanner.h @@ -157,9 +157,7 @@ class MultiScanner : public Scanner{ */ void computeSubrays( std::function &intersectionHandlingNoiseSource, std::map &reflections, diff --git a/src/scanner/Scanner.h b/src/scanner/Scanner.h index 865fd588b..243c305fe 100644 --- a/src/scanner/Scanner.h +++ b/src/scanner/Scanner.h @@ -440,9 +440,7 @@ class Scanner : public Asset { */ virtual void computeSubrays( std::function &intersectionHandlingNoiseSource, std::map &reflections, diff --git a/src/scanner/ScanningDevice.cpp b/src/scanner/ScanningDevice.cpp index 6653c37b8..c9ee9fc1a 100644 --- a/src/scanner/ScanningDevice.cpp +++ b/src/scanner/ScanningDevice.cpp @@ -84,6 +84,43 @@ ScanningDevice::ScanningDevice(ScanningDevice const &scdev){ // *** M E T H O D S *** // // *********************** // +void ScanningDevice::prepareSimulation(){ + int const beamSampleQuality = FWF_settings.beamSampleQuality; + double const radiusStep_rad = beamDivergence_rad/beamSampleQuality; + + // Outer loop over radius steps from beam center to outer edge + for (int radiusStep = 0; radiusStep < beamSampleQuality; radiusStep++){ + double const subrayDivergenceAngle_rad = radiusStep * radiusStep_rad; + + // Rotate subbeam into divergence step (towards outer rim of the beam cone): + Rotation r1 = Rotation(Directions::right, subrayDivergenceAngle_rad); + + // Calculate circle step width: + int circleSteps = (int)(PI_2 * radiusStep); + + // Make sure that central ray is not skipped: + if (circleSteps == 0) { + circleSteps = 1; + } + + double const circleStep_rad = PI_2 / circleSteps; + + // # Loop over sub-rays along the circle + for (int circleStep = 0; circleStep < circleSteps; circleStep++){ + // Rotate around the circle + Rotation r2 = Rotation( + Directions::forward, circleStep_rad * circleStep + ); + r2 = r2.applyTo(r1); + // Cache subray generation data + cached_subrayRotation.push_back(r2); + cached_subrayDivergenceAngle_rad.push_back( + subrayDivergenceAngle_rad + ); + } + } +} + void ScanningDevice::configureBeam(){ cached_Bt2 = beamDivergence_rad * beamDivergence_rad; beamWaistRadius = (beamQuality * wavelength_m) / @@ -218,9 +255,7 @@ Rotation ScanningDevice::calcExactAbsoluteBeamAttitude( void ScanningDevice::computeSubrays( std::function &intersectionHandlingNoiseSource, std::map &reflections, @@ -237,60 +272,33 @@ void ScanningDevice::computeSubrays( ,std::shared_ptr pulseRecorder #endif ){ + size_t const numSubrays = cached_subrayRotation.size(); + for(size_t i = 0 ; i < numSubrays ; ++i) { + #if DATA_ANALYTICS >=2 + bool subrayHit; + #endif #if DATA_ANALYTICS >=2 - bool subrayHit; -#endif - - int const beamSampleQuality = FWF_settings.beamSampleQuality; - double const radiusStep_rad = beamDivergence_rad/beamSampleQuality; - - // Outer loop over radius steps from beam center to outer edge - for (int radiusStep = 0; radiusStep < beamSampleQuality; radiusStep++){ - double const subrayDivergenceAngle_rad = radiusStep * radiusStep_rad; - - // Rotate subbeam into divergence step (towards outer rim of the beam cone): - Rotation r1 = Rotation(Directions::right, subrayDivergenceAngle_rad); - - // Calculate circle step width: - int circleSteps = (int)(PI_2 * radiusStep); - - // Make sure that central ray is not skipped: - if (circleSteps == 0) { - circleSteps = 1; - } - - double const circleStep_rad = PI_2 / circleSteps; - - // # Loop over sub-rays along the circle - for (int circleStep = 0; circleStep < circleSteps; circleStep++){ -#if DATA_ANALYTICS >=2 - std::vector subraySimRecord( - 17, std::numeric_limits::quiet_NaN() - ); + std::vector subraySimRecord( + 14, std::numeric_limits::quiet_NaN() + ); #endif - handleSubray( - circleStep, - circleStep_rad, - r1, - subrayDivergenceAngle_rad, - intersectionHandlingNoiseSource, - reflections, - intersects + handleSubray( + cached_subrayRotation[i], + cached_subrayDivergenceAngle_rad[i], + intersectionHandlingNoiseSource, + reflections, + intersects #if DATA_ANALYTICS >=2 - ,subrayHit, - subraySimRecord + ,subrayHit, + subraySimRecord #endif - ); + ); #if DATA_ANALYTICS >=2 - HDA_GV.incrementGeneratedSubraysCount(); - subraySimRecord[0] = (double) subrayHit; - subraySimRecord[1] = (double) radiusStep; - subraySimRecord[2] = (double) circleSteps; - subraySimRecord[3] = (double) circleStep; - subraySimRecord[4] = subrayDivergenceAngle_rad; - pulseRecorder->recordSubraySimulation(subraySimRecord); + HDA_GV.incrementGeneratedSubraysCount(); + subraySimRecord[0] = (double) subrayHit; + subraySimRecord[1] = subrayDivergenceAngle_rad; + pulseRecorder->recordSubraySimulation(subraySimRecord); #endif - } } } diff --git a/src/scanner/ScanningDevice.h b/src/scanner/ScanningDevice.h index 754727175..165627586 100644 --- a/src/scanner/ScanningDevice.h +++ b/src/scanner/ScanningDevice.h @@ -204,6 +204,15 @@ class ScanningDevice : public Asset { * @see ScanningDevice::beamDivergence_rad */ double cached_Bt2; + /** + * @brief The rotation representing the subray divergence wrt to the + * central ray. + */ + std::vector cached_subrayRotation; + /** + * @brief The divergence angle for each subray. + */ + std::vector cached_subrayDivergenceAngle_rad; public: // *** CONSTRUCTION / DESTRUCTION *** // @@ -236,6 +245,14 @@ class ScanningDevice : public Asset { // *** M E T H O D S *** // // *********************** // + /** + * @brief Prepare the scanning device to deal with the simulation. + * + * For example, data related to the subray generation process will be + * cached to avoid redundant operations. + */ + void prepareSimulation(); + /** * @brief Configure beam related attributes. It is recommended to * reconfigure beam attributes always that beam divergence, beam quality @@ -300,9 +317,7 @@ class ScanningDevice : public Asset { */ void computeSubrays( std::function &intersectionHandlingNoiseSource, std::map &reflections, diff --git a/src/scanner/SingleScanner.cpp b/src/scanner/SingleScanner.cpp index 8b7245d7f..d2f64f1ce 100644 --- a/src/scanner/SingleScanner.cpp +++ b/src/scanner/SingleScanner.cpp @@ -104,6 +104,8 @@ void SingleScanner::prepareSimulation() { sh->setDeflectorAnglePtr(&pmbd->state_currentBeamAngle_rad); } } + // Prepare scanning device + scanDev.prepareSimulation(); } void SingleScanner::onLegComplete(){ // Call parent handler for on leg complete events @@ -194,9 +196,7 @@ Rotation SingleScanner::calcAbsoluteBeamAttitude(size_t const idx) { } void SingleScanner::computeSubrays( std::function &intersectionHandlingNoiseSource, std::map &reflections, diff --git a/src/scanner/SingleScanner.h b/src/scanner/SingleScanner.h index becee3d3a..34343ddcc 100644 --- a/src/scanner/SingleScanner.h +++ b/src/scanner/SingleScanner.h @@ -130,9 +130,7 @@ class SingleScanner : public Scanner{ */ void computeSubrays( std::function &intersectionHandlingNoiseSource, std::map &reflections, diff --git a/src/scanner/detector/FullWaveformPulseRunnable.cpp b/src/scanner/detector/FullWaveformPulseRunnable.cpp index be11e3c12..4709067ea 100644 --- a/src/scanner/detector/FullWaveformPulseRunnable.cpp +++ b/src/scanner/detector/FullWaveformPulseRunnable.cpp @@ -121,9 +121,7 @@ void FullWaveformPulseRunnable::computeSubrays( ){ scanner->computeSubrays( [&] ( - int const circleStep, - double const circleStep_rad, - Rotation &r1, + Rotation &subrayRotation, double const divergenceAngle, NoiseSource &intersectionHandlingNoiseSource, std::map &reflections, @@ -134,9 +132,7 @@ void FullWaveformPulseRunnable::computeSubrays( #endif ) -> void { handleSubray( - circleStep, - circleStep_rad, - r1, + subrayRotation, divergenceAngle, intersectionHandlingNoiseSource, reflections, @@ -159,9 +155,7 @@ void FullWaveformPulseRunnable::computeSubrays( } void FullWaveformPulseRunnable::handleSubray( - int const circleStep, - double const circleStep_rad, - Rotation &r1, + Rotation &subrayRotation, double const divergenceAngle, NoiseSource &intersectionHandlingNoiseSource, map &reflections, @@ -176,10 +170,7 @@ void FullWaveformPulseRunnable::handleSubray( subrayHit = false; #endif // Rotate around the circle: - Rotation r2 = Rotation(Directions::forward, circleStep_rad * circleStep); - r2 = r2.applyTo(r1); - - glm::dvec3 subrayDirection = pulse.getAttitude().applyTo(r2) + glm::dvec3 subrayDirection = pulse.getAttitude().applyTo(subrayRotation) .applyTo(Directions::forward); vector tMinMax = scene.getAABB()->getRayIntersection( pulse.getOriginRef(), @@ -187,21 +178,21 @@ void FullWaveformPulseRunnable::handleSubray( ); #if DATA_ANALYTICS >= 2 glm::dvec3 rayDirection = pulse.computeDirection(); - subraySimRecord[5] = glm::l2Norm(rayDirection); // Ray norm - subraySimRecord[6] = glm::l2Norm(subrayDirection); // Subray norm - subraySimRecord[7] = glm::angle( // Angle between ray and subray + subraySimRecord[2] = glm::l2Norm(rayDirection); // Ray norm + subraySimRecord[3] = glm::l2Norm(subrayDirection); // Subray norm + subraySimRecord[4] = glm::angle( // Angle between ray and subray rayDirection, subrayDirection ); - subraySimRecord[8] = (rayDirection[0] < 0) == (subrayDirection[0] < 0); - subraySimRecord[9] = tMinMax[0]; - subraySimRecord[10] = tMinMax[1]; - subraySimRecord[11] = subrayDirection.x; - subraySimRecord[12] = subrayDirection.y; - subraySimRecord[13] = subrayDirection.z; - subraySimRecord[14] = rayDirection.x; - subraySimRecord[15] = rayDirection.y; - subraySimRecord[16] = rayDirection.z; + subraySimRecord[5] = (rayDirection[0] < 0) == (subrayDirection[0] < 0); + subraySimRecord[6] = tMinMax[0]; + subraySimRecord[7] = tMinMax[1]; + subraySimRecord[8] = subrayDirection.x; + subraySimRecord[9] = subrayDirection.y; + subraySimRecord[10] = subrayDirection.z; + subraySimRecord[11] = rayDirection.x; + subraySimRecord[12] = rayDirection.y; + subraySimRecord[13] = rayDirection.z; #endif if(checkEarlyAbort(tMinMax)) return; diff --git a/src/scanner/detector/FullWaveformPulseRunnable.h b/src/scanner/detector/FullWaveformPulseRunnable.h index 3dcba2158..8f9744c82 100644 --- a/src/scanner/detector/FullWaveformPulseRunnable.h +++ b/src/scanner/detector/FullWaveformPulseRunnable.h @@ -95,17 +95,15 @@ class FullWaveformPulseRunnable : public AbstractPulseRunnable { * @brief Handle sub-rays along the circle * @param[in] tMinMax Minimum and maximum time to intersection with respect * to the axis aligned bounding box that bounds the scene - * @param[in] circleStep The iteration along the circle - * @param[in] circleStep_rad Angle in radians corresponding to the - * iteration - * @param[in] r1 Sub-beam rotation into divergence step + * @param[in] subrayRotation The rotation that must be applied to the ray + * to obtain the subray. It is typically a composition of two rotations, + * one to model the radius (i.e., how far from the center) and other + * to model the circumference (i.e., at which angle in the circle). * @param[in] divergenceAngle Subray divergence angle in radians * @see FullWaveformPulseRunnable::computeSubrays */ void handleSubray( - int const circleStep, - double const circleStep_rad, - Rotation &r1, + Rotation &subrayRotation, double const divergenceAngle, NoiseSource &intersectionHandlingNoiseSource, std::map &reflections,