Re: Contour curves & sections onto a surface

• To: mathgroup at smc.vnet.net
• Subject: [mg22206] Re: Contour curves & sections onto a surface
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Fri, 18 Feb 2000 02:34:42 -0500 (EST)
• References: <88do7l\$12q@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Murray,
I attach in the email version of this posting my package
ContourPlotOnSurface
I copy some of the usage messages below.

(If anyone else wants the package please let me know)

It cannot be used for slicing but we can build contours of an arbitray
functions of the variables or paramertes on the surfacec (and by drawing
only the contours we can add the contours of several functions to a
surface - we have to convert the graphics produced to Graphics3D by wrapping
them  in Graphics3D and evaluating).

Incidentally, it is better to lift the contours towards the view point.

An earlier version of this appeared my article "Lifting the Contours",
Mathematica in Education and Research, Volume 3, No 3, Summer 1994

I would welcome suggestions - writing the above is already tempting me to

------------------------------

ContourPlotOnSurface is a package with two functions,
Plot3DContoured,gives a Plot3D surface with contour lines of any function
ParametricPlot3DContoured, gives a ParametricPlot3D surface with contour
lines of a function of the parameters added;
extensive options allow variations to be made.

ParametricPlot3DContoured[{x,y,z,w},{u,umin,umax},{v,vmin,vmax}, opts], for
expressions x,y,z,w in u,v, gives the contour lines of w on the surface
given by ParametricPlot3D[{x,y,z},{u,umin,umax},{v,vmin,vmax}, opts].
ParametricPlot3DContoured[{x,y,z},{u,umin,umax},{v,vmin,vmax}, opts] gives
the same as ParametricPlot3D[{x,y,z,z},{u,umin,umax},{v,vmin,vmax}, opts].
The contour styles are controlled by the options ContourStyles (as for
ContourPlot) and a new option, ContourColorFunction except that color
directives must usually be given separately by the option
ContourColorFunction (but see the entry for ContourColorFunction). The
amount by which contours are moved towards the viewpoint to avoid parts of
them being hidden by the surface is controlled by the option ContourLift. .

Options:
ParametricPlot3DContoured has the union of the options of ParametricPlot3D,
and ContourPlot as options, together with three new options: ContourLift,
ContourColorFunction and Surface.

Examples:
ParametricPlot3DContoured[{t Sin[s] Cos[t], t Cos[s] Cos[t], Sin[t]},
{s,0,2Pi},{t,-Pi/2, Pi/2} ]

ParametricPlot3DContoured[{t Sin[s] Cos[t], t Cos[s] Cos[t], Sin[t],s+t},
{s,0,2Pi},{t,-Pi/2, Pi/2} ]

For more examples please enter ?ParametricPlot3DContouredExamples.

Plot3DContoured[{z,w},{u,umin,umax},{v,vmin,vmax}, opts], for expressions z,
w in u,v, gives the contour lines of w on the surface given by
Plot3D[z,{u,umin,umax},{v,vmin,vmax}, opts].
Plot3DContoured[z,{u,umin,umax},{v,vmin,vmax}, opts] gives the same as
Plot3DContoured[{z,z},{u,umin,umax},{v,vmin,vmax}, opts].
Options:
Plot3DContoured has the union of the options of Plot3D and ContourPlot as
options, together with three new options  ContourLift, ContourColorFunction
and Surface.
The contour styles are controlled by the options ContourStyles (as for
ContourPlot) except that color directives must usually be given separately
by the new option ContourColorFunction (but see the entry for
ContourColorFunction). The amount by which contours are moved towards the
viewpoint to avoid parts of them being hidden by the surface is controlled
by the option ContourLift.

Examples:
Plot3DContoured[2x^4 - y^4, {x,-1,1},{y,-1,1},Axes -> True]

Plot3DContoured[{2x^4 - y^4, x y}, {x,-1,1},{y,-1,1},Axes -> True]

For more examples please enter ?Plot3DContouredExamples.

"Murray Eisenberg" <murray at math.umass.edu> wrote in message
news:88do7l\$12q at smc.vnet.net...
> Want to plot a surface, graph of f[x, y], and then, on the surface,
> draw:
>
>   (1) at the actual z-height, the contour curve for that height; and/or
>
>   (2) at the actual value x = x0, draw on the curve the section
> ("slice") of the curve f[x0, y] (and similarly for fixing y = y0).
>
> I know how to do all that, I think.  But I want the result to look just
> right.  To do that, the curves have to be a different color, or possibly
> thicker, but -- most important -- be displaced a bit from the actual
> surface so as to be distinctly visible.
>
> Somewhere -- in this newsgroup, on the Wolfram web site, in a
> Mathematica book, or in one of journals (Mathematica in Research and
> Education, The Mathematica Journal) -- I once saw a very cleanly done
> implementation that produces very nice results.
>
> Can anyone supply a pointer to that?
>
> --
> Murray Eisenberg                     murray at math.umass.edu
> Mathematics & Statistics Dept.       phone 413 549-1020 (H)
> Univ. of Massachusetts                     413 545-2859 (W)
> Amherst, MA 01003-4515
>

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

```

• Prev by Date: Re: algorithm to generate 1/f noise
• Next by Date: Re: Selecting numbers with all odd digits
• Previous by thread: Re: Contour curves & sections onto a surface