Golf would_stick a bit

This commit is contained in:
Pyrex 2022-12-31 14:48:24 -08:00
parent bef28a8d87
commit fa5c13eb0d

View File

@ -1178,17 +1178,13 @@ function would_stick(anchor,x0,y0,x1,y1,x2,y2)
local dprop=(x1-x0)/dx
x1_new,y1_new=x1,y0+dprop*(y2-y0)
ady=sgn0(y1_new-y1)
adx=0
if (y0>y2) adx=ady
if (y0<y2) adx=-ady
adx=sgn0(y0-y2)*ady
else
if (y0>y2) dy,x0,y0,x2,y2=-dy,x2,y2,x0,y0
local dprop=(y1-y0)/dy
x1_new,y1_new=x0+dprop*(x2-x0),y1
adx=sgn0(x1_new-x1)
ady=0
if (x0>x2) ady=adx
if (x0<x2) ady=-adx
ady=sgn0(x0-x2)*adx
end
local wouldnt=anchor==nil or (anchor.adx!=adx or anchor.ady!=ady)