this is a very basic setup of static attraction/repulsions, but I think you are probably looking for a dynamic simulation, which is just a slightly different variation of this, will show it at the end
in a basic setup, for instance:
- points in the green area are pulled toward the green circle center, the farther from the circle center the more pull
- points in the blue area are pushed away from the blue circle center, the closer to the circle center the more push
- points in the yellow area are subject to push/pull from both
- points outside of any circle are just not influenced by anything
if I turn on the Vectors preview, you can see the forces visualized as arrows, which makes them much easier to understand:
once you have calculated all the forces that act for each point, you can sum those up into a final movement vector:
so the final result would look something like this, also increasing the number of attraction/repulsion points:
attraction-repulsion-points_inno.gh (20.5 KB)
the main problem of this sort of static simulation is that, in order to have some sort of noticeable movement of each given point, you might want to increase the multiplier of each vector by a lot… which would just make stuff a little bit funky and create islands of points, like:
usually in this situation you want to use very small vector multipliers, and iterate through various stages of the simulation in a loop, where you iteratively update the position of any given point depending on its position
for instance, using Anemone plugin:
and of course you can stop the simulation and for instance change the radius of influence of attractor/repulsion points, then start the simulation again
a radius of influence that changes during the simulation might indicate (just making an example) neigborhoods that you want to avoid at night but you are fine to visit with daylight, or pubs that are open only at a certain time… I mean, you can also hard-core change the influence of each point and graph it in such a way it changes with the simulation, during the simulation itself
so you have infinite opportunities
stupid example to animate attractors with graphs, could be something like this:
and the very same way you can animate repulsion:
Loop_attraction-repulsion-points_inno.gh (30.6 KB)
consider that you can have attraction/repulsion points moving during the simulation, you can have their force parametrized over time both in intensity and behavior… I mean, possibilities are endless, just define their behavior, split it in as many frames as the simulation iterations are, and use List item to pick the right one for each step (or if they follow functions, they can just be calculated depending on iteration)
a closing thought, this stuff might come much easier via code
because if you have many different attraction/repulsion points, where for each you define its private behavior, spaghetti can become very messy very fast 