Line segments and polygons are used to model geometric objects in computer graphics, video games, and computer-aided

Question:

Line segments and polygons are used to model geometric objects in computer graphics, video games, and computer-aided design, often in data pipelines that use the output of one program as the input to another. One complication that can arise in such scenarios is that a data format needed for the input to the second system may be missing from the output from the first. For instance, one program may output an object as an unordered set of line segments but the other may require its input to be defined by a polygon. So, suppose you are given a set, S, of n line segments, in no particular order. Describe an efficient algorithm for determining whether the segments of S form a polygon, P, and if so, give a polygonal representation for P. You may allow P to be non-simple (that is, selfintersecting), but P must be a single cyclical chain of distinct vertices connected by the segments in S. What is the running time of your algorithm?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Algorithm Design And Applications

ISBN: 9781118335918

1st Edition

Authors: Michael T. Goodrich, Roberto Tamassia

Question Posted: