First we define that is minimum angular distance of a cell from and then we will give formal definition of ArcTrip.
Minimum angular distance ( ): The minimum angular distance between a cell and the query point is Euclidean distance from to the nearest boundary of the portion of that lies between angle range . Fig. clarifies the definition where values of and are same as their whereas of is the minimum distance of the shaded area of from . Any cell that completely lies outside the angle range has . i.e; .
Now we define ArcTrip( : given a radius and an angle range , ArcTrip returns every cell that intersects the circle of radius with center at and has smaller than . Consider the example of Fig. , ArcTrip( , ) returns all the shaded cells.
ArcTrip algorithm is similar to CircularTrip. The algorithm starts with the cell that intersects the circle and lies at angle . The cell is shown in Fig. . Mathematically, where and ); The direction is selected according to the quadrant in which lies. Fig. , shows for different quadrants with jumbo arrows. In the example of Fig. , is set as down. The algorithm continues exactly same as CircularTrip and terminates as soon as the next cell that intersects the circle lies outside the range .
Note from Fig. , if we start from as mentioned above, we may miss a cell that should have been returned by ArcTrip. We prove next that this special cell is always adjacent to in direction opposite to . To address this issue, we always first check whether the cell should be inserted in or not depending on whether it lies in angle range or not. If it lies in the angle range we include it in result otherwise we ignore it (i.e; line 4 - 5 of Algorithm ).
Lemma
Let be the starting cell of ArcTrip as defined earlier and be the opposite direction of . The only cell ArcTrip can miss is that is always the adjacent cell to in direction .
Proof:
It can be immediately verified that the is one of the four cells adjacent to (in Fig. is shown as ). The cells in direction and will be checked during execution of ArcTrip and will be inserted if intersect the circle. So can only be the cell either in direction or the remaining direction .
Let and be the adjacent cells to in direction and , respectively. It can be immediately verified that is always greater than (otherwise it would have been the starting cell ), so ArcTrip does not need to check it. We are left only with and hence it is .
Algorithm presents the implementation of ArcTrip. Note that CircularTrip can be considered a special case of ArcTrip where angle range is the whole space. More specifically we can say that CircularTrip( ) is exactly same as ArcTrip( ).
Muhammad Aamir Cheema 2007-10-11