Finding a common interior point for two polygons
1 answer
You can use a variant of the Vatti polygon trimming algorithm . Watti's algorithm is a sweep algorithm that basically means scanning over the vertices of both polygons, from (say) left to right, as well as any intersections between their boundaries. Between the vertical lines through any of the next two of these "events", you then examine the trapezoids / triangles created by the polygons. Once you find a trapezoid that is part of both, you can simply pull out your centroid.
+4
source to share