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

Re: Raising Contour Plot Graphics to 3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37299] Re: Raising Contour Plot Graphics to 3D
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Tue, 22 Oct 2002 04:47:35 -0400 (EDT)
  • References: <ap0821$c6n$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

David,
The following works for your example, but it does not always work (for
example  with
 ContourPlot[x*y, {x, -3, 0}, {y, 0, 3}, ColorFunction -> Hue])

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

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

Show[Show[Graphics3D[{SetPrecision[cgraphics3d, Infinity]},
    PolygonIntersections -> False, ImageSize -> 450], Lighting -> False],
  Lighting -> False]

--
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


"David Park" <djmp at earthlink.net> wrote in message
news:ap0821$c6n$1 at smc.vnet.net...
> 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: Re: Quadratic non-linear ODE.
  • Next by Date: Re: problem with Collect[] for long polynomial
  • Previous by thread: Raising Contour Plot Graphics to 3D
  • Next by thread: Re: Raising Contour Plot Graphics to 3D