# Create non-overlapping item?Insert element into list without new list?

I am not sure is there an easy way to do such things, question below:

there are N unit circles in plane, I want to let user could drag those circles, but while drag, circles shouldn't overlap each other.

I have found a way to do this question, create 2-value function for every circle, and create each point in order, like "P_2 = PointIn[C_1(x,y)>=4]" , "P_3 = PointIn[C_1(x,y)>=4 and C_2(x,y)>=4]"... etc.

But this way make drag very slow, and make some unpredictable result while drag lower index circle into higher index circle.

Another question is about list.

I want to make a button, when user pick it, there would add one more circle into plane.

And, there is a list contain all center, so it should also insert P_{N+1} into the list.

But geogebra's list function always create a new list, I can't just type List_Point = Insert[List_Point , P_{N+1}] (but like N=N+1 works)

Is there a method to add a element into a list(but not in a new list)?

Thank you for read and help :)

One possibility for Question 1:

All points are referenced in a list. If any element in this list changes, a script is triggered.

If any points are below the minimum distance, this script call a generated Execute List script. In addition, he ensures that the old coordinates of the points are stored.

The generated script sets all points to the previous / old coordinates.

maybe a possible alternative: DynamicCoordinates[ <Point>, <x-Coordinate>, <y-Coordinate> ]

-------------------

Possible extension:

The point is not set to the previous value. Instead, the (force-) triangle of the three points (resting, moving, moving_{old}) is considered. So that the moving point is guided around the stationary circle.

I meant something like the draft in the attachment.

But I have four unsolved problems:

- The oscillating when the point B is moved and a circle is touched.

- When the circle around B simultaneously touches two circles

- Implementation in a system with n * (n-1) circles (performance)

- When several (marked) circles are moved at the same time

And certainly other problems I have not recognized yet.

.

But sure (?) it‘is solvable. The question is only for what .…

If it's about learning by play with scripts and find the limits, then it's OK.

But if it‘s a partial task within a larger application (for using), then it becomes critical.

If these are non-deterministic problems (eg physical simulation), in this case GGB is an unsuitable tool.

And ….

only as a rough idea: a completely different solution exists (maybe!) In the use of inequalities.

Sorry, inequalities was your idea (?) in the first post of this thread.

I has try to find a solution for your idea of inequality for 10 circles.

But no success, also not with optimizing (dynamically, only for the moved circle with 2 circles for inequality).

.

But I found a solution for a Script without oscillation (principle in the attachment)

I see in your draft sometime the passive circles are shift and sometime the active circle is blocked. What are the target rules?

For shift I have a solution in my "stock" (including recursion). For blocking (and go around) still I haven't a solution. The main problem is: the active circle can "tunneling" the passive circle.

Quote: "It's not some target rules in my file.."

But, maybe you can explain the rules:

Example:

- Under which condition the passive point is moved

-- If moved: where

-- If moved what happens with the active point

- Under which condition the active point is blocked

-- If blocked what else happens

-----

In the attachment my "state of thinking" (similar to yours. I think: count in 2 circles is enough)

Loading...Comments have been locked on this page!