diff options
Diffstat (limited to 'js/util.js')
| -rw-r--r-- | js/util.js | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -41,7 +41,9 @@ function choice(a){ return a[randint(a.length)] } function deg(n){ return n*180/PI } function rad(n){ return n*PI/180 } function pixel(x,y){ return 4*(y*w+x) } -function mod(n,m){ return n-(m * Math.floor(n/m)) } +function mod(n,m){ return n-(m * floor(n/m)) } +function dist(x0,y0,x1,y1){ return sqrt(pow(x1-x0,2)+pow(y1-y0,2) } +function angle(x0,y0,x1,y1){ return atan2(y1-y0,x1-x0) } function step (n,a,b) { return clamp((n - a) / (b - a), 0.0, 1.0); |
