       Re: tracing lines on surface-graphics

• To: mathgroup at smc.vnet.net
• Subject: [mg25596] Re: tracing lines on surface-graphics
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Wed, 11 Oct 2000 03:50:37 -0400 (EDT)
• Organization: Universitaet Leipzig
• References: <8rtst2\$dpo@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

form Plot3D[] you get a SurfaceGraphics[] object. The first argument
of SurfaceGraphics[] are the f[x[i],y[i]] on a regular matrix.
To get the sparse meshlines you can  take the rows or columns
of this matrix, extend it whith the x and y values where the line is
and add this line to a graphics object that is displayed whith the
surface.

Make a surface:

gr = Plot3D[Sin[x^2 + y^2]/(1 + x^2 + y^2), {x, -Pi, Pi}, {y, -Pi, Pi},
PlotPoints -> 60, Mesh -> False, DisplayFunction -> Identity]

compute a line :

{nx, ny} = Dimensions[gr[]];
xymesh = MeshRange /. gr[];
{{x1, x2}, {y1, y2}} = xymesh;
dx = (x2 - x1)/(nx - 1);
dy = (y2 - y1)/(ny - 1);
l1 = MapIndexed[{x1 + (First[#2] - 1)*dx, y1 + 30*dy, #} &, gr[[1,
30]]];

combine the two graphics:

Show[Graphics3D[Line[l1]], gr]

Regards
Jens
Alan Wetherby wrote:
>
> Hi - 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.
>
> Thanks for any help -- Alan
>
> Sent via Deja.com http://www.deja.com/