分割故障与升压::多边形 [英] segmentation-fault with boost::polygon

查看:230
本文介绍了分割故障与升压::多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多边形的数据,我处理。现在,我想看看我处理过的数据如何适合我的原始数据。对于这个任务,我想使用Boost的多边形设置运营商。
下面code给我一个段错误虽:

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:

#include <iostream>
#include <boost/polygon/polygon.hpp>

using namespace boost::polygon::operators;
using namespace std;

typedef boost::polygon::polygon_data<double> BPolygon;
typedef boost::polygon::polygon_traits<BPolygon>::point_type BPoint;
typedef boost::polygon::polygon_set_data<double> BPolygonSet;
typedef std::vector<BPolygon> BPolygonVec;


double meassureError(BPolygonVec &polys1, BPolygonVec &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 << meassureError(polys1, polys2) << endl;
  return 0;
}

GDB-输出:

gdb-output:

Program received signal SIGSEGV, Segmentation fault.
0x08156ce7 in std::list<boost::polygon::point_data<double>, std::allocator<boost::polygon::point_data<double> > >::begin (this=0x0) at /usr/include/c++/4.8.2/bits/stl_list.h:759
759           { return iterator(this->_M_impl._M_node._M_next); }

我的数据包括约2000个多边形,大约有10个顶点每我希望有足够的内存,以处理这一点。我究竟做错了什么?感谢您的帮助!

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!

推荐答案

从文档:<一href=\"http://www.boost.org/doc/libs/1_55_0/libs/polygon/doc/index.htm\">http://www.boost.org/doc/libs/1_55_0/libs/polygon/doc/index.htm

坐标数据类型是所有数据类型的模板参数和
  算法库提供,并且有望成为一体。
  浮点坐标数据类型不被支持的
  在库中实现的算法由于这样的事实,该
  实现浮点鲁棒性暗示一组不同的
  算法和有关浮动一般平台特定假设
  再点presentations。

The coordinate data type is a template parameter of all data types and algorithms provided by the library, and is expected to be integral. Floating point coordinate data types are not supported by the algorithms implemented in the library due to the fact that the achieving floating point robustness implies a different set of algorithms and generally platform specific assumptions about floating point representations.

这篇关于分割故障与升压::多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆