snap.love/0056-x_at_y

8 lines
231 B
Plaintext

x_at_y = function(startx,starty, endx,endy, y)
-- x at a given y on a line
-- Could be nil when the line is parallel to the x axis.
if starty == endy then
return
end
return (endx-startx)/(endy-starty)*(y-starty) + startx
end