Float / Repel

Hi Every, perhaps an elementary task that i am trying to complete, but Im faily new to grasshopper & Kangaroo specially. I’m trying to create a bounding box with a number of curves inside it (lets say 5 for now). the curve will be a mix of circles or rectangles. the goal is to be able to drag any surface from its centroid and it would repel / displace any adjacent surface to it. The closest point between any 2 surfaces should be maintained at a minim distance x. under no circumstances the surfaces exit the bounding box.
i would appreciate everyones thought on this and if there are any example scripts that can be shared, that would be super helpful

Hi, @Yassine_Mohamad. Welcome to the forum!

That sounds like a interesting project. Typical forum standards are to let us know what exploration(s) you’ve already done, including attaching the relevant file(s). Otherwise, you are asking for tutoring or someone else to do the work for you. My reply also bumps your topic for others to see it again (not buried), in case someone in the community takes interest in helping. Hope that helps… cheers!

Here are a couple of examples.

You can use the CurveCollide goal, and to maintain a border you can do the collision with offsets of the curves, then transform the original curves to the resulting frames.

Note that because this goal treats all closed curves as solid objects, the containing shape here is made by treating it as a strip bent into a thick border. This is used as a Passive collider, meaning it does not get moved by the other curves.

shapes_in_rectangle.gh (8.3 KB)

shapes_in_rectangle_offset.gh (13.4 KB)

Thank you so much, that is really helpful. i did give the script a go! i appreciate your feedback

Amazing, thank you so much Daniel. This is super helpful! i will take a deeper look into this and see what i can do. I appreciate your time looking into this.