Hacker News new | past | comments | ask | show | jobs | submit login

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

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.





Approximating a normal distribution by summing three uniformly distributed random numbers is pretty clever. And it's a nice visual effect as well.


A nice illustration of the 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.


I 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 :)


Thanks! Yeah, I messed it up (used 270 degrees for some reason..). Updated to your version.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: