Курсовая работа: Система координат канви
{ lz = Lose->Items[j];
b = Ball->Items[i];
if(! b->exist ) continue;
d = sqrt(sqr(b->x-lz->x)+sqr(b->y-lz->y));
if(d < minDist )
{ minDist = d;
ToLz = lz;
Bl = b; } }
if((Bl == NULL) ) exit;
dx = Bl->x - ToLz->x;
dy = Bl->y - ToLz->y;
d = sqrt(dx*dx+dy*dy);
if((dy)>0
a2Lz = arccos(dx/d);
else a2Lz = -arccos(dx/d);
hitX = Bl->x + cos(a2Lz)*Bl->R;
hitY = Bl->y + sin(a2Lz)*Bl->R;
minAng = 1.7e+308;
for( i = 0; i <=Ball->Count-1; i ++)
{ b = Ball->Items[i];
if((b->ID == Bl->ID) || (not b->exist)
continue;
a = GetAngToXY(b, hitX, hitY);
if(abs(a2Lz-a) < minAng )
{ minAng = abs(a2Lz-a);
nearestBall = b;
Result = a; } }
for( i := 0 to Ball.Count-1 do
begin