summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--beam2face_distance.m3
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