diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-07-07 12:19:35 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-07-07 12:19:35 -0400 |
commit | 4724cf214273906f1960295aec4ca0f7ef52e4e7 (patch) | |
tree | b434192b354c3f569a028eb92e87eb8beafb5bea /beam_trace.m | |
parent | 60997d4fceb6372d3f254fd196e4dd379d089a23 (diff) | |
download | wgmr-4724cf214273906f1960295aec4ca0f7ef52e4e7.tar.gz wgmr-4724cf214273906f1960295aec4ca0f7ef52e4e7.zip |
do not propagate weak beams
Diffstat (limited to 'beam_trace.m')
-rw-r--r-- | beam_trace.m | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/beam_trace.m b/beam_trace.m index 401391a..4120208 100644 --- a/beam_trace.m +++ b/beam_trace.m @@ -4,6 +4,8 @@ function ret = beam_trace(beams, faces, borders) % border similar to faces cell array which enclose the beam % i.e. it does not leave the polygon consisting of border faces + intensity_threshold = .001; + Nbeams=size(beams)(2); if ( Nbeams == 0 ) % no more beam to trace @@ -15,15 +17,25 @@ function ret = beam_trace(beams, faces, borders) beam=beams{i}; [is_face_hit, hit_position, hit_distance, new_beams] = face_beam_interaction(beam, faces); if (is_face_hit) - beam_trace(new_beams, faces, borders ); - continue; - end - - % beam does not hit face but it should stop and borders - beam.face=NA; - [is_face_hit, hit_position, hit_distance, new_beams] = face_beam_interaction(beam, borders); - if (!is_face_hit) - error('borders are badly defined, the beam misses them'); + %% remove beams which are to weak to trace + N_new_beams=size(new_beams)(2); + intense_enough_beams={}; + intense_beams_counter=0; + for k=1:N_new_beams + if ( new_beams{k}.intensity > intensity_threshold ) + intense_beams_counter=intense_beams_counter + 1; + intense_enough_beams{intense_beams_counter}=new_beams{k}; + end + end + intense_beams_counter + beam_trace(intense_enough_beams, faces, borders ); + else + % beam does not hit face but it should stop and borders + beam.face=NA; + [is_face_hit, hit_position, hit_distance, new_beams] = face_beam_interaction(beam, borders); + if (!is_face_hit) + error('borders are badly defined, the beam misses them'); + end end end end |