Accretion
A particle system simulates accretion, where dark gray attractive particles draw in and merge with crimson repellent particles, repelling them instead. Two sliders control particle density and the proportion of attractive versus repellent forces. The visualization uses D3’s `d3.forceSimulation` with `d3.forceMagnetic` for inverse-square attraction/repulsion, `d3.forceBounce` for inelastic collisions, and `d3.forceSurface` to keep particles within the SVG canvas, with controls updating particle poles dynamically.
AI-generated descriptionSimulation of accretion of particles attracted by electrostatic or gravitational forces, analogous to the interaction within dust clouds found in the early stages of <a href="https://en.wikipedia.org/wiki/Accretion_(astrophysics)">star formation</a>.
Uses D3's force plugin forceMagnetic to simulate the attraction/repulsion of objects of varying mass in an inverse-square relationship with distance. Further, particles are prevented from overlapping by applying a non-elastic collision force using forceBounce.
Using the slider controls you can add/remove particles to the system, and regulate the ratio of attractive (green attracts all other) vs repellent (red repels all other).
forked from <a href='http://bl.ocks.org/vasturiano/'>vasturiano</a>'s block: <a href='http://bl.ocks.org/vasturiano/27fbd16d7e9131fbc8e8e93113f9896c'>Accretion</a>