// 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);
}