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:

https://alpha.editor.p5js.org/simontiger/sketches/Sy1CX71xZ

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:

IMG_4702

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:

 

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s