Note that there are some explanatory texts on larger screens.

plurals
  1. POBoost::Geometry intersection not working as expected
    primarykey
    data
    text
    <p>I have a little test application to intersect a few rectangles with boost::geometry.</p> <pre><code>typedef boost::geometry::model::point &lt; double, 2, boost::geometry::cs::cartesian &gt; point; typedef boost::geometry::model::polygon&lt;point &gt; polygon; polygon Intersect(polygon p1, polygon p2) { std::vector &lt; polygon &gt; result; boost::geometry::intersection(p1, p2, result); return result.front(); } polygon IntersectionTest() { polygon one, two, three, four; boost::geometry::read_wkt("POLYGON((35 25, 35 35, 15 35, 15 25, 35 25))", one); boost::geometry::read_wkt("POLYGON((45 30, 45 50, 25 50, 25 30, 45 30))", two); boost::geometry::read_wkt("POLYGON((50 0, 50 40, 10 40, 10 0, 50 0))", three); boost::geometry::read_wkt("POLYGON((40 20, 40 60, 0 60, 0 20, 40 20))", four); return Intersect(Intersect(Intersect(one, two), three), four); } </code></pre> <p>I must do something wrong, because I expect the result to be something like <code>(35 30, 35 40, 25 40, 25 30, 35 30)</code> yet I get 10 points long polygons containing points like <code>50 0</code> while intersections of parallel rectangles should always be rectangles with 4+1 points and <code>50 0</code> is at the edge so it shouldn't be in the intersection at all. If I put it into an <a href="http://pastebin.com/fP4JYhAj" rel="nofollow">SVG</a>, the rectangles seems to be as I expect them.</p> <p>What can be wrong? If it is a bug in <code>boost::geometry</code> how can I make sure it is? (I'm currently using 1.48.) If it is a bug is there a way to circumvent the problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload