Reputation: 59
I am trying to get intersection of a polygon and a line segment. I can see that I can easily solve this problem with boost geometry. Though , I need one more information while computing the intersection , I need to know which of the polygon side intersected the line segment. Can anyone suggest me an easy way to get this information?...
Many thanks
Avanindra
Upvotes: 1
Views: 2040
Reputation: 4103
Easily? Well, maybe not easily.
Have you looked into binary space partitioning (BSP) trees? http://en.wikipedia.org/wiki/Binary_space_partitioning
As a rule, if you want theory and code for computational geometry problems, consider looking first at the Geometric Tools website, or the book co-author by the website creator:
http://www.geometrictools.com/SampleMathematics/Boolean2D/Boolean2DBody.html
There are other good textbooks on computational geometry, but Schneider & Eberly is my go-to book.
Upvotes: 1
Reputation: 6849
Break your polygon into line segments, and intersect each one individually.
Upvotes: 1