2014-09-27 2 views
3

내 문제는 아마도 CGAL C++ 라이브러리의 새로운 가능성 때문일 수 있습니다.하지만 내가 가지고있는 작업은 계속 미끄러 져 있습니다. 즉, 점 집합의 알파 모양을 찾고 싶지만 2D 알파 모양에서 사용할 수있는 반복자를 이해할 수없는 것 같습니다. CGAL 2D 알파 모양 개요

내가 뭘하려 :

Alpha_shape_2 alpha(pointsVec.begin(), pointsVec.end(), FT(1000), Alpha_shape_2::GENERAL); 
//which compiles nicely and provides the regular output where pointsVec is the list of Point_2 

//Then I saw the edge iterator at the CGAL documentation 

template <class OutputIterator> //Method-iterator for CGAL alpha shapes in order to get the edges from alpha shape object 
void alpha_edges(const Alpha_shape_2& A, 
        OutputIterator out) 
{ 
    for(Alpha_shape_edges_iterator it = A.alpha_shape_edges_begin(); 
     it != A.alpha_shape_edges_end(); 
     ++it){ 
     *out++ = A.segment(*it); 
    } 
} 

//Then when using the following code: 

std::vector<Segment> segments; 
alpha_edges(alpha, std::back_inserter(segments)); 

//I get the list of all the edges in the triangulation used for alpha shapes. 

것은 내가 다음과 같은 음모 (R의 alphahull 라이브러리로 얻은) 같은 경계

Alphahull

대신 내가 얻을 필요하다는 것입니다 세그먼트 벡터에서 삼각 분할 에지. 내가 시도 또 한가지는 정점 반복자 사용하는 것입니다

for (Alpha_shape_2::Alpha_shape_vertices_iterator it = alpha.Alpha_shape_vertices_begin(); it != alpha.Alpha_shape_vertices_end(); ++it) 
     { 
      int xalpha = (*it)->point().x(); 
      int yalpha = (*it)->point().y(); 
      alphaCoords.push_back(cv::Point(xalpha, yalpha)); //this for openCV 
     } 

을하지만 결과는 동일합니다. 모든 정점을 출력하므로 도면에서 외곽선 (도면에 선을 그 으십시오)없이 도면 만 연결합니다.

나는 3D에 대한 경계 모양의 정점을 찾기위한 기능이 있다는 것을 알고

as.get_alpha_shape_vertices(back_inserter(al_vs), Alpha_shape_3::REGULAR); 

는하지만 2D 존재하지 않습니다. 또한 저는 CGAL 2D 모양 매뉴얼에서 제공되는 윈도우 데모와 같이 성형 원의 반경에 사용 된 알파 값을 어디에서 지정할 수 있는지 알아보고자합니다.

+0

순서대로 경계 정점을 얻는 방법을 알아 냈습니까? – Flowers

답변

3

Alpha_shape_edges_iterator는 EXTERIOR가 아닌 모서리를 제공합니다. 규칙적인 가장자리와 단색 가장자리에 관심이있는 것 같습니다.

가장자리를 걸러 내기 위해 Classification_typeclassify 기능을 살펴보십시오.

+0

지연되어 죄송합니다. 대답은 훌륭합니다. REGULAR 타입으로 필요한 엣지를 반환합니다. –

관련 문제