Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

# combining surface graphics objects

2 views

### Johannes Ludsteck

May 11, 2002, 4:11:35 AM5/11/02
to
Dear Mathgroup members,
I would like to combine two 'transparent' function plots.
Mathematica renders 'transparent' plots when the
option HiddenSurface->False is given, for example:

p1= Plot3D[x+y,
{x,0,1},{y,0,1},
HiddenSurface->False]

Now I want to combine it with a second plot:

p2= Plot3D[Sin[8 x y],
{x,0,1},{y,0,1},
HiddenSurface->False]

However, when I request

Show[p1,p2]

Mathematica has lost the HiddenSurface option and
plots both surfaces filled. And even
worse, it does not accept the option in Show.

Show[p1,p2,
HiddenSurface->False]

I tried some other solutions, for example using
SurfaceGraphics explicitly:
p1=SurfaceGraphics[Table[x+y],{x,0,1,0.1},{y,0,1,0.1}],
HiddenSurface->False]

p2=SurfaceGraphics[...]

Show[p1,p2]
However, none of the were successful.

A more heroic goal would be to combine a transparent
with an non-transparent plot.

Any suggestions?

Thank you very much in advance,
Johannes Ludsteck

<><><><><><><><><><><><><><><><><><>
Johannes Ludsteck
Institut fuer Volkswirtschaftslehre
Lehrstuhl Prof. Dr. Moeller
Universitaet Regensburg
Universitaetsstrasse 31
93053 Regensburg
Tel +49/0941/943-2741

### David Park

May 12, 2002, 3:31:46 AM5/12/02
to
Johannes,

I am always learning something from MathGroup questions! I never understood
before what "HiddenSurface" meant. Apparantly, HiddenSurface -> False means
the same as wire frame. I guess that is what your mean by a "transparant
plot".

Having learned that, it is easy to do what you want with my DrawGraphics
package, available at my web site. Here one surface is drawn as a wire frame
and the second surface normally.

Needs["DrawGraphics`DrawingMaster`"]

Draw3DItems[
{Draw3D[x + y, {x, 0, 1}, {y, 0, 1}] // UseWireFrame,
Draw3D[Sin[8 x y], {x, 0, 1}, {y, 0, 1}]},
BoxRatios -> {1, 1, 1/2},
Axes -> True,
ImageSize -> 400];

Draw3D is just like Plot3D except that it extracts the graphics object and
converts it to Graphics3D, without making a side plot. UseWireFrame applies
the WireFrame routine from the Shapes package to the graphics primitives.
One of the main purposes of DrawGraphics is to make it easy to manipulate
and combine graphical objects produced by various plot types.

### Allan Hayes

May 12, 2002, 3:39:50 AM5/12/02
to
"Johannes Ludsteck" <johannes...@wiwi.uni-regensburg.de> wrote in
message news:abijnn\$le2\$1...@smc.vnet.net...

Johannes,
You need to use the function WireFraim from the package Graphics`Shapes` or
to do a little programming:

I begin with your first two inputs, notice that the ourtput is a
SurfaceGraphics object

p1 = Plot3D[x + y, {x, 0, 1}, {y, 0, 1}, HiddenSurface -> False]

-SurfaceGraphics-

p2 = Plot3D[Sin[8*x*y], {x, 0, 1}, {y, 0, 1}, HiddenSurface -> False]

-SurfaceGraphics-
Below we combine these outputs into a single object, here it is a Graphics3D
object because SurfaceGraphics stores the description as a table of heights
which is not possible with possibly overlapping and intersecting
surfaces --- Graphics3D stores the description as a list of polygon
objects,(wecan see this if you evaluted InputForm[p1] etc.) moreover the
HiddenSurface option is deleted - it is not effective.

p12 = Show[p1, p2]

-Graphics3D-

<< "Graphics`Shapes`"

WireFrame replaces each object Polygon[{pt1, pt2, pt3, pt4}] with Line[pt1,
pt2, pt3, pt4, pt1}]

Show[WireFrame[p12]]

It is unnecessary to use HiddenSurface -> False if all that you want is the
last picture.

Below, I do little replacement instead of using WireFrame; I also turn off
the display for unwanted constructin images and turn it back on again for
the final image.

Show[Show[
Plot3D[#, {x, 0, 1}, {y, 0, 1}, DisplayFunction -> Identity] & /@ {x +
y, Sin[8*x*y]}] /.
Polygon[pts_] :> Line[Append[pts, First[pts]]],
DisplayFunction -> \$DisplayFunction]

--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
h...@haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

0 new messages