Re: Revealing HiddenSurfaces
- To: mathgroup at smc.vnet.net
- Subject: [mg4558] Re: [mg4479] Revealing HiddenSurfaces
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Wed, 7 Aug 1996 04:18:06 -0400
- Sender: owner-wri-mathgroup at wolfram.com
dsmith at psy.ucsd.edu (David Smith)
[mg4479] Revealing HiddenSurfaces
writes
>>>>>>>>>>>>>>>>>>>>>>>>>>>
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}}],
Line[{{0,8.72,4.02},{0,8.72,4.36}}],
Line[{{0,22.1,8.38},{0,22.1,11.05}}]},
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.
<<<<<<<<<<<<<<<<<<<<<<<
David:
Here are two ways
(1)
<<Graphics`Shapes`
?WireFrame
WireFrame[graphics3D] replaces all polygons in the
three-dimensional graphics object by outlines.
Show[
WireFrame[
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
]
(2)
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 =
Graphics3D[
{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
]//Show
The 2D projection for Epilog is
epi = Graphics[pl][[1]] (*keep only the primitives*)
The final combination is
Show[model, Epilog-> epi]
Allan Hayes,
==== [MESSAGE SEPARATOR] ====