Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Raising Contour Plot Graphics to 3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37279] Raising Contour Plot Graphics to 3D
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 21 Oct 2002 02:30:29 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear MathGroup,

I would like to raise the graphics generated by a contour plot to 3D. But
there is a problem. Here is a simple example. Here I make a simple contour
plot. I then have two cases of converting the graphics to 3D. In the first
case I just keep the surface in the xy-plane, simply adding a 0 z
coordinate. In the second case I do a simple affine transformation. In both
cases some of the contour regions are improperly rendered. Notice that the
ContourGraphics has to be first converted to Graphics.

cplot = ContourPlot[x y, {x, -3, 3}, {y, -3, 3}, ColorFunction -> Hue];

cgraphics3d =
    First[Graphics[cplot]] /. {x_?NumericQ, y_?NumericQ} -> {x, y, 0};

cgraphics3d =
    First[Graphics[cplot]] /. {x_?NumericQ,
          y_?NumericQ} -> {2x + y, -x + 2y, -1.5x + y};

Show[Graphics3D[
      {cgraphics3d},
      Lighting -> False,
      ImageSize -> 450]];

The reason that this problem occurs is that Mathematica does not draw
nonintersecting Polygons for each region, but instead will overlay smaller
regions on top of larger regions. If we look at the Polygons that
ContourPlot produces, after being converted to Graphics, we see that each
one goes to a corner of plot domain.

Cases[First[Graphics[cplot]], _Polygon, Infinity]

The result is that when the graphics are converted to 3D, with slight
numerical errors, perhaps in the rendering, some of the Polygons can
interlace and produce an incorrect plot.

Is there any remedy for this problem?

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



  • Prev by Date: Comparison of Mathematica on Various Computers
  • Next by Date: Re: Bad Alignment of Y Axes
  • Previous by thread: Comparison of Mathematica on Various Computers
  • Next by thread: Re: Raising Contour Plot Graphics to 3D