algorithm - Combine nearby polygons -
i have pair of (closed) polygons, each defined sequence of points (the vertices). polygons each represent plot of land, separated small river, stream forms narrow gap between 2 polygons.
i'm looking algorithm identify , remove gap, joining 2 polygons 1 connected polygon.
the figure below shows example, original polygons green , red, , resulting polygon shown in yellow.

so far, have been able following:
- for each edge in polygon-a, find nearest vertex in polygon-b.
- find vertices of polygon-b within distance of polygon-a.
but i'm not sure need now.
you might @ modification of convex hull algorithm. convex hull algorithm takes set of points , draws minimal convex shape containing points. question convex hull question, except concave regions @ top. using convex hull algorithm give this, close, not quite need (note .the brown areas different)

depending on you're trying do, convex hull might "good enough", if not, still might able modify algorithm ignore parts non-convex, , simpy merge 2 polygons.
specifically this pdf shows how 2 convex hulls can merged, lot you're trying do.
Comments
Post a Comment