# When should one use RegionFunction with ParametricPlot3D?

According to the documentation, "RegionFunction is an option for plotting functions that specifies the region to include in the plot drawn", and it can be used with ParametricPlot3D.

However, when using the latter command, one can also directly set variable plot limits, e.g., by writing {v, -f[u], f[u]} for some appropriate function f[u]. I am wondering whether there is any difference in doing this with respect to using RegionFunction.

For example, in the case below, the two plots produce exactly the same figure.

surface[u_, v_] := {Cos[v] Cos[u], Cos[v] Sin[u], Sin[v]}

f[u_] := u/2

ParametricPlot3D[surface[u, v], {u, 0, Pi}, {v, -f[u], f[u]}]

ParametricPlot3D[surface[u, v], {u, 0, Pi}, {v, -Pi/2, Pi/2},
RegionFunction -> (-#4/2 < #5 < #4/2 &)]


Yes, there are some differences. For example, if we set f[u_]:=-u/2 and u in the interval {u,-Pi/2,Pi}, then the three pictures below are different.

surface[u_, v_] := {Cos[v] Cos[u], Cos[v] Sin[u], Sin[v]};
f[u_] := -u/2;
a = ParametricPlot3D[surface[u, v], {u, -Pi/2, Pi}, {v, -f[u], f[u]},
PlotRange -> All];
b = ParametricPlot3D[surface[u, v], {u, -Pi/2, Pi}, {v, -10, 10},
RegionFunction -> Function[{x, y, z, u, v}, -f[u] <= v <= f[u]],
PlotRange -> All];
c = ParametricPlot3D[surface[u, v], {u, -Pi/2, Pi}, {v, -10, 10},
RegionFunction -> Function[{x, y, z, u, v}, -u/2 <= v <= u/2],
PlotRange -> All];
GraphicsRow[{a, b, c}]


• Thanks for the answer. It is not empty if one writes RegionFunction -> (-#4/2 <= #5 <= #4/2 &) instead. Or, equivalently, RegionFunction -> Function[{x, y, z, u, v}, -u/2 <= v <= u/2].
– MK7
Jun 16 at 12:40
• @MK7 Please see the updated. Jun 16 at 13:08
• I cannot make sense of plots a and c being different. Could you please provide some detail?
– MK7
Jun 16 at 13:46
• @MK7 It seems that  {v, -f[u], f[u]} means that v is between -f[u] and f[u], is difference from -f[u]<=v<=f[u] Jun 16 at 13:49
• OK I see it now. When u < 0, RegionFunction in your third ParametricPlot3D returns False. On the other hand, in the first ParametricPlot3D, replacing {v, -f[u], f[u]} with {v, f[u], -f[u]} does not affect the solution.
– MK7
Jun 16 at 14:07