2014-10-14 2 views
1

내가 지금처럼 CGAL를 사용하여 보로 노이 다이어그램을 구성하고 있습니다 : 얼굴에게 원본을 검색 할 수있는 방법이 있다면 지금CGAL 보로 노이 다이어그램 : 얼굴에 링크 입력 사이트

//consider some points 
std::vector<Point_2> points = read_input(); 

//throw points (i.e. Sites) into Voronoi diagram 
VD vd; 
for (std::vector<Point_2>::iterator it = points.begin(); it != points.end(); ++it) { 
    vd.insert(*it); 
} 

, 내가 알고 싶습니다 보로 노이 다이어그램의 기본 반 에지 데이터 구조에 대한 명백한 링크가없는 상기 반복기의 서명과

for (VD::Site_iterator it = vd.sites_begin(); it != vd.sites_end(); ++it) { 
    it->?! 
} 

: 사이트에 속한다. 그러나 locate 메서드에 대해서는 알고 있지만, O (log (n)) 시간에 실행을 찾습니다. 모든 사이트를 쿼리하기 때문에 결과 런타임은 O (n * log (n)) 일 것이므로 다소 낭비가 될 것입니다. 내가 빠진 것이 있습니까?

+3

답변이 없지만 'vd.insert (points.begin(), points.end())'는 1을 1 씩 삽입하는 것보다 효율적입니다. –

답변

2

얼굴을 반복하고 dual 메서드를 호출하면 반대로 할 수 있습니다.

for (VD::Face_iterator fit=vd.faces_begin(), 
         fit_end=vd.faces_end(); 
         fit!=fit_end;++fit) 
{ 
    fit->dual()->point(); 
}