現在、C++ GEOS APIを使用してvector
(typedef Points
)のxおよびyメンバ変数を反復処理しています。GEOS C++ geos :: Geometry Buffer(0)falseアサーションon convexHull
geos::geom::Geometry
オブジェクトを作成し、自己交差を防ぐために0でバッファリングし、次に凸包を作成することによって、このベクトルをconvexHullに変換します。
私はすでにconvexHullであるオブジェクトを送信するたびに、私は次のアサーションを得ます:Assertion 'precisionModel' failed
。
GEOSのバグですか?凸多角形にバッファリングしないように注意する必要がありますか?
geo_algos_test2:/tmp/libgeos/src/operation/buffer/BufferBuilder.cpp:373:GEOS :: GEOM ::ジオメトリ* GEOS ::操作::バッファ:: BufferBuilder ::バッファー(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