IF ABS(circles
(j
).x
- circles
(i
).x
) <= testr
THEN IF ABS(circles
(j
).y
- circles
(i
).y
) <= testr
+ circles
(j
).r
THEN circles(i).growing = 0: circles(j).growing = 0
replaces:
IF SQR((circles
(j
).x
- circles
(i
).x
) ^ 2 + (circles
(j
).y
- circles
(i
).y
) ^ 2) <= testr
THEN circles(i).growing = 0: circles(j).growing = 0
I see it, I like it! I will use this lesson in the future. Thank you!
oops! I see something missing in first line
IF ABS(circles(j).x - circles(i).x) <= testr THEN
should be
IF ABS(circles(j).x - circles(i).x) <= testr + circles(j).r
Update: on second thought, since the hypotenuse is considerably shorter than sum of two legs (unless 1 leg is really short)...
I am going to try to work up an alternative that even avoids ABS.