1
votes

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

2

2 Answers

1
votes

Break your polygon into line segments, and intersect each one individually.

1
votes

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.