MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: combining surface graphics objects

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34261] Re: combining surface graphics objects
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sun, 12 May 2002 03:26:22 -0400 (EDT)
  • References: <abijnn$le2$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Johannes Ludsteck" <johannes.ludsteck at wiwi.uni-regensburg.de> wrote in
message news:abijnn$le2$1 at smc.vnet.net...
> 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,
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-

Now, load the package.

    << "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
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565










  • Prev by Date: RE: RE: Re: How to integrate over a constrained domain
  • Next by Date: RE: Re: RE: Sequence and Or
  • Previous by thread: RE: combining surface graphics objects
  • Next by thread: Color Functions