Re: tracing lines on surface-graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg25616] Re: [mg25593] tracing lines on surface-graphics
- From: BobHanlon at aol.com
- Date: Mon, 16 Oct 2000 03:04:39 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 10/9/2000 9:58:47 PM, roommate222 at my-deja.com writes:
>I can't find an obvious way to trace a line on a surface-graphics
>object. I've plotted f(x,y) and got the surface I want, and now I want
>to add a curve, say: x varies according to the plotted range, y=1+x/2,
>z=f(x,y) --so it lies on the surface I've plotted. I've turned the mesh
>off because it's too dense, given the number of points I'm plotting,
>but I want to add a couple of such lines - another option would be to
>trace every 20th mesh-line or something like that, but that doesn't
>seem to be possible either.
>
Needs["Graphics`Graphics`"];
Needs["Graphics`Graphics3D`"];
plotPts = 41;
xMeshSeparation = 1/3;
yMeshSeparation = 1/2;
xmin = 0;
xmax = 6;
ymin = 0;
ymax = 4;
f[x_, y_] := x*y/4;
t[x_] := Evaluate[f[x, 1 + x/2]];
mesh = Join[
Table[ScatterPlot3D[Table[{x, y, If[Positive[f[x, y]], 1.01, .99]*f[x, y]},
{y, ymin, ymax, (ymax-ymin)/(plotPts-1)}], PlotJoined -> True, PlotStyle ->
AbsoluteThickness[1], DisplayFunction -> Identity], {x, xmin, xmax,
xMeshSeparation}],
Table[ScatterPlot3D[Table[{x, y, If[Positive[f[x, y]], 1.01, .99]*f[x, y]},
{x, xmin, xmax, (xmax-xmin)/(plotPts-1)}], PlotJoined -> True,
DisplayFunction -> Identity], {y, ymin, ymax, yMeshSeparation}]];
trace = ScatterPlot3D[Table[{x, 1+x/2, If[Positive[t[x]], 1.01, .99]*t[x]},
{x, xmin, xmax, (xmax-xmin)/(plotPts-1)}],
PlotJoined -> True, PlotStyle -> {AbsoluteThickness[2], RGBColor[1, 0, 0]},
DisplayFunction -> Identity];
surf = Plot3D[f[x, y], {x, 0, xmax}, {y, 0, ymax}, PlotPoints -> plotPts,
Mesh -> False, AxesLabel -> {"x", " y", "\n\n\nz "},
DisplayFunction -> Identity, ImageSize -> {430, 350}];
Show[Join[{surf}, {trace}, mesh], DisplayFunction -> $DisplayFunction,
ImageSize -> {430, 350}];
Bob Hanlon