Message Boards Message Boards

0
|
4933 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

What's wrong with my using of RegionFunction

Posted 11 years ago
This simple code is working fine:
x =.; y =.; z =.;
syst = {Abs[x - y] <= 1, Abs[y - z] <= 1, Abs[z - x] <= 1};
RegionPlot3D[Apply[And, syst], {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]
Result is like this:

I want to draw a crosssection of this volume with the plane z==0.
In my opinion, the RegionFunction is a good way, but
RegionPlot3D[Apply[And,syst],{x,-2,2},{y,-2,2},{z,-2,2},RegionFunction->Function[{x,y,z},z==0]]
returns 
RegionPlot3D::optx: "Unknown option RegionFunction->Function[{x,y,z},z==0] in RegionPlot3D[And@@syst,{x,-2,2},{y,-2,2},{z,-2,2},RegionFunction->Function[{x,y,z},z==0]]."
It seems, that RegionFunction is not allowed in RegionPlot3D. But in the help for RegionPlot3D is written The arguments supplied to functions in MeshFunctions and RegionFunction are x, y, and z. 

Please, where is the problem?

Thanks!
POSTED BY: Tomáš Hruš
2 Replies
This appears to be an error in the documentation.  Thank you for making us aware of it. 

The condition z==0 is probably too strict and won't be true for enough sampled points for RegionPlot3D to make something useful. 
I would suggest having a condition such as Abs<0.01 instead. In that case you can add it as a condition as follows:
RegionPlot3D[Apply[And, syst] && Abs[z] < 0.01, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]
Regions have to have some sort of thickness to them in order to be visible and while == is defined to be true for a small region of values around 0, this might be too thin for RegionPlot unless a much higher sampling is done. 
POSTED BY: Sean Clarke
Posted 11 years ago
Thank You Sean,

I hoped, that Mathematica can change his own algorithm for RegionPlot, if an equality is included -- this mostly changes the n-Dim object to (n-1)-Dim object.

Your suggestion is clear and the result is ok.

Thank you very much!
POSTED BY: Tomáš Hruš
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract