2016-06-13 14 views
0

현재 C++ GEOS API를 사용하여 vector (typedef Points)의 x 및 y 멤버 변수를 반복합니다.GEOS C++ geos :: Geometry 버퍼 (0) 거짓 어설 션 on convexHull

geos::geom::Geometry 개체를 만들고 자기 교차로를 방지하기 위해 0으로 버퍼링 한 다음 볼록 헐을 작성하여이 벡터를 convexHull로 바꿉니다.

이미 convexHull 인 객체를 보낼 때마다 Assertion 'precisionModel' failed이라는 어설 션을 얻습니다.

GEOS 버그입니까? 볼록 다각형을 버퍼링하지 않도록주의해야합니까?

geo_algos_test2 : /tmp/libgeos/src/operation/buffer/BufferBuilder.cpp:373 : 지오스 :: 기하 형상 :: * 지오스 :: 동작 :: :: BufferBuilder 완충액 : 완충액 (CONST 지오스 :: 기하 구조 : 형상 *), 이중 : 어설`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* 기능을 가족과 함께 만든 모든 지오메트리 인스턴스는 공장의 정밀 모델, PrecisionModel 클래스의 같은 인스턴스 즉, box->getPrecisionModel() 반환 포인터를 받는다.