Re: Converting 3D graphics to 2D polygons
- To: mathgroup at smc.vnet.net
- Subject: [mg86864] Re: Converting 3D graphics to 2D polygons
- From: "wyelen at gmail.com" <wyelen at gmail.com>
- Date: Mon, 24 Mar 2008 01:44:09 -0500 (EST)
- References: <fs4rq3$p7j$1@smc.vnet.net>
On Mar 23, 2:02 pm, Szabolcs Horv=E1t <szhor... at gmail.com> wrote: > In versions prior to 6 it was possible to convert 3D graphics to 2D like > this: > > Graphics@Graphics3D[Cuboid[{0, 0, 0}]] // Show > > This does not work any more in v6. (Note that I am not trying to embed > a 3D graphic into a 2D graphic, which can be done with Inset, but I > would like to get the 2D projection of 3D points, lines and polygons.) > > Is there a way to do this in v6? > > One can use an ugly hack like > ImportString@ExportString[Graphics3D[Cuboid[]], "PDF"] > but this will break up all the polygons to many little pieces. This topic sounds interesting, and I've ever thought about something similar. Wish the following example be helpful :) GraphicsGrid[{MapIndexed[Function[{meshf, coord}, Plot3D[(Pi - (x^2 + y^2))/4, {x, -5, 5}, {y, -5, 5}, PlotRange -> All, PlotPoints -> 40, MeshFunctions -> meshf, Mesh -> 40, RegionFunction -> Function[{x, y, z}, 3 > Abs[(x - 1)^2 + y + ((3*z)/4)^2] > 1], PlotStyle -> None] /. Graphics3D[x_, y__] :> Graphics[x, AspectRatio -> Automatic] /. GraphicsComplex[x_, y_, z__] :> GraphicsComplex[(Drop[#1, coord] & ) /@ x, y]], {#1 & , #2 & , #3 & }]}]