computational geometry - Outermost Polygon from a set of Edges -
suppose have set of 2d line segments connected. need algorithm finds outermost segments in set. is, minimal subset bounds same region.
note: not same finding convex hull of points making segments.
edit: on top initial set of segments. below same outline interior segments deleted. (ignore little grey crosses, they're mark intersection points.)
how pencil...?
- find leftmost vertex (minimum x). if there's more one, choose lowest of them (minimum y). there no vertex below current one, take direction 'downwards' reference.
- find edges going current vertex , calculate directions (bearings). find 1 makes smallest positive angle (counter-clockwise) reference direction. outline segment.
- select other end new 'current' vertex , set direction from vertex recent one new reference direction.
- proceed step 2 until arrive start vertex.
- remove unvisited segments.
- remove orphaned vertices (if appeared in step 5).
Comments
Post a Comment