From: Scott Worley Date: Tue, 25 Dec 2012 04:53:07 +0000 (-0800) Subject: Fix a bug in project() X-Git-Url: http://git.scottworley.com/nt3d/commitdiff_plain/c92a9d3f963401b999f661dde190a739ebbeafde Fix a bug in project() It was kind of sheer luck that any extrudes worked before this fix. Also, add rotation to torus_by_extrude, which was an easy way to reproduce this. --- diff --git a/nt3d.js b/nt3d.js index c69c185..fd57824 100644 --- a/nt3d.js +++ b/nt3d.js @@ -211,7 +211,7 @@ nt3d = { }, project: function(a, b) { // Project b onto a var a_magnitude = this.magnitude(a); - return this.scale(a, this.dot(a, b) / a_magnitude * a_magnitude); + return this.scale(a, this.dot(a, b) / (a_magnitude * a_magnitude)); }, project_to_orthogonal: function(a, b) { // The nearest thing to b that is orthogonal to a diff --git a/torus_by_extrude.html b/torus_by_extrude.html index 4655519..10ae92e 100644 --- a/torus_by_extrude.html +++ b/torus_by_extrude.html @@ -3,8 +3,9 @@ Torus by extrude