forked from pyrex/chameleonic
Golf would_stick a bit
This commit is contained in:
parent
bef28a8d87
commit
fa5c13eb0d
@ -1178,17 +1178,13 @@ function would_stick(anchor,x0,y0,x1,y1,x2,y2)
|
|||||||
local dprop=(x1-x0)/dx
|
local dprop=(x1-x0)/dx
|
||||||
x1_new,y1_new=x1,y0+dprop*(y2-y0)
|
x1_new,y1_new=x1,y0+dprop*(y2-y0)
|
||||||
ady=sgn0(y1_new-y1)
|
ady=sgn0(y1_new-y1)
|
||||||
adx=0
|
adx=sgn0(y0-y2)*ady
|
||||||
if (y0>y2) adx=ady
|
|
||||||
if (y0<y2) adx=-ady
|
|
||||||
else
|
else
|
||||||
if (y0>y2) dy,x0,y0,x2,y2=-dy,x2,y2,x0,y0
|
if (y0>y2) dy,x0,y0,x2,y2=-dy,x2,y2,x0,y0
|
||||||
local dprop=(y1-y0)/dy
|
local dprop=(y1-y0)/dy
|
||||||
x1_new,y1_new=x0+dprop*(x2-x0),y1
|
x1_new,y1_new=x0+dprop*(x2-x0),y1
|
||||||
adx=sgn0(x1_new-x1)
|
adx=sgn0(x1_new-x1)
|
||||||
ady=0
|
ady=sgn0(x0-x2)*adx
|
||||||
if (x0>x2) ady=adx
|
|
||||||
if (x0<x2) ady=-adx
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local wouldnt=anchor==nil or (anchor.adx!=adx or anchor.ady!=ady)
|
local wouldnt=anchor==nil or (anchor.adx!=adx or anchor.ady!=ady)
|
||||||
|
Loading…
Reference in New Issue
Block a user