hedgewars/uLandGenTemplateBased.pas
changeset 10494 0eb97cf4c78e
parent 10478 12662c21e0e9
child 10495 6d61b44a5652
equal deleted inserted replaced
10493:bcbf029e6b08 10494:0eb97cf4c78e
   194                 aqpb:= a * q - p * b;
   194                 aqpb:= a * q - p * b;
   195 
   195 
   196                 if (aqpb <> 0) then
   196                 if (aqpb <> 0) then
   197                 begin
   197                 begin
   198                     // (ix; iy) is intersection point
   198                     // (ix; iy) is intersection point
   199                     iy:= ((Int64(pa.ar[i].x - mp.x) * b + Int64(mp.y) * a) * q - Int64(pa.ar[i].y) * p * b) div aqpb;
   199                     iy:= (((Int64(pa.ar[i].x) - mp.x) * b + Int64(mp.y) * a) * q - Int64(pa.ar[i].y) * p * b) div aqpb;
   200                     if abs(b) > abs(q) then
   200                     if abs(b) > abs(q) then
   201                         ix:= (iy - mp.y) * a div b + mp.x
   201                         ix:= (iy - mp.y) * a div b + mp.x
   202                     else
   202                     else
   203                         ix:= (iy - pa.ar[i].y) * p div q + pa.ar[i].x;
   203                         ix:= (iy - pa.ar[i].y) * p div q + pa.ar[i].x;
   204 
   204 
   225                 aqpb:= a * q - p * b;
   225                 aqpb:= a * q - p * b;
   226 
   226 
   227                 if (aqpb <> 0) then
   227                 if (aqpb <> 0) then
   228                 begin
   228                 begin
   229                     // (ix; iy) is intersection point
   229                     // (ix; iy) is intersection point
   230                     iy:= ((Int64(p1.x - mp.x) * b + Int64(mp.y) * a) * q - Int64(p1.y) * p * b) div aqpb;
   230                     iy:= (((Int64(p1.x) - mp.x) * b + Int64(mp.y) * a) * q - Int64(p1.y) * p * b) div aqpb;
   231                     if abs(b) > abs(q) then
   231                     if abs(b) > abs(q) then
   232                         ix:= (iy - mp.y) * a div b + mp.x
   232                         ix:= (iy - mp.y) * a div b + mp.x
   233                     else
   233                     else
   234                         ix:= (iy - p1.y) * p div q + p1.x;
   234                         ix:= (iy - p1.y) * p div q + p1.x;
   235 
   235 
   244                 aqpb:= a * q - p * b;
   244                 aqpb:= a * q - p * b;
   245 
   245 
   246                 if (aqpb <> 0) then
   246                 if (aqpb <> 0) then
   247                 begin
   247                 begin
   248                     // (ix; iy) is intersection point
   248                     // (ix; iy) is intersection point
   249                     iy:= ((Int64(p2.x - mp.x) * b + Int64(mp.y) * a) * q - Int64(p2.y) * p * b) div aqpb;
   249                     iy:= (((Int64(p2.x) - mp.x) * b + Int64(mp.y) * a) * q - Int64(p2.y) * p * b) div aqpb;
   250                     if abs(b) > abs(q) then
   250                     if abs(b) > abs(q) then
   251                         ix:= (iy - mp.y) * a div b + mp.x
   251                         ix:= (iy - mp.y) * a div b + mp.x
   252                     else
   252                     else
   253                         ix:= (iy - p2.y) * p div q + p2.x;
   253                         ix:= (iy - p2.y) * p div q + p2.x;
   254 
   254