How Place a convex polygon inside restricted area (rectangle) maximizing minimal distance among other polygons

Viewed 76

I have a bounded area (x, y, width, height), and set of convex polygons [[[p1x1, p1y1], [p1x2, p1y2],...], [[p2x1, p2y1], [p2x2, p2y2],...]]
The polygons can be outside of the bounded area.
Then I have another convex polygon with a set of vertexes ([[Px1, Py1], [Px2, Py2],...]), I need to translate this polygon to maximizing the distance among all other polygons, but keeping this polygon inside the bonded area that I defined before.

The distance is assumed from the borders of polygon that I am placing, to the borders of other polygons (P1, P2, P3, .... PN)

I calculated the minimal distance among all polygons with Gilbert–Johnson–Keerthi distance algorithm. I need to maximize this value.

If there is no an easy solution, for now I can assume that all polygons are rotated rectangles.

I just need to find the correct algorithm, any suggestion is appreciated, but if you can provide a solution in javascript is better.

EDIT: I draw a diagram to show the situation: enter image description here

I need to move the red rectangle to maximize the minimal distance among all blue rectangles.
The red rectangle can be moved inside the black rectangle area.
The green line are all the minimum distances, and the red line is the minimum
among all.
I want end up in a situation like the second image. enter image description here

0 Answers
Related