That is also a way of looking at it. Just take the points that are on the ends of open edges, as both these points are (partially) open as well. Then, have the editor draw edges between all these points as you did above (basically connecting all the points that can "see" eachother without having to cross over defined sectors / edges that are associated with at least one defined sector).
You can then start deleting these editor generated edges for which the following applies:
- Looking at one of the two points on the ends of the edge you're evaluating, take the edge to the left of it, connecting to that same point;
- Take the one on the right as well and determine the angle between the edge on the left and the right;
- Do the same for the point at the other side of the edge you're evaluating;
If both resulting angles are less than 180 degrees, you can delete the edge you're evaluating. That should minimize the number of sectors the editor would need to create. You would need to evaluate all the edges your editor has drawn this way, to see if they can safely be deleted. Once you've deleted the superfluous ones, you are left with the minimum you need to automatically generate all the remaining missing sectors.
Take a look at this example to more clearly see what I mean:
If you consider the purple edge, you can delete it, because it meets all criteria above:
- For the point in the lower left, the yellow edges on either side of it still have a convex angle;
- For the point in the upper right of that egde, the dark red edges on either side still have a convex angle;
The same applies to the blue dotted edge intersected by the purple one, by the way.
The yellow edge to the right of the purple one can't be deleted, however. Even if the remaining angle at the point in the bottom left is still convex, the remaining angle for the corner to which the yellow edge connects on the pink box would be larger than 180 degrees.
Edited by Maurice1976, 24 October 2017 - 09:46 PM.