]> git.scottworley.com Git - nt3d/commitdiff
Increase the skip-rotation epsilon
authorScott Worley <ScottWorley@ScottWorley.com>
Mon, 31 Dec 2012 07:04:58 +0000 (23:04 -0800)
committerScott Worley <ScottWorley@ScottWorley.com>
Mon, 31 Dec 2012 07:04:58 +0000 (23:04 -0800)
Observed: a 0.9999999999999999 dot product yields a 1.4901161193847656e-8
angle.  The new, larger epsilon skips rotation for this point.

nt3d.js

diff --git a/nt3d.js b/nt3d.js
index 038994678f9328de72fca780f4a8b639a58e915b..7198e22cf2482d9e8f8ef4029b8b967f2698a599 100644 (file)
--- a/nt3d.js
+++ b/nt3d.js
@@ -288,8 +288,8 @@ nt3d = {
                // by crossing a and b to get a rotation axis and using
                // angle_between to get a rotation angle.
                var angle = this.angle_between(this.unit(a), this.unit(b));
                // by crossing a and b to get a rotation axis and using
                // angle_between to get a rotation angle.
                var angle = this.angle_between(this.unit(a), this.unit(b));
-               if (Math.abs(angle) < 1e-15) {
-                       // No siginificant rotation to perform.  Bail to avoid
+               if (Math.abs(angle) < 1e-7) {
+                       // No significant rotation to perform.  Bail to avoid
                        // NaNs and numerical error
                        return points;
                }
                        // NaNs and numerical error
                        return points;
                }