Move assert helper to utility

This commit is contained in:
Shaunak Kishore
2015-09-12 20:32:39 -04:00
parent 7650575a34
commit 1db6bb4eeb
3 changed files with 7 additions and 16 deletions

View File

@ -3,14 +3,6 @@ var MIN_CORNER_ANGLE = 0.1*Math.PI;
var MIN_CORNER_TANGENT_DISTANCE = 4;
var REVERSAL_PENALTY = 0.5;
// Error out if the condition does not hold.
function assert(condition, message) {
if (!condition) {
console.error(message);
throw new Error;
}
}
// Helper methods for use with angles, which are floats in [-pi, pi).
var Angle = {
subtract: function(angle1, angle2) {
@ -28,7 +20,7 @@ var Angle = {
},
};
// Helper methods for use with "points", which are just pairs of integers.
// Helper methods for use with "points", which are pairs of integers.
var Point = {
angle: function(point) {
return Math.atan2(point[1], point[0]);