From fd616411eceb30b03262ce1afe994480931986b8 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Thu, 7 Jul 2011 22:35:29 -0400 Subject: limit for very shallo interception angles --- beam2face_distance.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3