From: Scott Worley Date: Thu, 20 Dec 2012 08:30:35 +0000 (-0800) Subject: Find the parameters of rot2 *after* taking rot1 X-Git-Url: http://git.scottworley.com/nt3d/commitdiff_plain/1b9ec3f33236204d027507b7dec5215677b51707 Find the parameters of rot2 *after* taking rot1 --- diff --git a/nt3d.js b/nt3d.js index 5f7fad7..59b11b2 100644 --- 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])); + var shapex = [[1,0,0]]; 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]); - 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); }