diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-07-07 22:35:29 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-07-07 22:35:29 -0400 |
commit | fd616411eceb30b03262ce1afe994480931986b8 (patch) | |
tree | c6f7af14854cc018d11745fe108dd0e183ed7ba7 | |
parent | 0f64ebb1c51d2fe893ff96d422eaeff86fbf7b0f (diff) | |
download | wgmr-fd616411eceb30b03262ce1afe994480931986b8.tar.gz wgmr-fd616411eceb30b03262ce1afe994480931986b8.zip |
limit for very shallo interception angles
-rw-r--r-- | beam2face_distance.m | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/beam2face_distance.m b/beam2face_distance.m index 4df0f49..1f6a44f 100644 --- a/beam2face_distance.m +++ b/beam2face_distance.m @@ -14,7 +14,8 @@ function [hit_distance, hit_position, is_face_hit] = beam2face_distance(beam,fac %% simple check for intersection of two vectors % if beam are parallel no intersection is possible % we do this via simulated cross product calculation - if ( ( k(1)*kf(2)-k(2)*kf(1) ) == 0 ) + angle_tolerance = 1e-15; + if ( abs( (k(1)*kf(2)-k(2)*kf(1))/norm(k)/norm(kf) ) <= angle_tolerance ) % beams never intercept return; end |