23.01.2013 Views

Lecture Notes in Computer Science 4837

Lecture Notes in Computer Science 4837

Lecture Notes in Computer Science 4837

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

42 B. Gfeller et al.<br />

v5<br />

P2<br />

w2<br />

p2 = v3<br />

v4<br />

v2<br />

v<br />

w1<br />

v1 = p1<br />

Fig. 8. The extensions of a vertex v<br />

def<strong>in</strong>e basel<strong>in</strong>e triangles and pockets<br />

of v<br />

P1<br />

4<br />

3<br />

Fig. 9. The result<strong>in</strong>g basel<strong>in</strong>e triangulation<br />

of the algorithm and the visited<br />

pockets (grey). The labeled dots show<br />

the order of the recursion calles.<br />

Consider a robot at a vertex v of the polygon P .Letv1,v2,...,vi ... denote<br />

the visible vertices from v, cyclically ordered <strong>in</strong> the counterclockwise direction.<br />

Observe that the l<strong>in</strong>es vvi partition the visible part of P <strong>in</strong>to basel<strong>in</strong>e triangles<br />

(all with a common po<strong>in</strong>t v), each with at least one basel<strong>in</strong>e edge. See Fig. 8 for<br />

an illustration, where the triangles vw1v2, vv2w2, vv3v4 and vv4v5 partition the<br />

visible part of P . Thus we can partition the visible part of P . Observe that the<br />

<strong>in</strong>visible part of P is a set of disjo<strong>in</strong>t simple sub-polygons. In the example from<br />

Fig. 8 the sub-polygons P1 and P2 form the <strong>in</strong>visible part of P .Wecallsuch<br />

a sub-polygon a pocket of P . Observe that a pocket is created by a l<strong>in</strong>e which<br />

is an edge-extension or a diagonal-extension. Apply<strong>in</strong>g a recursive partition<strong>in</strong>g<br />

approach on the pockets, we create a partition of P <strong>in</strong>to triangles with at least<br />

one edge on the boundary of P (see Fig. 9). Let T denote this triangulation.<br />

The ma<strong>in</strong> idea of the algorithm is to count all targets from the robot’s position<br />

v and then proceed recursively <strong>in</strong> the correspond<strong>in</strong>g pockets of the polygon, thus<br />

navigat<strong>in</strong>g through T and count<strong>in</strong>g the targets <strong>in</strong> the triangles of T .Webeg<strong>in</strong><br />

with a high-level description. For a vertex v let P1,...,Pℓ denote pockets of P<br />

def<strong>in</strong>ed by all extensions orig<strong>in</strong>at<strong>in</strong>g at v. Letpi, i =1,...,ℓ, denote the visible<br />

vertex whose extension def<strong>in</strong>es Pi. Letwi be the po<strong>in</strong>t of P for which vwi is the<br />

extension of vpi.<br />

Count<strong>in</strong>g <strong>in</strong> Simple Polygons<br />

1. Count all the targets that are visible from the robot’s position at<br />

vertex v.<br />

2. Put a pebble at v and remember the position of v <strong>in</strong> the respective<br />

piv of every vertex pi and of every po<strong>in</strong>t wi.<br />

3. Recursively count the targets <strong>in</strong> Pi, i =1,...,ℓ,bymark<strong>in</strong>gthe<br />

po<strong>in</strong>t wi with a pebble and go<strong>in</strong>g to pi.<br />

When a robot walks to vertex pi to start a recursive call for pocket Pi, it<br />

first checks the position of the pebble that marks the po<strong>in</strong>t wi. Nexttherobot<br />

determ<strong>in</strong>es which vertices (and targets) visible from pi belong to pocket Pi. Let<br />

k be the number of vertices (<strong>in</strong>clud<strong>in</strong>g wi) and targets visible from pi. Leth be<br />

the <strong>in</strong>dex of wi <strong>in</strong> the piv of vertex pi. IfpocketPi lies to the right of piwi, then<br />

1<br />

2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!