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/