-- Input variables local angle = math.PI/3 -- 60 degrees, arbitrarily chosen local x, y = 12, 53 -- Cursor offsets, arbitrarily chosen -- Algorithm local u, v = math.cos(angle), math.sin(angle) local dp = (x*u + y*v) -- Vector dot product local projX, projY = dp*x, dp*y -- The radius is the length of the vector, or sqrt(x^2 + y^2) local radius = sqrt(projX^2 + projY^2); return radius;