MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: i don't want intersection

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28777] RE: [mg28768] i don't want intersection
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 12 May 2001 20:18:11 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Borut,

My DrawingCube package, available at my web site, has a routine
DrawContourLines which will do what your wish. There is also a tutorial and
examples of using DrawContourLines in Section 3, DrawingCube Package
Routines, DrawContourLines. You have to define the function as f[x,y]:=...,
and then use that in the routine. There is also an option DrawContourOffset
which allows you to offset the contours slightly, in any direction, so as to
avoid intersections. If you use enough plot points for both the surface and
the contour lines you can usually get a fairly snug fit without
intersections.

If you wish to do it yourself you essentially have to do a ContourPlot,
convert the output to Graphics, extract the contour lines, and then add the
z value to each point. Then add a small offset to each point. Then combine
the lines with a plot of the surface. It is a lot easier with DrawingCube
because the package is designed to make it easy to combine various elements
into one piece of graphics.

Here is a sample piece of code, using the package, that draws contour lines
on the surface
Sin[x y]. Sometimes it looks nicer to turn the Lighting off and color the
surface with a uniform color. That's what I did here. You definitely want to
use EdgeForm[] to get rid of polygon edges because they will interfere with
the contour lines.

Needs["Graphics`DrawingCube`"]
Needs["Graphics`Colors`"]

f[x_, y_] := Sin[x y]

Show[Graphics3D[
 {EdgeForm[], LightBlue,
  Draw3D[f[x, y], {x, -Pi/2, Pi/2},
      {y, -Pi/2, Pi/2}, PlotPoints -> 31],
  Red,
  DrawContourLines[f[x, y], {x, -Pi/2, Pi/2}, {y, -Pi/2, Pi/2},
      Contours -> Range[-1, 1, 0.05], DrawContourOffset -> {0, 0, 0.01},
      PlotPoints -> 31]}],
   AspectRatio -> Automatic,
   PlotRange -> All, {ImageSize -> 450, Lighting -> False}];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

> From: Borut L [mailto:borut at email.si]
To: mathgroup at smc.vnet.net
>
> Good day,
>
> I made a function which displays 3D contour lines onto Surface Graphics.
> It's pretty neat. There is a problem though. The contours "fit"
> so perfecty
> onto the surface that they [are] a part of the surface - so half visible
> half hidden by the surface - they seem to intersect.
>
> I also came across an article in old Mathematica Journal which
> explains the
> method and also mentions the problem but do not address it in details.
>
> So I ask you mighty Mathematicians if you know a simple solution. ?
>
> Is there even simpler way to make 3D contours... please point me to an
> eventual news thread. ?
>
>
> Thanks a lot,
>
> Borut Levart,
>
>
> a physics student from Slovenia
>
>
>



  • Prev by Date: Re: How to make curved arrows?
  • Next by Date: Re: Replacing Parts of a List
  • Previous by thread: i don't want intersection
  • Next by thread: Re: i don't want intersection