4 ms·
Your circular spray brush has a pretty awful distribution of points. If you hold it in one location for several seconds you can tell that it's heavily biasing p
by Kronopath 13y ago
Your circular spray brush has a pretty awful distribution of points. If you hold it in one location for several seconds you can tell that it's heavily biasing points to the bottom left, and you tend to get very visible "lines" as well. I tweaked it a bit to improve it:
http://codepen.io/anon/pen/EqbnG http://codepen.io/anon/pen/EqbnG
My implementation still isn't perfect, as it biases points in the middle over points around the edges. (A consequence of the fact that a bunch of points evenly distributed around a small radius are closer together than a bunch of points evenly distributed around a large radius.) But it's definitely better than the one in the article.
- andrelaszlo 13y agoI thought the same thing. Seems like the author messed up while converting radians to degrees, or something. I changed it to var angle = (Math.PI * 2 * Math.random()); But it has your problem as well. To be fair, a spray can also focuses the paint in the center like that :)
- andrelaszlo 13y agomore "spraycanny": http://codepen.io/anon/pen/utcLx http://codepen.io/anon/pen/utcLx
- Kronopath 13y agoApproximating a normal distribution by summing three uniformly distributed random numbers is pretty clever. And it's a nice visual effect as well.
- RobinL 13y agoA nice illustration of the central limit theorem! http://en.wikipedia.org/wiki/Central_limit_theorem http://en.wikipedia.org/wiki/Central_limit_theorem This means there's nothing special about 3 - the more times you add uniforms together, the more normal it becomes. Also it doesn't matter if the uniform isn't uniform.
- kangax 13y agoThanks! Yeah, I messed it up (used 270 degrees for some reason..). Updated to your version.