Medial Axis

download Medial Axis

of 10

Transcript of Medial Axis

  • 8/3/2019 Medial Axis

    1/10

    Finding t he Media l Ax i s o f a S imple Po lygonin L inear T ime

    F r a n c i s C h in * J a c k S n o e y i n k t C a o A n W a n g t

    A b s t r a c tW e g ive a l i n e a r - t im e a lg o r i t h m f o r c o m p u t in g t h e m e d ia l a x i s o f a s im -p l e p o ly g o n P , T h i s a n s w e r s a l o n g - s t a n d in g o p e n q u e s t i o n - - p r e v io u s ly ,t h e b e s t d e t e r m in i s t i c a l g o r i t h m r a n i n O ( n l o g n ) t im e . W e d e c o m p o s e Pin to p s e u d o - n o r m M h i s to g r a m s , t h e n i n f l u e n c e h i s t o g r a m s a n d x y m o n o -to n e h i s t o g ra m s . W e c a n c o m p u te t h e m e d ia l a x e s f o r x y m o n o t o n e h i s -t o g r a m s a n d m e r g e t o o b t a in t h e m e d ia l ax i s f o r P .

    1 I n t r o d u c t i o nT h e media l ax is o f a s i m p l e p la n e p o l y g o n P g o e s b y m a n y n a m e s , i n c l u d i n gs y m m e t r i c a x i s o r skeleton. O n e o f t h e m o r e p i c t u r e s q u e is th e grassf ire trans-f o r m : I m a g i n e i g n it i n g a ll b o u n d a r y p o i n t s o f P . I f t h e f l a m e b u r n s i n w a r d a ta u n i f o r m r a t e , t h e n t h e q u en ch p o in t s w h e r e t h e f l a m e m e e t s a n d e x t i n g u i sh e si t s e l f d e f in e t h e m e d i a l a x i s . E q u i v a l e n t l y , t h e m e d i a l a x i s is t h e l o c u s o f a l lc e n t e r s o f c i rc l e s i n s id e P t h a t t o u c h t h e b o u n d a r y o f P i n tw o o r m o r e p o i n t s .

    T h e m e d i a l a x i s w a s p r o p o s e d a n d n a m e d b y B l u m [3] i n 1 9 67 a r t i c l e e n t it l e d ," A tr a n s f o r m a t i o n f o r e x t r a c t i n g n e w d e s c r ip t o r s o f s h a p e . " T h e p a t t e r n r e c o g-n i t i o n l i t e r a t u r e u s e s i t h e a v i l y a s a o n e - d i m e n s i o n a l s t r u c t u r e t h a t r e p r e s e n t st w o - d i m e n s i o n a l s h a p e [ 7 , 1 4 , 1 6 ] ; i t h a s a l s o b e e n u s e d i n s o l i d m o d e l l i n g [ 1 8 ] ,m e s h g e n e r a t i o n [ 8] , p o c k e t m a c h i n i n g [ 9] , e t c .

    T o a c o m p u t a t i o n a l g e o m e t e r , t h e m e d i a l a xi s of a n n - g o n P is a V o r o n oid i a g r a m [2, 15] w h o s e s i t e s a r e t h e o p e n e d g e s a n d t h e v e r t i c e s o f t h e b o u n d -a r y . I n 1 9 82 , L e e [ 1 3 ] d e v e l o p e d a n O ( n l og n ) a l g o r i t h m t o c o m p u t e t h e m e d i a la x i s . S i n c e t h a t t i m e , i t h a s b e e n a n o p e n q u e s t i o n t o d e t e r m i n e t h e t i m e r e -q u i r e d t o c o m p u t e t h e m e d i a l a x is . U p t o t h is y e a r t h e r e w e r e tw o s i g n if ic a n tm i l e s t o n e s : I n 1 9 8 7 A g g a r w a l e t a l. [1] f ir s t p u b l i s h e d a n a l g o r i t h m t h a t c a nc o m p u t e t h e m e d i a l a x is o f a co n vex p o l y g o n P i n l i n e a r t i m e . I n 19 91 D e v -i l l e r s [5 ] f i r s t pub l i shed a ra n d o mized a l g o r i t h m f o r t h e m e d i a l a x is t h a t r u n s i nO ( n lo g* n ) e x p e c t e d t i m e .

    *Dept of Comp. Science, University of Hong Kong, Hong Kong. chinOcsd.hku.hktDe pt of Comp. Science, UBC, Vancouver, BC, C anada V 6T 1Z4. snoey169Par t ia l ly suppor ted by an NSERC grant and a BC ASI Fellowship .SDept of Comp. Science, Mem orial University of Newfoundland, St. John 's, NFLD , Ca nad aA IC 5S7 wangCgarf cs .mun. ca Work partially suppo rted by NSERC grant OPG0041629.

  • 8/3/2019 Medial Axis

    2/10

    3 8 3

    D e c o m p o s i t i o n s o f P i n to h i s t o g r a m s h a v eb e e n a p p l i e d t o t h e constra ined Voronoi d ia -g r a m o f v e r t i c e s o f P . D j i j e v a n d L i n g a s ' [6]s h o w e d t h a t t h e a l g o r i t h m o f A g g a r w a l e t a l. [1]c o u l d f i n d t h e c o n s t r a i n e d V o r o n o i f o r a n x ym o n o t o n e h i s t o g r a m . K l e i n a n d L i n g a s [11 ]g a v e a r a n d o m i z e d a l g o r i t h m f o r t h e c o n s t r a i n e dV o r o n o i o f a h i s t o g r a m a n d , b y m e r g in g , c o m -p u t e d t h e c o n s t r a i n e d V o r o n o i o f P in O ( n )e x p e c t e d t i m e . W a n g a n d C h i n [1 9] g a v e a d e -t e r m i n is t ic a l g o r i th m b y f u r t h e r d e c o m p o s i n gh i s t o g r a m s .

    Fig. 1: Medial axis (solid) andVoronoi d iagram (so lid & do t ted)W e e x t e n d W a n g a n d C h i n 's d e c o m p o s i t i o n to c o m p u t e t h e m e d i a l ax is o fa s im p l e p o l y g o n P . O u r a l g o r i t h m d e c o m p o s e s P i n t o n o r m a l h i s t o g r a m s ,

    t h e n i n t o in f lu e n c e h i s t o g r a m s , a n d x y m o n o t o n e h is to g r a m s . I t c o m p u t e s th eV o r o n o i d i a g r a m s o f x y m o n o t o n e h i s t o g r a m s , a n d m e r g e s t o o b t a i n t h e m e d i a la x is o f P . A f t e r r e v i ew i n g d e f in i ti o n s a n d k n o w n r e s u lt s a b o u t V o r o n o i d i a g r a m sa n d h i s t o g r a m d e c o m p o s i t i o n s in S e c t i o n 2, w e d e s c r i b e t h e n e w s t e p s i n r e v e r s eo r d e r : I n S e c t i o n 3 , w e e x t e n d t h e a l g o r i t h m o f A g g a r w a l e t al.[1 ] t o c o m p u t e t h eV o r o n o i d i a g r a m o f s e le c t ed e d g e s a n d v e r ti c e s o f a n x y - m o n o t o n e h i st o g r a m .I n t h e p r o c e s s , w e s i m p l i fy p a r t o f t h e a n a l y s i s . I n S e c t i o n 4, w e c o m p u t e t h eV o r o n o i d i a g r a m o f a h i s t o g r a m b y d e c o m p o s i n g i t i n t o in f lu e n c e h i s t o g r a m s a n dx y m o n o t o n e h i s t o g r a m s . W e c o n c l u d e in S e c t io n 5.

    K l e i n a n d L i n g a s h a v e re c e n t l y e x t e n d e d t h e i r w o r k o n h i s t o g r a m d e c o m p o s i -t i o n s t o o b t a i n t h e m e d i a l a xi s o f P i n expected l i n e a r t i m e [1 2]. T h e i r a l g o r i t h ma d d s e d g e s t o c lo s e o f a ll h i s t o g r a m p o l y g o n s a n d a p p l i e s r a n d o m i z a t i o n t w i c e :o n c e t o c o m p u t e t h e m e d i a l a x i s o f a ll e d g e s o f a h i s t o g r a m p o l y g o n , a n d a g a i nw h e n n o n - P e d g e s a r e r e m o v e d a n d t h e m e d i a l a x e s a r e m e r g e d . T h e f ir st iss t r o n g l y p r e d i c a t e d o n t h e f a c t t h a t a ll e d g e s a f fe c t t h e m e d i a l a x i s, s o i t is u n -c l e a r h o w t o d i r e c t l y m a k e i t d e t e r m i n i s t i c . A d d i t i o n a n d d e l e t i o n o f e d g e s a ls oa d d s t o t h e p r o g r a m m i n g c o m p l e x i t y .2 P r e l i m i n a r i e sL e t P b e a s i m p l e p o l y g o n w i t h n v e r t i c e s, { P l , p 2 , . . . , P , ~ } . T h e b o u n d a r y O Pc o n s i s t s o f t h e s e v e r t i c e s a n d t h e e d g e s ( o p e n l in e s e g m e n t s ) b e t w e e n c o n s e c u t i v ev e r t ic e s . W e a s s u m e t h a t t h e v e r t i c e s a n d e d g e s o f P a r e in g e n e r a l p o s i t i o n ,w h i c h c a n b e s i m u l a t e d b y ( a c t u a l o r c o n c e p t u a l ) p e r t u r b a t i o n o f t h e i n p u t .2 .1 T h e M e d i a l A x i s a n d V o r o n o i D i a g r a m o f PT h e Voronoi d iagram [2, 15] of a set of s i tes is t h e p a r t i t i o n o f t h e p l a n e i n t oc o n n e c t e d r e g i o n s h a v i n g t h e s a m e s e t o f c l o se s t s it es . T h i s p a r t i t i o n c o n s i s tso f Voronoi cells, edges, a n d vert ices, a s i n F i g u r e 1 . T h e media l ax is of P i st h e l o c u s o f a ll c e n t e r s o f c i rc l es c o n t a i n e d i n P t h a t t o u c h O P i n t w o o r m o r ep o i n t s . T h u s , t h e m e d i a l a x is c o n s i s ts o f V o r o n o i v e r t i c e s a n d V o r o n o i e d g e s.T h e o n l y V o r o n o i e d g e s t h a t a r e n o t p a r t o f t h e m e d i a l ax i s a r e th e b i s e c to r s o f

  • 8/3/2019 Medial Axis

    3/10

    384

    a n e d g e a n d a n i n c i d e n t v e r t e x . W e w il l, t h e r e f o r e , c o n c e n t r a t e o n c o m p u t i n g t h eV o r o n o i d i a g r a m V(P) i n t h i s a b s t r a c t , a n d o b t a i n t h e m e d i a l a x i s b y r e m o v i n gt h e s e V o r o n o i e d g e s.

    T h e constrained Voronoi diagram o f a s e t o f s it es o n t h e b o u n d a r y o f P is t h eV o r o n o i d i a g r a m i n w h i c h d i s t a n c e is m e a s u r e d a l o n g a s h o r t e s t p a t h i n s id e P .A l l o f o u r V o r o n o i d i a g r a m s s h o u l d b e c o n s i d e r e d c o n s t r a i n e d V o r o n o i d i a g r a m s ,e v e n t h o u g h w e ty p i c a l l y o m i t t h e w o r d " c o n s t r a in e d . " I n o u r a l g o r it h m s , t h er e f l e x v e r t i c e s a r e a lw a y s s i t es , s o t h e s h o r t e s t p a t h s a r e l i n e s e g m e n t s .

    A l g o r i t h m s t o m e r g e V o r o n o i d i a g r a m s h a v e b e en i m p o r t a n t s in c e S h a m o sa n d H o e y [ 1 7 ]. S e e a l s o K i r k p a t r i c k [ 10 ] o r K l e i n a n d L i n g a s [1 1].L e m m a 2 .1 Let Q be a polygon that is divided into Q1 and Q2 by a diagonal e.Let subsets of vertices and edges $1, $2, and S = S1 U $2 be the sites in Q1,Q2, and Q respectively. Given the Voronoi diagrams of $1 in Q1 and 5;2 inQ2, one can obtain the Voronoi diagram of S in Q in time proportional to thenumber of Voronoi edges that intersect e and the number of new edges added.2 . 2 H i s t o g r a m s

    n o m a a l h i s t o g r a m , ,(not all edges/vert ices / . pse u don orma , ] ] . xy m o n o t o n e

    Fig. 2: His tograms

    A normal histogram ( N H ) is a si m p l e p o l y g o n H w h o s e b o u n d a r y c o n s i st s o f abase edge e a n d a c h a i n t h a t is m o n o t o n e w i t h r e s p e c t t o e T y p i c a l ly , w e r o t a t en o r m a l h i s t o g r a m s s o t h a t t h e b a s e is a l o n g t h e x a x is a n d t h e r e s t o f t h e p o l y g o nis i n t h e p o s i t iv e q u a d r a n t , a s i n F i g u r e 2 . T h e base line i s t h e l i n e t h r o u g h e . Apseudo-normal histogram ( P N H ) , d e f i n e d b y K l e i n a n d L i n g a s [1 1], c a n b e v i e w e da s a n o r m a l h i s t o g r a m w i t h a m i s s in g c o r n e r . B e c a u s e o f t h e m e r g e le m m a , a nN H is as g o o d a s a P N H w i t h r e s p e c t to c o m p u t i n g a V o r o n o i d i a g r a m .C o r o l l a r y 2 . 2 The constrained Voronoi diagram of selected sites of an n-vertezP N H can be obtained from the diagram of the corresponding N H in O(n) time.A n N H i s a n zy-monotone histogram i f , a f t e r p u t t i n g t h e b a s e a l o n g t h e x a x i s ,t h e y c o o r d i n a t e s o f n o n - b a s e v e r t ic e s a r e m o n o t o n e i n c re a s in g o r m o n o t o n ed e c r e a s i n g .2 .3 D e c o m p o s i n g P i nt o P s e u d o - N o r m a l H i s to g r a m sK l e i n a n d L i n g a s ' a l g o r i t h m f o r t h e c o n s t r a i n e d V o r o n o i d i a g r a m [ 11 ] is b a s e do n d e c o m p o s i n g a p o l y g o n P i n to P N H s , c o m p u t i n g t h e i r V o r o n o i d i a g r a m s ( v ia

  • 8/3/2019 Medial Axis

    4/10

    385

    Fig . 3 : A decom pos i t ion of P in to a t ree of PN H 's

    t h e c o r r e s p o n d i n g N H s ) , a n d t h e n m e r g i n g . I n th e f u ll p a p e r , w e n o t e t h a t o n l yt w o c a ll s to a l i n e a r - t im e t r a p e z o i d a t i o n a l g o r i t h m a r e n e e d e d .

    F i g u r e 3 s h ow s a p o l y g o n P d e c o m p o s e d i n to t h i r t e e n P N H s . P N H 1 is a s so c i-a t e d w i t h t h e v e r t i c a l b a s e e m i s s i n g i t s u p p e r c o r n e r ; P N H 2 w i t h t h e h o r i z o n t a lb a s e e ' is m i s s in g i t s l e ft c o r n e r , e t c . T h e d e c o m p o s i t i o n c a n b e r e p r e s e n t e d a s at r e e w h o s e n o d e s a r e P N H s a n d w h o s e ed g e s re p r e s e n t a d j a c e n c y o f t w o P N H s .L e m m a 2 .3 An n-vertex simple polygon P can be decomposed into a set ofP N H s having a linear number of vertices.

    I t h a s b e e n p r o v e d t h a t t h e V o r o n o i d i a g r a m s o f t w o P N H ' s d o n o t i n t er -f e r e w i t h e a c h o t h e r a s l o n g a s th e s e t w o P N H ' s a r e ( i) a t t h e s a m e d e p t h n o tf a c in g e a c h o t h e r , o r ( ii) w i t h t h e i r c o r r e s p o n d i n g d e p t h s m o r e t h a n t w o a p a r t .A l t h o u g h t h e p r o o f g iv e n b y K l e i n a n d L i n g a s is o n l y fo r v e r t e x si te s, t h e p r o o fc a n b e e a s i l y e x t e n d e d t o i n c l u d e e d g e s i t e s .L e m m a 2 .4 ( K l e i n a n d L i n g a s [ 11 , T h m 4 .6 ] ) Given the Voronoi diagramsfor the P N H s in a decomposition of an n-vertex simple polygon P, the Voronoidiagram for P can be computed in linear time.

    T h e t a s k t h a t r e m a i n s is t o c o m p u t e t h e c o n s t r a i n e d V o r o n o i d i a g r a m o fs e l e c t e d v e r t e x a n d e d g e s it e s i n s id e a n o r m a l h i s t o g r a m .3 C o m p u t i n g t h e V o r o n o i o f a n x y M o n o t o n e H i s t o g r a m

    a n d t h e V o r o n o i E x t e n s i o nI n t h i s s e c t i o n , w e p r o v i d e e f fi ci e n t s u b r o u t i n e s f o r t w o V o r o n o i d i a g r a m p r o b -l e m s . S e e F i g u r e 4 .V o r o n o i o f xy m o n o t o n e h i s t o g r a m C o m p u t e t he c o n s t ra in e d V o ro n oi d ia -

    g r a m o f s e l e c t e d s it e s in a n xy m o n o t o n e h is to g r am H .V o r o n o i e x t e n s i o n G i v e n t h e in t e rs e c ti o n o f t h e V o ro n o i d i a g r a m o f t h e si te s

    i n a h i s t o g r a m H w i t h t h e b a s e e d g e e , c o m p u t e t h e V o r o n o i d i a g r a m int h e h a l f s p a c e b e l o w t h e b a s e l i n e .

  • 8/3/2019 Medial Axis

    5/10

    3 8 6

    I n b o t h p r o b l e m s t h e s it e sh a v e a n o r d e r g i v e n b y a c u r v ea n d t h e i n t e r s e c t i o n o f t h e V o r -o n o i w i t h t h e c u r v e i s k n o w n .I n t h is a b s t r a c t , w e f o c us o nt h e x y m o n o t o n e h i s t og r a m H ,w h e r e t h e c u r v e i s t h e m o n o -t o n e p o r t i o n o f t h e b o u n d a r yo f H . W e d i r e c t i n i t ia l a n d f i-n a l r a y s t o x = - o o a n d y =cxD as sh ow n in f igu re 4 .

    Voronoi diagram of jxy monotone ,-./~ . \

    ", ,

    V ~ 1 7 6 1 7 6 1 7 6

    . . . . . . . . . .

    ' ' ' " , . , "" ' " ' ' " i :tF ig . 4 : T h e d i a g r a m s a r e t r e e s w i th k n o w n l e a v e s

    M o n o t o n i c i t y i n b o t h x a n d y no t o n l y i m p l ie s t h a t t h e b o u n d a r y o f H d o e sn o t l e a v e t h e b o u n d i n g b o x o f t h e d i a g o n a l s t h a t j o i n c o n s e c u t i v e s i t e s i n xc o o r d i n a t e o r d e r , b u t a l so t h a t t h e V o r o n o i d i a g r a m i n si de t h e b o x is c o m p l e t e l yd e t e r m i n e d b y t h e e n d p o i n t s o f t h e d i a g o n a l s . I n f a c t, w e re p l a c e p o r t i o n s o f t h eb o u n d a r y t h a t a r e n o t si te s w i t h t h e s e d i a g o n a l s . T o a v o i d a d e g e n e r a t e c a s e , i fa n e d g e a n d i t s lo w e r e n d p o i n t a r e b o t h s i te s , w e c o n s i d e r t h e m a s a u n i t .

    I n t h e fu ll p a p e r , w e s k e tc h a r a n d o m i z e d i n c r e m e n t a l c o n s t r u c t i o n t h a t c a ns o lv e b o t h p r o b l e m s in e x p e c t e d l i n e a r t i m e . F o r d e t e r m i n i s ti c a l g o r i t h m s , w ea d a p t t h e w o r k o f A g g a r w a l e t al . [1].3 .1 D e t e r m i n i s t i c A l g o r i t h m sT h e b a s i c i d e a o f [1] i s t o i d e n t i f y a f r a c t i o n o f t h e V o r o n o i c e ll s t h a t a r e n o ta d j a c e n t t o e a c h o t h e r , r e m o v e th e i r c o r r e s p o n d i n g s it es , r e c u r si v e l y c o m p u t et h e V o r o n o i d i a g r a m o f t h e r e m a i n i n g s it es , a n d t h e n i n d e p e n d e n t l y m e r g e i nt h e n o n - a d j a c e n t c el ls . I d e n t i f y i n g n o n - a d j a c e n t c e ll s is c o m p l i c a t e d b y t h e f a c tt h a t o n e d o e s n o t h a v e t h e c e ll d e s c r i p t i o n s u n t i l t h e a l g o r i t h m i s d o n e .

    L e t 8 1 , 8 2 , . . . , 8k b e t h e l is t o fs i t e s i n o r d e r a l o n g t h e c u r v e . ( I n -c l u d e s i t e s a t i n f i n i t y a s s o a n dS k + l . ) W e m a r k s i te s r e d a n d b l u et o s a t i s f y t h r e e r u l e s :1 .) N o t w o a d j a c e n t s i te s a r e red.2 .) N o t h r e e a d j a c e n t s i te s a r e blue.3 .) I f t h e p o r t i o n o f t h e b o u n d -a r y b e l o w 5 s i t e s, ( s i - 2 , S ~ - l , s~ ,S ~ + l , s ~ + 2 ), h a s a c i r c l e b e l o w t h a tt o u c h e s s ~ _ : a n d s ~ + : a n d d o e s n o t F i g . 5 : P o s s i b l e m a r k i n g sc o n t a i n a n y p o i n t o f s i - 2 , s~ , o r si + 2 , t h e n s i t e s i m u s t b e red.

    F i g u r e 5 sh o w s t w o h i s t o g r a m s w i t h p o s s i b le m a r k i n g s . R e c a l l t h a t i f a n e d g ea n d i t s lo w e r e n d p o i n t a r e b o t h s it es , w e c o n s i d er t h e m a s a u n i t - - o t h e r w i s es y m b o l i c p e r t u r b a t i o n w o u l d b e n e e d e d s o t h a t t w o o p e n e d ge si te s w i t h t h es a m e ( n o n - s i te ) e n d p o i n t c o u l d n o t b e c o - c i r c u l a r w i t h t w o o t h e r s i te s . M a r k so n t h e c o n c a v e c h a i n a t l e f t a r e c o n s t r a i n e d o n l y b y r ul e s 1 a n d 2 , w h i l e t h e r e d sa t r i g h t a r e f o r c e d b y t h e e m p t y c i r c l e s .

  • 8/3/2019 Medial Axis

    6/10

    38 7

    Lemma 3 .1 A m a r k i n g o f s i te s c a n b e c o m p u t e d i n l i n e a r t i m e .P r o o f : The first and third rules do not conflict because the third cannot a pplyto two adjacent sites. Thus, we can mar k sites in linear time by initializing allsites to blue, t hen mark ing the sites that rule 3 says must be red. For eachsequence of i > 2 blues that remain, we mark every other other site red, st art ingwith the second and ending one or two before the last. ,,

    This coloring has the following independence property:Lemma 3 .2 Co ns e c u t i v e r e d s i t e s c an no t hav e V or on o i c el ls t ha t a r e ad j ac e n t .

    P r o o f : Consider two sites s and s ~ tha t have adjacent Voronoi cells. There isa circle in H t ha t touches s and s and excludes all oth er sites.

    If s and s' have a single site t between them,then by rule 3, t is marked red and by rule 1, boths and s' are blue. On the othe r hand, if two sitest and t ' lie between s and s ', then move the circlecenter along the bisector of s and s toward t andt', as in figure 6. The new circle exits the old onlybetween s and s ~. Therefore, by monotonic ity, thecircle encounters t or t ~ before encoun terin g anyother . Suppose it encounters t ~, then t is red byrule 3 and s must be blue. Therefore, either s ands ~ are n ot bot h red or the y are not consecutive. 9

    These two lemmas are sufficient to use the al-gori thm of AggarwM et al. [1], as we shall briefly

    L - ~ ' - S 'L - -

    Fig. 6: s or s ~ is bluedescribe. The y prove the following combin atori al lemma.Lem ma 3.3 (A gga rw al e t a l. [1]) L e t T be a b i nar y tr e e e m be dde d i n t hep l a n e . E a c h l e a f o f T h a s a n a s s o c ia t e d " n e i g h b o r h o o d ," w h i c h is a c o n n e c t e ds ub t r e e r oo t e d a t t ha t l e a f , and l e av e s ad j ac e n t i n t he t opo l og i c a l o r de r a r oundt he t re e hav e d i s j o i n t ne i ghbor hoods . T h e n t he r e a re a f i x e d f r ac t i on o f t he l e av esw i t h d i s j o in t , c o n s t a n t - s i z e n e i g h b o r h o o ds , a n d s u c h l e a v es c a n b e f o u n d i n l i n e a rt i m e ( a s s um i ng t ha t ne i ghbor hoods c an be t r ac ed ou t i n b r e ad t h - f i r s t o r de r ) .

    The rest follows Agga rwal et al. [1]; see their pape r for more detail.T h e o re m 3 .4 T h e V o r o n o i d i a g ra m o f a n x y m o n o t o n e h i st o g ra m c a n be c o m -p u t e d i n l i n e a r t i m e .

    P r o o f : By rule 2, a constan t fraction of the sites are marked blue. We comput etheir Voronoi diag ram recursively and let T be the tree of Voronoi edges thatstart between blues sites that are separated by reds. Now, the "neighborhood"of a leaf is the por tion of the Voronoi edge tha t is farther from the blue sitestha t define it than from the red site tha t is being inserted. Lem ma 3.2 says tha tadjacent neighborhoods are disjoint, so Lemma 3.3 says that a constant fractionof the red sites with disjoint, constant-size neighborh oods can be found. Thesered sites can be merged into the blue diagram in constant time apiece.

  • 8/3/2019 Medial Axis

    7/10

    388

    F i n a ll y , a c o n s t a n t f r a c t i o n o f t h e s i te s r e m a i n r e d ; w e a g a i n c o m p u t e t h e i rV o r o n o i d i a g r a m r e c u rs i v e ly a n d m e r g e i t i n to t h e b l u e V o r on o i d i a g r a m - - w ec a n d o t h is i n l in e a r t o t a l t i m e i f w e m e r g e c o n n e c t e d p o r t i o n s s t a r t i n g a n de n d i n g o n t h e h i s t o g r a m b o u n d a r y . , ,

    W e c a n d e t e r m i n i s t i c a l l y c o m p u t e t h e V o r o n o id i a g r a m e x t e n s i o n b y a s i m i l a r a l g o r i t h m .T h e o r e m 3 .5 G i v e n t h e i n t e r s e c t i o n V o r o n o i d i a-g r a m o f a h i s t o g r a m w i t h t h e b a se e d ge , t h e e x t e n -s i o n b e lo w th e b a se c a n b e c o m p u t e d i n l i n e a r t i m e .

    4 F i n d i n g t h e V o r o n o i D i a g r a mo f a N o r m a l H i s t o g r a m

    T h e k e y p r o p e r t y o f t h e h i s t o g r a m d e c o m p o s i t i ono f K l e i n a n d L i n g a s i s t h a t t h e i n fl u e n c e o f a s i t ei s l i m i t e d - - t h e V o r o n o i c el l o f s i te d o e s n o t e x t e n db e y o n d p a r e n t s , c h i l d r e n , o r si b li n g s o f h i s t o g r a m s Fig . 7 : The cons t r a inedVorono i o f se lec ted s i tesc o n t a i n i n g t h e s it e . F o l lo w i n g W a n g a n d C h i n [1 9], w e s h o w t h a t l i m i t i n g i n fl u -e n c e is a ls o k e y t o c o m p u t i n g t h e V o r o n oi d i a g r a m o f a n N H .

    L e t H b e a n N H w i t h h o r i z o n t a l b a s e e d g e e. W e c a n id e n t i f y th e s i t e s o f Hw h o s e i n fl u e n c e e x t e n d s a c r o s s t h e b a s e e d g e b y c o n s i d e r i n g c ir c le s c e n t e r e d a tt h e b a s e e d g e t h a t a r e e m p t y o f s it es .L e m m a 4 .1 I n a n N H H , t h e s i t e s w h o s e V o r o n o i c e ll s e x t e n d b e lo w t h e b a sel i n e a r e t h o s e t h a t c a n b e t o u c h e d b y a c i r c le c e n t e r e d a t t h e b a se ed g e a n d e m p t yo f o t h e r s i t e s .

    W e a s s u m e t h a t H h a s b e e n d e c o m p o s e di n t o a l i n e a r n u m b e r o f h o r i z o n t a l t r a p e z o i d s ,w h i c h i s t h e r e s u l t o f o u r d e c o m p o s i t i o n i n t oP N H s o r o f r u n n i n g C h a z e l l e 's a l g o r i t h m [4].W e c a l l t h e h o r i z o n t a l s e g m e n t s i n t r o d u c e d b yt r a p e z o i d a t i o n c h o r d s . T h e d u a l g r a p h o f t h et r a p e z o i d a t i o n o f H i s a t r e e r o o t e d b e l o w t h eb a s e e d g e w h o s e e d g e s c o r r e s p o n d t o c h o r d s ,a s i l l u s t r a t e d i n F i g u r e 8 .

    T h e i n f l u e n c e r e g i o n o f H i s t h e u n i o n o fa l l c i r c l e s c e n t e r e d a t t h e b a s e e d g e w h o s e i n -t e r i o r s d o n o t i n t e r s e c t a s i te . T H e i n f l u e n c e Fig . 8 : Trapezo ids in an IHh i s t o g r a m , I H , c o n s i s t s o f a l l h o r i z o n t a l t r a p e -z o i d s t h a t i n t e r s e c t t h e i n fl u e n c e r e gi o n . 1 W e f i nd t h e I H b y e x p l o r i n g d u a l t r e eo f t h e t r a p e z o i d a t i o n a n d m a i n t a i n i n g s t a c k s o f s i te s w h o s e V o r o n o i ce ll s m a yi n t e r s e c t t h e b a s e .

    1This influence region and influence histogram are slightly different fl 'om Wang and Chin'scorresponding ones for the constrained Voronoi diag ram o f vertices of P [19].

  • 8/3/2019 Medial Axis

    8/10

    389

    L e m m a 4 . 2 The inf luence histogram of H can be com puted in t ime proport ionalto the num ber of i ts trapezoids.P r o o f : A l l c i rc l e s i n t h i s a l g o r i t h m w i ll b e c e n t e r e d o n t h e b a s e e d g e e . A n yt w o s u c h c i rc l e s i n t e r s e c t i n a t m o s t o n e p o i n t a b o v e t h e b a s e li ne . L e t C ~d e n o t e t h e l a r g e s t c i rc l e t h a t c r o s s e s a c h o r d s a n d w h o s e i n t e r i o r d o e s n o tc o n t a i n a s i t e o n o r b e l o w s . I f C , e x i s ts , i t e i th e r t o u c h e s s i t e s t o t h e l e f t a n dr i g h t o f i t s c e n t e r , o r is c e n t e r e d a t a ( n o n - s i t e ) e n d p o i n t o f e , o r i s i n f i n it e .T h e f i r s t c a se c o r r e s p o n d s t o t h e i n t e r s e c t i o n o f e w i t h t h e b i s e c t o r o f t h e t w os i t e s t o u c h e d , a s c a n b e s e e n i n F i g u r e 7.

    W e c o m p u t e a l l s u c h l a r g e s t c ir c le s . I n i t ia l i z e e m p t y s t a c k s L a n d R , f o rl e f t a n d r i g h t . I f t h e l e f t e n d p o i n t o f t h e b a s e e d g e is a s it e , i n s e r t i t i n t o L ;s i m i l a r ly , i n s e r t t h e r i g h t e n d p o i n t i n t o R . L e t c h o r d s = e .

    N o w , w e m a i n t a i n t w o in v a r ia n t s :1. W i t h r e s p e c t t o t h e h i s t o g r a m c o n s i st i ng o f t h e t r a p e z o i d s o u t p u t s o f a r,

    t h e s t a c k s c o n t a i n t h e s i te s w h o s e V o r o n o i c e il s i n t e r s e c t e in o r d e r .2 . T h e l a r g e s t c i rc l e C ', i s d e t e r m i n e d b y th e s i t e s a t t h e t o p s o f L a n d R .

    Branc h of _.. ...t . ............... V...u_.. N ew circles andIH ends: / / A s ~ branches: " } ' - ' V - " u ' " -s ites in L_ . J ~ s i tes _ _ / / \ \ \

    o ~ - - / \ ' o i n R . ~ --7' / \ \ ' , ~9 / I / : 9 ( : / , , \ / ; ;

    e eF ig . 9 : T h e l a r g e s t c i r c l e Cs a n d t h e t r a p e z o id A ,

    L e t A s b e t h e t r a p e z o i d a b o v e s a n d l e t t a n d u b e t h e a t m o s t t w o o t h e rc h o r d s o f A , a s i l lu s t r a t e d in F i g u r e 9. I n c l u d e A , i n t h e o u t p u t . I f t h e s e g m e n to f C ~ a b o v e s i s c o n t a i n e d i n A , t h e n t h i s b r a n c h o f t h e I H i s c o m p l e t e . I f C ,c r o s s e s c h o r d t b u t d o e s n o t c o n t a i n a s i t e i n A , t h e n l e t s = t a n d c o n t i n u e .O t h e r w i s e , w e n e e d t o r e - e s t a b l i s h t h e i n v a r i a n t s , a s a t t h e r i g h t o f F i g u r e 9 .

    F i r s t , t h e n e w s i t es in A , m a y b e c l o se r t o e t h a n s i te s in L o r R - - n e wV o r o n o i c e ll s m a y c r o w d o u t o l d o n e s. I f t h e l a r g e s t c i rc l e d e t e r m i n e d b y t h en e x t - t o - t o p s i t e in L a n d s i t e s i n A s d o e s n o t c o n t a i n t h e t o p s i t e i n L , t h e n p o pt h e t o p o f L . T h e f i rs t s it e t o r e m a i n o n t h e s t a c k c e r t if ie s t h a t a l l s i te s b e n e a t ha l s o r e m a i n , s i n c e s t a c k e d s i t e s a p p e a r i n t h e s a m e o r d e r a s t h e i r V o r o n o i c e l l si n t e r s e c t e . H a n d l e R s i m i l a rl y .N e x t , w e lo o k a t t h e n e w e m p t y c ir cl es c ro s s in g c h or d s t a n d u - - i f t h e r e a r en o n e , t h e n t h e b r a n c h o f t h e I H e n d s h e r e . I f o n l y o n e c h o r d i s c r o s s e d, t h e nw e p u s h t h e n e w s i t e s w h o s e V o r o n o i c el ls i n t e r s e c t e o n t h e L a n d / o r R s t a c k sa n d c o n t i n u e . O t h e r w i s e , b o t h c h o r d s a r e c ro s s e d , a s i n F i g u r e 9; s o m e s i te ,c a l l i t f , t o u c h e s C t o n t h e ri g h t a n d C ~ o n t h e l e ft . W e c o n t i n u e b u i l d i n g t h e

  • 8/3/2019 Medial Axis

    9/10

    390

    I H a c r o s s t u s i n g c i r c l e Ct a n d s t a c k L a n d a n e w s t a c k R J t h a t c o n t a i n s s i te fa l o n e . B u i l d i n g I H a c r o s s u u s es C ~ , R , a n d a n e w L t c o n t a i n i n g o n l y f . S i te fw ill n o t b e p o p p e d o f f t h e s e s ta c k s b e c a u s e a m o n g t h e e m p t y c ir cl es b e tw e e nC t a n d C ~ t h e r e m u s t b e o n e t h a t t o u c h e s f d i r e c t ly a b o v e t h e c e n t e r - - t h i sc i r cl e , t a n g e n t t o t a n d u , c e r t if i e s t h a t t h e V o r o n o i c e ll o f f i n h i s t o g r a m Hi n t e rs e c t s t h e b a s e e d g e e . T h u s , t h e b r a n c h e s c a n b e c o m p u t e d i n d e p e n d e n t l ya n d t h e i n v a r i a n t s c a n b e m a i n t a i n e d . . .

    T h e I H c o n t a i n s a l l s it e s w h o s e V o r o n o i ce ll s i n t e r s e c t t h e b a s e e d g e . I t m a ya l s o c o n t a i n o t h e r s i t e s , b u t t h e y c a n b e g r o u p e d i n t o xy m o n o t o n e h i s t o g r a m s .L e m m a 4 . 3 The Voronoi diagram of an influence histogram H can be computedin time proportional to the number of vertices in H.

    P r o o f : S k e tc h : E a c h t i m e t h e d u a l o f t h e I H b r a n c h e s - - a n d a ci rc le is r e-p l a c e d b y t w o - - w e k n o w a v e rt i c a l s e g m e n t t o t h e b a s e e d g e c o n t a i n e d i n th eV o r o n o i c el l o f t h e s i t e f o r c i n g t h e b r a n c h . C u t t h e h i s t o g r a m a l o n g t h is s e g-m e n t . W e a r e l e f t w i t h p a i r s , a h i s t o g r a m a n d a c ir c le t h a t i n t e r s e c t a l l o f i tsh o r i z o n t a l t r a p e z o i d s . T h u s , t h e h i s t o g r a m s a r e bitonic a n d c a n b e c u t i n t otw o xy m o n o t o n e h i s t o g r a m s . C o m p u t e t h e V o r o n o i d i a g r a m s o f a b i to n i c hi s-t o g r a m b y m e r g i n g t h e d i a g r a m s o f i ts xy m o n o t o n e h i s t o g ra m s . M e r g e b it o n ich i s t o g r a m s b y s i m p l y r e jo i n i n g a lo n g t h e v e r t ic a l c u t s . . .

    I f w e d e c o m p o s e a n N H , H , i n t o a t r e e o f i n f lu e n c e h i s t o g r a m s , w e c a nc o m p u t e i ts V o r o n o i d i a g r a m i n li n e ar t im e .T h e o r e m 4 .4 The Voronoi diagram of selected sites in a normal histogram Hcan be computed time proportional to the number of vertices in H.

    F r o m t h i s t h e o r e m , w i t h t h e l e m m a s f r o m S e c t i o n 2 . 3 , w e o b t a i n t h e f i n a lr e s u l t .C o r o l l a r y 4 . 5 The Voronoi diagram of the vertices and edges of a polygon Pcan be computed time proportional to the number of vertices in P.5 C o n c l u s i o nW e h a v e g i v e n a n o p t i m a l l i n e a r - t i m e a l g o r i t h m f o r c o m p u t i n g t h e V o r o n o i d i -a g r a m o r m e d i a l a x is o f a s i m p l e p o l y g o n . S e v e r a l p r o b l e m s f o r s i m p l e p o l y g o n sc a n b e s o l v e d i n l i n e a r t i m e b a s e d o n t h i s re s u l t: c o m p u t i n g t h e l a r g e s t i n s c r i b e dc ir cl e, b u i ld i n g a q u e r y s t r u c t u r e f o r t h e c l o s es t b o u n d a r y p o i n t , a n d d e t e r m i n i n gt h e b u f f e r z o n e o f a ll p o i n t s w i t h i n r o f a s im p l e p o l y g o n a l c u r v e . T h i s a l g o -r i t h m a ls o a p pl ie s t o o t h e r L p m e t r ic s a n d c o n s t a n t - c o m p l e x i t y c o n v e x d i s t a n c ef u n c t i o n s .A c k n o w l e d g e m e n t sW e t h a n k O t f r i e d S c h w a r t z k o p f a n d D a v i d K i r k p a t r i c k f o r d i sc u s si o n s o n m e d i a la x is a lg o r i t h m s , a n d B e t h a n y C h a n , S i u - W i n g C h e n g , a n d M i c h a e l M c A l li s te rf o r t h e i r c o m m e n t s o n d r a f t s o f t h is p a p e r .

  • 8/3/2019 Medial Axis

    10/10

    391

    R e f e r e n c e s[1] A . A gga rw a l , L . J . G u ibas , J . Saxe , and P . W. Shor . A l inea r - t ime a lgor i t hmf o r c o m p u t i n g t h e V o r o n o i d i ag r a m o f a c o n v e x p o l yg o n . Disc. 8J Co mp .Geom., 4 :591-604 , 1989 .[2] F . A u r e n h a m m e r . V o r o n o i d i a g r a m s - - A s u r v e y o f a f u n d a m e n t a l g e o m e t ri cd a t a s t r u c t u r e . ACM Comp. Surveys , 23(3) :345-405 , 1991 .[3] H . B l u m . A tr a n s f o r m a t i o n f o r e x t r a c t i n g n e w d e s c r i p t o r s o f s h a p e . I nW . W h a t e n - D u n n , e d i to r , Proe. Syrup. Models fo r Percep tion of Speechand Visual Form, p a g e s 3 6 2 - 3 8 0 . M I T P r e s s , 1 9 6 7 .[4] B . Chaze l le . Tr i an gu la t i ng a s imp le po lygo n in l i nea r t ime . Disc. ~ Comp.Geom., 6 :485-524 , 1991 .[5] O . D ev i l l e rs . R and om iza t io n y i e lds s imple O ( n log* n) a lgo r i thm s for d i ff i-

    c u l t ~ ( n ) p r o b l e m s . Int . J . Comp. Geom. App. , 2(1) :97-111 , 1992 .[6] H . D j i d j e v a n d A . L i n g a s . O n c o m p u t i n g t h e V o r o n o i d i a g r a m f o r r e s t r i c t e dp lan a r f i gu re s . In W AD S '91: Second Workshop on Data S t ruc tures andAlgor i thms , number 519 in LN CS, pages 54-64 . Spr inge r -V e r l ag , 1991 .[7 ] R . O . D uda and P . E . H a r t . Pattern Classif ication and Scene Analysis .J o h n W i l e y & S o n s , 1 9 7 3 .[8] H . N . G i i r soy and N . M. Pa t r i ka l ak i s . A n au tom a t i c coa rse and f i ne su r facem e s h g e n e r a t i o n s c h e m e b a s e d o n m e d i a l a x i s t r a n s f o r m : P a r t I a l g o r i t h m .Engineer ing wi th Computers , 8:121 137, 1992.[9] M. Held. On the Co mp utat ional Geom etry of Pocket Machining. N u m b e r500 in LN CS. Spr inge r -V e r l ag , 1991 .

    [10] D . G . K i rkpa t r i ck . Ef f i c ien t co m pu ta t io n o f con t inu ous ske l e tons . In Proc.18 th F O C S, p a g e s 1 6 2 - 1 7 0 , 1977.[11] R . K le in and A . L ingas . A l i nea r - t ime rand om ized a lgo r i t hm fo r t heb o u n d e d V o r o n o i d i a g r a m o f a s i m p l e p o l y g o n . I n Proc . 9 th Ann. ACMSyrup. Comp. Geom., pages 124-132 , 1993 .[12] R . K le in and A . L ingas . Fa s t ske l e ton con s t ruc t ion . To app ea r , Proc. 3rdEurop. Syrup. on Alg. (E SA '95), 1995.[1 3] D . T . L e e . M e d i a l a x is t r a n s f o r m a t i o n o f a p l a n a r s h a p e . IEEE Trans . Pat .

    Anal . Mach. Int . , P A M I - 4 ( 4 ) : 3 6 3 - 3 6 9 , 1 9 8 2 .[14] S . Lu , H . X u , and C . Wang . D e tec t in g an d e l imina t ing fa lse s t rokes i n ske le -t o n s b y g e o m e t r i c a n a l y si s . I n SP IE 's OE/Technology'92, Vision Geometry,B o s t o n , N o v . 1 9 9 2 .[15] A . O kabe , B . Boo t s , and K . Sug iha ra . Sp atial Tessellations: Concepts an dAppl icat ions of Voronoi Diagrams. John Wi ley & Sons , 1992 .[16] A . Rosen fe ld . A x ia l r ep re sen ta t i on o f shape . Comp. Vis . Graph. ImageProc., 33 :156-173 , 1986 .[17] M . I . Sha m os and D . H oey . C lose s t po in t p rob lems . In Proc. 16th FOCS,pages 151-162 , 1975 .[ 18 ] P . V e r m e e r . T w o - d i m e n s i o n a l m a t t o b o u n d a r y c o n v e rs io n . I n Proe. 2ndSyrup. Solid Model. Appl. , pages 493-494 , 1993 .[ 1 9 ] C . A . W a n g a n d F . C h i n . F i n d i n g t h e c o n s t r a i n e d D e l a u n a y t r i a n g u l a t i o na n d c o n s t r a i n e d V o r o n o i d i a g r a m o f a s i m p l e p o l y g o n i n l in e a r ti m e . T oa p p e a r , Proc. 3rd Europ. Sym p. on Alg. (E SA '95), 1995.