[Bf-blender-cvs] [f789d0b] master: Math Lib: replace epsilon with check against zero
Campbell Barton
noreply at git.blender.org
Sun Aug 17 00:44:00 CEST 2014
Commit: f789d0b606d6d11af2987cb50bca59d53d9896d2
Author: Campbell Barton
Date: Sun Aug 17 08:38:24 2014 +1000
Branches: master
https://developer.blender.org/rBf789d0b606d6d11af2987cb50bca59d53d9896d2
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.
===================================================================
M source/blender/blenlib/intern/math_geom.c
===================================================================
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 96a531b..1cd1d18 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);
More information about the Bf-blender-cvs
mailing list