im using this in another function, and my idea was to change the DoesQuadContainOrigin-function:
yours is easier to understand what it is doing, but mine is, i think, faster... it returns false sooner and prevents the function from doing unneccessary calculations.
function DoesQuadContainOrigin takes real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4 returns boolean
local boolean firstcheck = (x1-x2)*y1 < x1 * (y1-y2)
if (x2-x3)*y2 < x2 * (y2-y3) != firstcheck then
return false
endif
if (x3-x4)*y3 < x3 * (y3-y4) != firstcheck then
return false
endif
return (x4-x1)*y4 < x4 * (y4-y1) == firstcheck
endfunctionyours is easier to understand what it is doing, but mine is, i think, faster... it returns false sooner and prevents the function from doing unneccessary calculations.