point[2] + offset[2]];
},
angle_between: function(a, b) { // a and b must be unit vectors
- return Math.acos(this.dot(a, b));
+ var the_dot = this.dot(a, b);
+ if (the_dot <= -1) {
+ return Math.PI;
+ }
+ if (the_dot >= 1) {
+ return 0;
+ }
+ return Math.acos(the_dot);
},
rotate_about_origin: function(points, axis, angle) { // axis must be a unit vector
// From http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/
if (nan_in_face) nan_face_count ++;
}
if (nan_count != 0) {
- alert(nan_count + " NaNs in " + nan_point_count + " points in " + nan_face_count + " faces.");
+ alert(nan_count + " NaNs in " + nan_point_count + " points in " + nan_face_count + " faces (" + (100 * nan_face_count / (this.points.length/3)) + "% of faces).");
}
// Remove degenerate faces