Diamond angle is a fast alternative to atan2.
It is useful for angle comparisons.
Code:
//______________________________________________________________________
//diamond angle 0..4
function diamAngle(x y) (
y >= 0 ? (
x >= 0 ? y / (x + y) : 1 + x / (x - y);
) : (
x < 0 ? 2 + y / (x + y) : 3 + x / (x - y);
);
);