mirror of
https://github.com/skishore/makemeahanzi.git
synced 2025-11-01 20:27:44 +08:00
Move assert helper to utility
This commit is contained in:
@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user