Algorithm 2 Division Calculation Input: A continuous area A, m circles on A. Output: All divisions within A. |
-
1:
;
-
2:
Calculate all the intersection points on and , and record the list of intersection points on ;
-
3:
Add all the arcs in to if has intersection points;
-
4:
for all
do
-
5:
if
has no intersection point and is inside A
then
-
6:
Add to and then to ;
-
7:
else
-
8:
Add all arcs on and inside A to ;
-
9:
for all
do
-
10:
;
-
11:
repeat
-
12:
Select such that share the endpoint and the angle from to is minimized;
-
13:
= ;
-
14:
until
==
-
15:
if the chain of arcs form the profile of multiple circles then
-
16:
Add to if ;
-
17:
else
-
18:
Add to if ;
-
19:
;
-
20:
repeat
-
21:
Select such that share the endpoint and the angle from to is minimized;
-
22:
= ;
-
23:
until
==
-
24:
if the chain of arcs form the profile of multiple circles then
-
25:
Add to if ;
-
26:
else
-
27:
Add to if ;
-
28:
if there is no intersection point in
then
-
29:
if
or A is inside a circle then
-
30:
Add to ;
-
31:
for all
do
-
32:
;
-
33:
for all
do
-
34:
if
encloses and ( or d encloses ) then
-
35:
;
-
36:
Incorporate into and update in ;
-
37:
return
.
|