Re: Raising Contour Plot Graphics to 3D
- To: mathgroup at smc.vnet.net
- Subject: [mg37314] Re: Raising Contour Plot Graphics to 3D
- From: atelesforos at hotmail.com (Orestis Vantzos)
- Date: Wed, 23 Oct 2002 02:56:46 -0400 (EDT)
- References: <ap0821$c6n$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
The following function takes a ContourGraphics object and returns a
list of 3D primitives by raising each contour slightly. The polygons
are still overlapping but smaller ones are on top the larger ones (the
dz defines the amount of elevation).
contour2contour3D[cont_ContourGraphics, dz_:.001] :=
Module[{primitives = First[-Graphics-], to3D},
With[{bottomHue = First[Cases[primitives, Hue[c_] -> c, 2]]},
to3D[{Hue[c_], rst__}] :=
{Hue[c], rst} /. {(x_)?NumericQ, (y_)?NumericQ} -> {x, y, dz
Abs[c - bottomHue]}];
to3D /@ primitives]
Now, to transform the coordinates you should use a 3D affine
transformation, not a 2D. Use a 3D affine transformation that reduces
to the 2D you want for flat shapes.
Orestis