1
$\begingroup$

There is a set of 2D polylines, each polyline defined by an ordered array of vertices (each vertex is joined with the previous one by a line, if drawn). Together, when drawn, these polylines form one or more contours, but they can be fragmented (a single contour consisting of several polylines)

The task is to build new polylines, based on the original points, so that the new ones form only "outermost" contours. This is illustrated by the pictures. The first one is the original set of poly lines, each shown with a different color. The second picture is what I'd like to have: 4 arrays-polylines (4 contours)

I need to build an algorithm to transform the first pic into the second one. I suppose there should be a simple solution but not sure which side to tackle this task from. How to approach this? Thanks for any clues!

enter image description here

enter image description here

$\endgroup$
1
  • $\begingroup$ Adapt the gift wrapping algorithm to this setting. (Form an undirected graph. Find connected components. Each connected component represents a single shape. Find the perimeter of that shape by using a modified gift wrapping algorithm.) I think it should be possible to make that work. $\endgroup$ Commented May 28, 2018 at 21:46

1 Answer 1

-1
$\begingroup$

Polylines are usually Coordinates x-Axis,Yaxis saved as a Point 0,0 100,0 100,100 0,100 makes a rectangle

If you convert your polylines to Points and then ... some logic.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.