我目前使用C++ GEOS API迭代vector
typedef Points
(x和y成员变量)。GEOS C++ geos :: Geometry Buffer(0)假凸断上的凸洞
我通过创建一个geos::geom::Geometry
对象,将此向量变成凸凹对象,在0处缓冲以防止自相交,然后创建一个凸的Hull。
每当我发送一个已经是凸凹的对象时,我得到以下断言:Assertion 'precisionModel' failed
。
这是一个GEOS错误?我是否需要小心,不要在凸多边形上缓冲?
geo_algos_test2:/tmp/libgeos/src/operation/buffer/BufferBuilder.cpp:373:geos :: geom :: Geometry :: geos :: operation :: buffer :: BufferBuilder :: buffer(const geos :: GEOM ::几何*,双面):断言`precisionModel”失败*
这里是我的代码:
// Remove self intersections or collinear points
geos::geom::GeometryFactory factory;
geos::geom::CoordinateSequence* temp =
factory.getCoordinateSequenceFactory()->create((std::size_t)0, 0);
// Convert vector of cruise points to GEOS
for (auto point : poly) {
temp->add(geos::geom::Coordinate(point.x, point.y));
}
// Add beggining point to create linear ring
temp->add(geos::geom::Coordinate(poly.begin()->x, poly.begin()->y));
// Create Linear Ring For Constructor
geos::geom::LinearRing* box = factory.createLinearRing(temp);
// Factory returns a pointer, dereference this
geos::geom::Geometry* GEOSPoly = factory.createPolygon(box, NULL);
// Remove Self Intersections and create Hull
return GEOSPoly->buffer(0); //line that causes assertion
断言不是分段错误。断言是在代码中检查以确定在继续之前是否满足某些条件,并且检查失败。 – PaulMcKenzie
对不起,我的意思是断言。它在内部库中检查失败 – DaynaJuliana