From 769fd4e9b93bf2130527ed7bad661ce17f4cf550 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 8 Sep 2014 12:27:00 -0400 Subject: quantize() --- js/util.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js') diff --git a/js/util.js b/js/util.js index c3940d3..80fce9c 100644 --- a/js/util.js +++ b/js/util.js @@ -55,6 +55,7 @@ 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 pixel(x,y){ return 4*(mod(y,actual_h)*actual_w+mod(x,actual_w)) } function rgbpixel(d,x,y){ -- cgit v1.2.3-70-g09d2