What's the most compact WL translation of this GLSL expression:
length(max(vec2(x,y),s))
?
Norm[s + Ramp[{x, y} - s]]
Sqrt[Abs[s + Ramp[-s + x]]^2 + Abs[s + Ramp[-s + y]]^2]
ClearAll[x, y, s]
Reduce[s + Ramp[{x,y} - s] == {Max[x, s], Max[y, s]}, {x, y, s}, Reals]
True
Manipulate[Row[{Plot3D[Norm[s + Ramp[{x, y} - s]], {x, -1, 1}, {y, -1, 1},
ImageSize -> 400, Exclusions -> None],
Plot3D[Norm[Max[#, s] & /@ {x, y}], {x, -1, 1}, {y, -1, 1}, ImageSize -> 400]}],
{s, 0, 1}]
Or
Norm[s + ({x,y} - s) UnitStep[{x,y} -s]]
Sqrt[Abs[s + (-s + x) UnitStep[-s + x]]^2 + Abs[s + (-s + y) UnitStep[-s + y]]^2]
Reduce[s + ({x,y}-s) UnitStep[{x, y} - s] == {Max[x, s], Max[y, s]}, {x,y, s}, Reals]
True