2016-06-13 6 views
0

現在、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 
+0

アサーションはセグメンテーション違反ではありません。アサーションは、コードに配置されたチェックで、処理する前に何らかの条件が満たされているかどうかを調べ、チェックに失敗したことを示します。 – PaulMcKenzie

+0

申し訳ありませんが、私はアサーションを意味しました。内部ライブラリのチェックが失敗する – DaynaJuliana

答えて

0

アサーションがあなたのfactoryおよび/またはbox形状は任意のインスタンスを持っていないことを示していますPrecisionModelが添付されています。現在GEOS C++ APIで

は、デフォルトのconstractorはアクセスできません、あなたは工場をこのように作成します。

auto factory = geos::geom::GeometryFactory::create() 

さて、factoryはデフォルトの浮動小数点の精度のモデルを使用し、factory->getPrecisionModel()nullptr非でなければなりません。

geos::geom::GeometryFactory::create*機能ファミリで作成した任意のジオメトリインスタンスは、すなわち、box->getPrecisionModel()リターンがPrecisionModelクラスの同じインスタンスへのポインタ、工場の精密なモデルを受け取ります。

関連する問題