       Re: Cropping a surface to a sphere

• To: mathgroup at smc.vnet.net
• Subject: [mg88221] Re: Cropping a surface to a sphere
• From: "David Park" <djmpark at comcast.net>
• Date: Mon, 28 Apr 2008 04:42:17 -0400 (EDT)
• References: <fv1ff5\$es6\$1@smc.vnet.net>

```Just use the RegionFunction option. One should check the Function page for
RegionFunction and see what arguments the function takes for various plot
types. Different plot types use different arguments (and this is also true
for other types of function options in plot statements) so one should check
this. I usually write a Function expression with all the arguments, even
though only some of them may be used.

ContourPlot3D[-x^4 y^2 + x^2 y^4 + x^4 z^2 - y^4 z^2 - x^2 z^4 +
y^2 z^4 == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3},
RegionFunction -> Function[{x, y, z, f}, x^2 + y^2 + z^2 <= 9],
Mesh -> False]

--
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

"Szabolcs Horv=E1t" <szhorvat at gmail.com> wrote in message
news:fv1ff5\$es6\$1 at smc.vnet.net...
>
> Is there a simple way to crop a surface to a sphere?
>
> For example, consider the surface
>
> ContourPlot3D[
>   -x^4*y^2 + x^2*y^4 + x^4*z^2 - y^4*z^2 -
>    x^2*z^4 + y^2*z^4 == 1,
>   {x, -3, 3}, {y, -3, 3}, {z, -3, 3},
>   Mesh -> False]
>
> It is cropped to a cube (the bounding box) by default.  I would like to
> crop it to a sphere of radius 3 (or some other region).
>
> Is there an easy way to do this?  I guess that if there really isn't a
> better way, I could write a polygon cropping function, convert the
> graphic to Normal[] form, and crop/remove each polygon one by one, but I
> was hoping for a simpler solution ... (built-in function or existing
> package).
>

```

• Prev by Date: Re: delayed function assignment
• Next by Date: Re: Wolfram User Interface Research?
• Previous by thread: Re: Cropping a surface to a sphere
• Next by thread: Re: Cropping a surface to a sphere