]> git.scottworley.com Git - nt3d/commitdiff
Find the parameters of rot2 *after* taking rot1
authorScott Worley <ScottWorley@ScottWorley.com>
Thu, 20 Dec 2012 08:30:35 +0000 (00:30 -0800)
committerScott Worley <ScottWorley@ScottWorley.com>
Thu, 20 Dec 2012 08:30:35 +0000 (00:30 -0800)
nt3d.js

diff --git a/nt3d.js b/nt3d.js
index 5f7fad750de86a8064f433ab44d049e86f278a9b..59b11b25d5461212898ab5425d96d60a46121cb1 100644 (file)
--- a/nt3d.js
+++ b/nt3d.js
@@ -91,14 +91,18 @@ nt3d = {
                        //    constrain its rotation about shapenormals[i].
                        var rot1axis = this.unit(this.cross([0,0,1], shapenormals[i]));
                        var rot1angle = this.angle_between([0,0,1], this.unit(shapenormals[i]));
                        //    constrain its rotation about shapenormals[i].
                        var rot1axis = this.unit(this.cross([0,0,1], shapenormals[i]));
                        var rot1angle = this.angle_between([0,0,1], this.unit(shapenormals[i]));
+                       var shapex = [[1,0,0]];
                        if (rot1angle > 1e-7) {
                                loop = this.rotate_about_origin(loop, rot1axis, rot1angle);
                        if (rot1angle > 1e-7) {
                                loop = this.rotate_about_origin(loop, rot1axis, rot1angle);
+                               shapex = this.rotate_about_origin(shapex, rot1axis, rot1angle);
+
                        }
 
                        // 2. Rotate around shapenormals[i] so that [1,0,0]
                        //    becomes fixedpathnormals[i].
                        var rot2axis = this.unit(shapenormals[i]);
                        }
 
                        // 2. Rotate around shapenormals[i] so that [1,0,0]
                        //    becomes fixedpathnormals[i].
                        var rot2axis = this.unit(shapenormals[i]);
-                       var rot2angle = this.angle_between([1,0,0], this.unit(fixedpathnormals[i]));
+                       var rot2angle = this.angle_between(shapex[0], this.unit(fixedpathnormals[i]));
+                       console.log(rot2angle);
                        if (rot2angle > 1e-7) {
                                loop = this.rotate_about_origin(loop, rot2axis, rot2angle);
                        }
                        if (rot2angle > 1e-7) {
                                loop = this.rotate_about_origin(loop, rot2axis, rot2angle);
                        }