Note that there are some explanatory texts on larger screens.

plurals
  1. POsegmentation-fault with boost::polygon
    text
    copied!<p>I have got polygon-data which I processed. Now I want to see how well my processed data fits my original data. For this task I want to use BOOST's polygon set-operators. The following code gives me a segfault though:</p> <pre><code>#include &lt;iostream&gt; #include &lt;boost/polygon/polygon.hpp&gt; using namespace boost::polygon::operators; using namespace std; typedef boost::polygon::polygon_data&lt;double&gt; BPolygon; typedef boost::polygon::polygon_traits&lt;BPolygon&gt;::point_type BPoint; typedef boost::polygon::polygon_set_data&lt;double&gt; BPolygonSet; typedef std::vector&lt;BPolygon&gt; BPolygonVec; double meassureError(BPolygonVec &amp;polys1, BPolygonVec &amp;polys2) { BPolygonSet set1; BPolygonSet set2; assign(set1, polys1); assign(set2, polys2); return area(set1 ^ set2); } int main(int argc, char *argv[]) { BPolygonVec polys1; BPolygonVec polys2; loadPolysFromFile(polys1); loadPolysFromFile(polys2); cout &lt;&lt; meassureError(polys1, polys2) &lt;&lt; endl; return 0; } </code></pre> <p>gdb-output:</p> <pre><code>Program received signal SIGSEGV, Segmentation fault. 0x08156ce7 in std::list&lt;boost::polygon::point_data&lt;double&gt;, std::allocator&lt;boost::polygon::point_data&lt;double&gt; &gt; &gt;::begin (this=0x0) at /usr/include/c++/4.8.2/bits/stl_list.h:759 759 { return iterator(this-&gt;_M_impl._M_node._M_next); } </code></pre> <p>My data consists of about 2000 polygons with roughly 10 vertices each and I would expect to have enough memory in order to process that. What am I doing wrong? Thanks for your help!</p>
 

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