Convex Hull in The rolem: Given set P of oints in, omute their onvex hull onvex hulls Comuttionl Geometry [si 3250] Lur Tom Bowoin College onvex olyheron 1 2 3 olygon olyheron onvex olyheron 4 5 6
Polyheron region of se whose ounry onsists of verties, eges n fes fes interset roerly neighorhoo of ny oint on P is homeomorhi to isk surfe of P is onnete Convexity P is onvex if for ny, q in P, the segment q lies entirely in P. onvex olyheron : olyto onvex non-onvex 7 8 9 Pltoni solis Euler s formul Euler s formul Regulr olygon equl sies n ngles Regulr olyto fes re ongruent regulr olygons n the numer of fes inient to eh vertex is the sme (n equl ngles) Surrisingly, there exist only 5 regulr olytos Euler notie remrkle regulrity in the numer of verties, eges n fes of olyheron (w/o holes). Euler s formul: V - E + F = 2 One roof ie: fltten the olygon to lne rove the formul for tree rove for ny lnr grh y inution on E Consier olyheron P with V=n verties Tringulte its fes. This mximizes E n F. V-E+F=2 3F=2E.... E = 3V - 6 = O(n) F = 2V - 4 = O(n) The numer of verties, eges n fes in olyheron re linerly relte. 10 11 12
Some roerties From to Nive lgorithm in All fes of CH re extreme (n ll extreme eges of P re on the CH) Algorithm All internl ngles etween fes re < 180 For every trilet of oints (i,j,k):.. hek if lne efine y it is extreme Nive O(n 3 ) if it is, it to the list of CH fes Gift wring O(nh) Anlysis: O(n 4 ) Grhm sn O(n lg n) Quikhull O(n lg n), O(n 2 )? Inrementl O(n lg n) Divie-nonquer O(n lg n) 13 14 15 Gift wring in Gift wring in Gift wring in Algorithm fin fe gurntee to e on the CH REPEAT fin n ege e of fe f tht s on the CH, n suh tht the fe on the other sie of e hs not een foun. for ll remining oints i, fin the ngle of (e,i) with f fin oint i with the miniml ngle; fe (e,i) to CH Algorithm fin fe gurntee to e on the CH REPEAT fin n ege e of fe f tht s on the CH, n suh tht the fe on the other sie of e hs not een foun. for ll remining oints i, fin the ngle of (e,i) with f fin oint i with the miniml ngle; fe (e,i) to CH YouTue Vieo of CH in (y Lus Benevies) Fst onvex hull lgorithms with CGAL Anlysis: O(n x F), where F is the numer of fes on CH Imlementtion etils sketh more etile seuooe fining first fe? wht t strutures o you nee? how to kee trk of verties, eges, fes? how to store the onnetivity of fes? 16 17 18
From to From to 3 hull: ivie & onquer The sme ie s lgorithm ivie oints in two hlves P1 n P2 reursively fin CH(P1) n CH(P2) Nive O(n 3 ) O(n 4 ) Nive O(n 3 ) O(n 4 ) merge Gift wring O(nh) O(n x F) Gift wring O(nh) O(n x F) If merge in O(n) time ==> O( n lg n) lgorithm Grhm sn O(n lg n) no!! Grhm sn O(n lg n) no!! Quikhull O(n lg n), O(n 2 ) Inrementl O(n lg n) O(n lg n)? Quikhull O(n lg n), O(n 2 ) yes Inrementl O(n lg n) O(n 2 ) Divie-nonquer Divie-nonquer O(n lg n) O(n lg n) 19 20 21 How oes the merge hull look like? Ie: Strt with the lower tngent, wr roun, fin one fe t time. Let PI e lne tht suorts the hull from elow yliner without en s Clim: When we rotte PI roun, the first vertex hit must e vertex jent to or hs the smllest ngle mong ll neighors of, 22 23 24
1. Fin ommon tngent 1. Fin ommon tngent Now we nee to fin tringle. Thus is n ege either on the left hull 1. Fin ommon tngent Now we nee to fin tringle. Thus is n ege either on the left hull Now we hve new ege tht s tngent. Reet. 25 26 27 1. Fin ommon tngent Now we nee to fin tringle. Thus is n ege either on the left hull Now we hve new ege tht s tngent. Reet. 1. Fin ommon tngent Now we nee to fin tringle. Thus is n ege either on the left hull Now we hve new ege tht s tngent. Reet. 1. Fin ommon tngent Now we nee to fin tringle. Thus is n ege either on the left hull Now we hve new ege tht s tngent. Reet. e e 28 29 30
The hien fes 3 hull: ivie & onquer 1. Fin ommon tngent 2. Strt from n wr roun, to rete the yliner of tringles tht onnets the two hulls A n B 3. Fin n elete the hien fes tht re insie the yliner Theoretilly imortnt n elegnt Of ll lgorithms tht exten to, DC& is the only one tht hieves otiml ( n lg n) Diffiult to imlement The slower lgorithms (quikhull, inrementl) referre in rtie strt from the eges on the ounry of the yliner BFS or DFS fes towrs the yliner ll fes rehe re insie 31 32 33 Inrementl Point in front/ehin fe CH = {1,2,3} for i= 4 to n Inrementl hull //CH reresents the CH of 1..i-1 i to CH n ute CH to reresent the CH of 1..i s is left of (ehin) is right of (in front) not visile from visile from 34 35 36
.x.y 1 6 signeare(,,) = et.x.y 1.x.y 1 6 signevolume(,,,) = et.x.y.z 1.x.y.z 1.x.y.z 1.x.y.z 1 Assume ll fes oriente ounterlokwise (their normls etermine y the right-hn rule oint towrs the outsie of P) ositive re ( left/ehin ) ositive volume ( ehin fe) negtive volume ( in front of fe) negtive re ( right/in front of ) ositive volume ( ehin fe) negtive volume ( in front of fe) is_visile(,,,): return signevolume(,,,) < 0 37 38 39 Inrementl Inrementl The visile fes re reisely those tht nee to e isre The eges on the ounry of the visile region re the sis of the one Algorithm: inrementl hull 3 initilize H = 1, 2, 3, 4 for i = 5 to n o: for eh fe f of H o: omute volume of tetrheron forme y (f,i) if volume < 0: f is visile if no fes re visile isr i (i must e insie H) else fin orer ege of ll visile fes for eh orer ege e onstrut fe (e,i) n to H for eh visile fe f: elete f from H 40 41