diff options
-rw-r--r-- | beam_trace.m | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/beam_trace.m b/beam_trace.m index 4120208..53bb4b6 100644 --- a/beam_trace.m +++ b/beam_trace.m @@ -1,10 +1,10 @@ -function ret = beam_trace(beams, faces, borders) +function img = beam_trace(beams, faces, borders, border_limits, img) %% trace beam and all it reflections and refractions on faces % for beams and faces structure description see face_beam_interaction.m % 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; + intensity_threshold = 1e-8; % intensity of the weakest beam which we still trace Nbeams=size(beams)(2); if ( Nbeams == 0 ) @@ -17,18 +17,18 @@ 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) + img=make_beam_trace(beam, hit_position, border_limits, img); %% 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 ) + 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 ); + img = beam_trace(intense_enough_beams, faces, borders, border_limits, img); else % beam does not hit face but it should stop and borders beam.face=NA; |