0
votes

How to find number of points of intersection between a horizontal line segment(many) and a polygon(convex) with n sides in fastest way possible.Thanks for answering.

1

1 Answers

0
votes

In the simplest case - just check for intersection with all sides that has y-coordinates of ends at different sides of horizontal line.

If you want to use the same polygon with some horizontal segments - build sorted list of edges (or even interval tree) to find candidates fast (in log(n) time with binary search)