min(max(x,y),1-min(x,y)) from 0 to 1