diff options
| author | Jules <jules@asdf.us> | 2015-04-22 16:42:05 -0400 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2015-04-22 16:42:05 -0400 |
| commit | 91ef84313ab4e1288411c247bb23e09af64e13f0 (patch) | |
| tree | d25cfb9d06f2ba682a547060669cdd65791fabd0 /js | |
| parent | 2c73aff69edaa83618ebfefa0e15ab47769bb3f2 (diff) | |
linkz
Diffstat (limited to 'js')
| -rw-r--r-- | js/util.js | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -55,7 +55,9 @@ 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 avg(m,n,a){ return (m*(a-1)+n)/a } -function quantize(a,b){ return ~~(a/b)*b } +function quantize(a,b){ return round(a/b)*b } +function quantize_down(a,b){ return floor(a/b)*b } +function quantize_up(a,b){ return ceil(a/b)*b } function pixel(x,y){ return 4*(mod(y,actual_h)*actual_w+mod(x,actual_w)) } function rgbpixel(d,x,y){ |
