MathGroup Archive 2001

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

Search the Archive

Re: 2D to 3D graphics?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31337] Re: 2D to 3D graphics?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 29 Oct 2001 02:23:21 -0500 (EST)
  • References: <9rb87l$5m4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ingolf,

ToThreeD[Graphics[pr_,opts___] ]:=
Graphics3D[pr/.
    {(h:(Line|Polygon))[lst_]:> h[Append[#,0]&/@lst],
    Text[txt_,{x__},r___]:> Text[txt,{x,0},r] (*offset and orientation must
not be changed*)
}, opts];

Example

ToThreeD[
    Graphics[{
        Hue[.5],Thickness[.02],Line[{{0,0},{1,1}}],
        Hue[.3],Polygon[{{0,0},{2,4},{2,6}}],
        Hue[0], Text["TEXT",{1,1},{-1,-1}]},
        Epilog-> {Hue[.7],Line[{{0,1},{1,0}}]},
        Lighting->False
]];

Show[%]

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

"Ingolf Dahl" <f9aid at fy.chalmers.se> wrote in message
news:9rb87l$5m4$1 at smc.vnet.net...
> Dear Mathgroup,
> Is there any way to transform a general (2D) Graphics objects to a
> Graphics3D object (with zero z coordinates)? I have a feeling that it is
> either very simple or very complicated. Have I missed something in the
Book?
>
> Then I of course also want to be able to rotate the graphics in three
> dimensions, by RotateShape, but that is maybe to ask too much.
>
> I have experimented a bit with StackGraphics, since it seems to take 2D
> graphics as input, and 3D as output, but have not yet managed to
manipulate
> the output of StackGraphics in any way.
>
> Ingolf Dahl
> Chalmers University
>
>




  • Prev by Date: Re: remote kernel via ssh
  • Next by Date: Re: several messages
  • Previous by thread: Re: 2D to 3D graphics?
  • Next by thread: Reading 16-bit TIFF Images into Mathematica