diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-08-17 02:38:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-08-17 02:42:08 +0400 |
commit | f789d0b606d6d11af2987cb50bca59d53d9896d2 (patch) | |
tree | 72646bebf327cd2db8ab20ee725e31e6f996d12c /source | |
parent | fe2b4613985f2e3914a7e54a1abe70a43871905d (diff) |
Math Lib: replace epsilon with check against zero
line-tri intersection depended on scale, The check made small triangles & lines fail.
So just check for divide by zero as ray-cast currently does.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 96a531bc4ea..1cd1d1875fc 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -977,7 +977,7 @@ bool isect_line_tri_v3(const float p1[3], const float p2[3], cross_v3_v3v3(p, d, e2); a = dot_v3v3(e1, p); - if ((a > -0.000001f) && (a < 0.000001f)) return 0; + if (a == 0.0f) return 0; f = 1.0f / a; sub_v3_v3v3(s, p1, v0); @@ -1016,7 +1016,7 @@ bool isect_line_tri_epsilon_v3(const float p1[3], const float p2[3], cross_v3_v3v3(p, d, e2); a = dot_v3v3(e1, p); - if ((a > -0.000001f) && (a < 0.000001f)) return 0; + if (a == 0.0f) return 0; f = 1.0f / a; sub_v3_v3v3(s, p1, v0); |