FORUMS: list search recent posts

# Proximity based scaling so touching not overlapping...!!!!???

FAQ   •   VIEW ALL
 Proximity based scaling so touching not overlapping...!!!!??? on Jul 25, 2018 at 2:55:30 pm

OK
So
In Newton you can scale up objects inthe AE comp, and in Newton, other objects will get out of the way.
I want to build something interactive, outside of newton.
What I would like to be able to do is scale up some circles, and the other circles to scale and move out of the way...

I have a map of the world that I have made with different sized circles.
I want to be able to change the scale of circles and other circles to react, so there is no overlapping and no gaps, well no big gaps...

Any general thought / ideas?
Could be an expression question, or maybe a particle question...

if it is easier, imagine a fill screen full of circles.
imagine wanting to scale some up and down and the others grow shrink to fill the gaps so the edges still touch.
I could reanimate in newton each time, but I wondered if there could be a better way to do it..

Maybe too complicated..
Tris

 Re: Proximity based scaling so touching not overlapping...!!!!???on Jul 25, 2018 at 3:59:19 pm

Here's a little background for you.
https://en.wikipedia.org/wiki/Circle_packing

 Re: Proximity based scaling so touching not overlapping...!!!!???on Jul 25, 2018 at 5:31:39 pm

Great start thanks!
I was hoping for a amount of random scale slider.
But then I had to have some circles be a fixed size
still good to set a challenge; always better to be an expression if leaving behind at a freelance gig

 Re: Proximity based scaling so touching not overlapping...!!!!???on Jul 25, 2018 at 5:50:46 pm

It's more a task for an object-oriented programming language than AE expressions. A simple implementation where other circles' radii would change to get out of the way when an adjacent circle's increasing radius overlapped them would be possible, but even that would likely become inefficient with a large number of circles. You would have to have each circle on its own layer with a slider to control the relative radius and then check every other circle layer for overlap and their relative radius. I say relative, since as soon as the circle touches other circles, the "radius" would end up becoming a value that gives the relative force at which the circle pushes against other circles.

Kalleheikki Kannisto
Senior Graphic Designer

 Re: Proximity based scaling so touching not overlapping...!!!!???on Jul 25, 2018 at 6:33:26 pm

My concern (and why I wasn't more helpful) is that without memory in expressions I worried that the circles would calculate at each frame based on the current parameters, and, with round off errors, the entire array of circles would jitter - you can see that happening in 3d software when you start "packing". In a big dynamics sim you don't notice it as dominoes are falling but watch when the movement (supposedly) stops - everything looks like its on just a bit too much cocaine.

But of all the shapes, circles should be the easiest because when it comes to size and how close they are to one another it's just the radius and probably a vector thats needed in the math. There are a few youtube videos (i'm looking for them now) on packing and voids, that describe how the beginning "row" of circles (or spheres) matter as that determines the packing order from that point forward.

One approach might be to do this in something like Processing, or (gulp) Flash and then export the results if a movie is what you are after. HTML 5 could also do it but I don't know about export on that platform. And then of course there's C4D with it's built in gap algorithm and cloning and particle engines. (you could do flat shaded spheres on a plane - they would look like circles and it would be fairly automated)
Wolfram (Alpha or Mathematica) could also help as Stephen Wolfram's original cell work included a lot of "packing" code.