Best described in the image below.
I need to know the minimum distance to move a reference polygon (shown in red) in one axis (just y) such that will just touch the other polygon. If it's inside the polygon, it will need to move outwards.
I tried to look at all the lines in one polygon and all the points in another, project the point onto the line, and get the difference between the point y and the projection point y, then find the minimum distance. However, this had the issue that if the polygons overlapped and farthest line in one polygon and farthest point in the other had the minimum distance, it would give a result that would make the polygons overlap.
Edit: by projecting the point on the line, I mean find the y value for a point on the line that has the same x value as the original point. Skip this step if the x value lies outside of the line.
geometry
andcomputational-geometry
to attract more readers (can't do it myself, edits need to be more than 10 chars, grrr!) – kebs