- // becomes shapenormals[i] by crossing [0,0,1] and
- // shapenormals[i] to get a rotation axis and taking
- // their dot product to get a rotation angle. This
- // puts the shape in the correct plane, but does not
- // 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]));
- if (rot1angle > 1e-7) {
- loop = this.rotate_about_origin(loop, rot1axis, rot1angle);
- }
+ // becomes shapenormals[i]. This puts the shape in
+ // the correct plane, but does not constrain its
+ // rotation about shapenormals[i].
+ loop = this.rotate_onto(loop, [0,0,1], shapenormals[i]);
+ var shapex = loop.pop();