Coding, JavaScript, Simon makes gamez, Simon's Own Code

Polar Distribution to create clusters

Simon has written a code about using Polar Distribution to create clusters in p5.js (JavaScript). The code is available online at:

The little particles are attracted to one another but don’t overlap. This is a simpler kind of attraction where every particle has two perception radii: a minimum and a maximum perception radius. Two particles within each other’s maximum radius are attracted to each other but repel each other once one of them enters the other’s minimum radius:


Simon placed this project in a GitHub chat and got some interesting advice (make the mouse a repulser). In the video below he changes the code, creating a repulsing element:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s