diff options
| author | jules <jules@okfoc.us> | 2013-12-17 09:54:00 -0500 |
|---|---|---|
| committer | jules <jules@okfoc.us> | 2013-12-17 09:54:00 -0500 |
| commit | 3ed9546b8671c277011085c649986d48208a8a35 (patch) | |
| tree | b2733aa134865f12d95973ddc83e39ec27eea912 | |
| parent | afce8a28e780846e2ac0e737d6ef180f5896aba1 (diff) | |
| parent | 0b74af017f032f5f79771954d034717ed3700e50 (diff) | |
Merge branch 'master' of lmno:dither
| -rw-r--r-- | js/util.js | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -41,6 +41,13 @@ 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 rgbpixel(d,x,y){ + var p = pixel(x,y) + r = d[p] + g = d[p+1] + b = d[p+2] + a = d[p+3] +} 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) } |
