4.2.2. Update the DM

Table 2 presents pseudocode for updating the DM. The function **update()** orderly pops the next unprocessed cell *s* with the lowest *dists* until the *OPEN* queue is empty (lines 14 and 15). If *s* is cleared and is not yet propagated by a raise wavefront, the function **raise()** is called (lines 16 and 17). However, if *s* has a valid closest obstacle cell, the function **lower()** is called (lines 18 to 20).


```
findSuccessors(cell s)
```
40. **if** *dirs* is one of the four cardinal directions **then**

```
41. return N ← {s + dirs }
```

```
42. else
```
43. **return** *N* ← {*s* + *dirs*, *s* + *c1*, *s*+*c2* | where *dirs* =*c1*+*c2*}

Newly inserted obstacle cells call function **lower()** to launch a lower wavefront to propagate the reduction of *dist* and *obst* values from the currently popped cell *s* to its affected cells (lines 26 to 29). The lower wavefront continues when the distance value (denoted as *d* which is computed in line 24) between *obsts* and the newly expanded cell *n* holds the trend of distance reduction (being determined in line 25). Simultaneously, newly freed cells call function **raise()** to launch a raise wavefront, resetting the cells whose closest obstacle cell was the freed one (line 33 to 36). The raise wavefront terminates when it reaches those cells whose closest obstacle is valid; thus, a lower wavefront launched by *n* is generated (line 37). During the interwoven of these two wavefronts, inconsistent neighbors affected by the processed cell are again put on *OPEN* (line 29 and 38), thus the propagation continues.

Instead of propagating a wavefront along with full directions, we introduce a function **findSuccessors(***s***)** to filter cells by employing the rule of canonical ordering (line 21 and 30). As illustrated in Figure 6b, only the successors of a cell in the direction of the arrows are chosen as the

candidates of the next round of propagation, while the others are ignored. For a cell *n* conducting a wavefront from one of its adjacent cell *s*, function **direction(***s***,***n***)** determines the direction from *s* to *n* and accordingly returns the value of *dirn* (line 28 and 36).
