Intersection of a (possibly unlimited) convex polygon with a half-plane

This is the next question to How to check if a line intersects a convex polygon?

Let's say that I can check if a line intersects a convex polygon or not (I'm still not sure which is the best method and this question is related to my complexity). What I want to do is this: if I find that the line is crossing the polygon, I want to keep either the left or the right polygon that is being created. I'm not sure how to maintain the polygon object so that the above is easy to compute.

enter image description here

To summarize, given a polygon object and a line, how do I find the new polygon that is created by intersecting the half-plane created in-line with the polygon? Does CGAL or any other library have a ready-to-use function for this? If I need to encode this from scratch, how do I store the polygon object?

+3


source to share


1 answer


I think one solution using CGAL might be to use 2D boolean operations on Nef Polygons . But for convex polygons, this may be overkill. What worries me is that you mention that you can use unlimited convex polygons. Without Nef polygons, I don't know if this can be represented in CGAL. In the meantime, there is no need to know about it. ”



0


source







All Articles