MathGroup Archive 1996

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

Search the Archive

Re: Revealing HiddenSurfaces

  • To: mathgroup at
  • Subject: [mg4558] Re: [mg4479] Revealing HiddenSurfaces
  • From: Allan Hayes <hay at>
  • Date: Wed, 7 Aug 1996 04:18:06 -0400
  • Sender: owner-wri-mathgroup at

dsmith at (David Smith)
[mg4479] Revealing HiddenSurfaces

I want to plot two things in a single 3D graph. One thing is just a
surface which I can do easily enough as ...

model = Plot3D[(x + y)/2,
{x,0,25},{y,0,25}, PlotPoints -> 2,
Shading -> False,
HiddenSurface -> False]

where I can see the hidden surface. Superimposed on this I wanted  
data points(where the `error` distance between each data point and  
the model surfaceis shown by a vertical line). I did this in two  
steps. First make the error lines with the example set ...

data = Show[Graphics3D[{Line[{{0,1.97,0.98},{0,1.97,0.99}}],
Axes -> True]]

Finally plot everything together.

Show[data, model, Shading -> False]

The problem is that I`m unable to make the model surface  
transparent so that I can see the error lines of the data points  
behind the surface.
Unfortunately Graphics3D doesn`t have a HiddenSurface option  
(Plot3D andShow do). Is there some way of doing this (maybe  
converting data to someother kind of graphics object)? This has been  
bugging me and I wouldreally appreciate some pointers. Thanks.


Here are two ways



   WireFrame[graphics3D] replaces all polygons in the
   three-dimensional graphics object by outlines.

      Graphics3D[  (*convert to Graphics3D*)
         Plot3D[(x + y)/2,{x,0,25},{y,0,25},
            PlotPoints -> 2, DisplayFunction -> Identity

   Graphics3D[{ (*a line and point to be added*)
      Line[{{10,10,0},{10,10,15}}],PointSize[.03], Point[{10,10,10}]
   DisplayFunction -> $DisplayFunction

This way uses epilog. It is much heavier going, but you can keep  
the shading of the surface if you wish, and do other fancy things.

model =
Plot3D[(x + y)/2,{x,0,25},{y,0,25},
   PlotPoints -> 2 (*,HiddenSurface -> False *)

Epilog uses 2D elements:
I shall construct a 2D projection of the 3D line and a point that,  
but I need it to be in the same box as model, so I get the actual  
values used for the relevant options in model.

{pr,vp,br} = FullOptions[model, {PlotRange,ViewPoint,BoxRatios}]

The 3D display of the line and point is

pl =
     {GrayLevel[0.3],Line[{{10,10,0},{10,10,10}}],(*below surface*)
      GrayLevel[0],Line[{{10,10,10},{10,10,15}}], (*above surface*)
      PointSize[.03], Point[{10,10,10}]
     PlotRange->pr,ViewPoint ->vp,BoxRatios->br

The 2D projection for Epilog is

epi = Graphics[pl][[1]] (*keep only the primitives*)

The final combination is

Show[model, Epilog-> epi]

Allan Hayes,


  • Prev by Date: Re: Reordering lists?!
  • Next by Date: CDE and 'pinnable' windows...
  • Previous by thread: Re: Reordering lists?!
  • Next by thread: CDE and 'pinnable' windows...