Question: How to implement nonlinear plotting domains - aka "RegionFunction" in Mathematica ?

Is there any alternative to Mathematica's "RegionFunction" in Maple, with applications of controlling the plotting domain for surface plots ? This question has been asked previosly, and given a workaround by "Markiyan Hirnyk", suggesting to leave the function that is to be plotted undefined outside of the plot region. Something like:

f1 := proc(x,y) if x^2 + y^2 > 0 and x^2 + y^2 < 4 then 8 - x^2 - y^2 end if end proc:
f2 := proc(x,y) if x^2 + y^2 > 0 and x^2 + y^2 < 4 then x^2 + y^2 end if end proc:
plot3d({f1,f2}, -2..2, -2..2) 

The result is clearly not good looking. You can increase the number of points, but we need a better way to do this.

BTW, the similar question was asked in 2010. Are there any better alternatives, ~ 10 years later ?

Please Wait...