Input data = https://pastebin.com/raw/30QpQWqq
input data format:
square = [x1, y1, z1, x2, y2, z2, ...]
graviy_30_50 = [[x1, y1, z1, x2, y2, z2, ...], [...]]
sheben_30_50 = [[x1, y1, z1, x2, y2, z1, ...], [...]]
If you create a drawing using these coordinates, you will get the result on the left side of the drawing.
The task is to move elements that lie on other elements. The desired result is shown on the right side of the picture.
At the same time, the elements must not go outside the square and cross it.
What implementation option do you have to offer?
The only solution I can think of is to use the shapely library to push an element lying on top of another element until it no longer intersects with the other element