Re: Adding markers on the surface of a Plot3D?

• To: mathgroup at smc.vnet.net
• Subject: [mg89356] Re: Adding markers on the surface of a Plot3D?
• From: "David Park" <djmpark at comcast.net>
• Date: Sat, 7 Jun 2008 02:57:03 -0400 (EDT)
• References: <g2b4o8\$nm2\$1@smc.vnet.net>

```Here is a practice function.

f[x_, y_] := x^2 - 2 x y^2 + y^2

The following draws only two mesh lines at specific values. MeshStyle is
used to give a style to the lines.

Plot3D[f[x, y], {x, 0, 1}, {y, 0, 1},
PlotStyle -> ColorData["Legacy"]["DarkSeaGreen"],
Mesh -> {{.5}, {.5}},
MeshStyle -> Directive[Black, AbsoluteThickness[2]],
Lighting -> "Neutral"]

The following does the same thing, only now the style is embedded directly
with each mesh line.

Plot3D[f[x, y], {x, 0, 1}, {y, 0, 1},
PlotStyle -> ColorData["Legacy"]["DarkSeaGreen"],
Mesh ->
{{{.5, Directive[Black, AbsoluteThickness[2]]}}, {{.5,
Directive[Black, AbsoluteThickness[2]]}}},
Lighting -> "Neutral"]

The following draws a set of mesh lines in red and then draws two special
mesh lines in thick black.

Plot3D[f[x, y], {x, 0, 1}, {y, 0, 1},
PlotStyle -> ColorData["Legacy"]["DarkSeaGreen"],
Mesh ->
{{Sequence @@ Table[{x, Red}, {x, .1, .9, .1}], {.5,
Directive[Black, AbsoluteThickness[2]]}}, {Sequence @@
Table[{x, Red}, {x, .1, .9, .1}], {.5,
Directive[Black, AbsoluteThickness[2]]}}},
Lighting -> "Neutral"]

The following uses Presentations to draw the special lines as extra curves.
We can just combine all the various items in one Draw3DItems statement.

Needs["Presentations`Master`"]

Draw3DItems[
{Legacy@DarkSeaGreen,
Draw3D[f[x, y], {x, 0, 1}, {y, 0, 1}],
Black, AbsoluteThickness[2],
ParametricDraw3D[{.5, y, f[.5, y] + .01}, {y, 0, 1}],
ParametricDraw3D[{x, .5, f[x, .5] + .01}, {x, 0, 1}]},
NeutralLighting[.0, .5, .1],
Axes -> True,
BoxRatios -> {1, 1, 1/2},
ImageSize -> 350]

The following displays the special mesh lines dynamically using a Slider2D.

Manipulate[
Draw3DItems[
{Legacy@DarkSeaGreen,
Draw3D[f[x, y], {x, 0, 1}, {y, 0, 1}],
Black, AbsoluteThickness[1],
ParametricDraw3D[{First[u], y, f[First[u], y] + .02}, {y, 0, 1}],
ParametricDraw3D[{x, Last[u], f[x, Last[u]] + .02}, {x, 0, 1}]},
NeutralLighting[.0, .5, .1],
Axes -> True,
BoxRatios -> {1, 1, 1/2},
ImageSize -> 350],
{u, {0, 0}, {1, 1}}]

The following is a fancier presentation using a DynamicModule and a Grid
containing the Slider2D and digital readout. Dynamic coordination of
graphical and digital information is a wonderful method for exploring a
mathematical relation. It's really like having your cake and eating it too.
You can never get this on a dead static printed page.

DynamicModule[{u = {.5, .5}},
Column[{
(* Digital control and readout *)
Panel@Grid[{
{Item[Style["Dynamic Surface Marker", 16], Alignment -> Center],
SpanFromLeft},
{Slider2D[Dynamic[u]], {x, y} == Dynamic[u]},
{SpanFromAbove, HoldForm[f[x, y]] == Dynamic[f @@ u]}
},
ItemSize -> 10,
Alignment -> Left],
(* Graphics *)
Draw3DItems[
{Legacy@DarkSeaGreen,
Draw3D[f[x, y], {x, 0, 1}, {y, 0, 1}],
Orange,
Dynamic@Sphere[Flatten[{u, f @@ u}], .02]},
NeutralLighting[.0, .5, .1],
Axes -> True,
PlotRange -> {{0, 1}, {0, 1}, {0, 1}},
BoxRatios -> {1, 1, 1/2},
ImageSize -> 350]
}]
]

--
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

"AES" <siegman at stanford.edu> wrote in message
news:g2b4o8\$nm2\$1 at smc.vnet.net...
> I'd like to highlight the two mesh lines that pass through a certain
> central point -- let's call it the point {xc,yc} -- on a Plot3D by
> thickening those two lines relative to the other mesh lines, or giving
> them a distinctive color, or . . .
>
> Or put a dot on the surface at the point {xc, yc, f[xc,yc]} to identify
> this location on the surface . . .
>
> Or run a vertical "post" up through that point using something like
> Line[{xc, yc, 0}, {xc, yc, 2*f[xc,yc]}}] (with the part of the post
> below the surface not being seen if you look at the surface from
> above) . . .
>
> I think I've so far tested and confirmed every possible way in which
> each of these tasks _can't_ be done . . .
>
> [And would someone want to help me understand _why_  the
> Show[ - - - - -] command (followed by a semicolon) no longer works, or
> can no longer be used, as one of a sequence of multiple expressions
> within a longer cell?  And why it can't even have a semicolon following
> it as the last line in a cell?  I just can't envision the logic of why
> this was a necessary (or optional?) interface design decision -- isn't
> Show[---] an expression?]
>

```

• Prev by Date: Re: Re: Re: Visualization of a list of 3D points
• Next by Date: Re: Integral Questions
• Previous by thread: Re: Re: Re: Re: Adding markers on the surface of a Plot3D?
• Next by thread: Re: Adding markers on the surface of a Plot3D?