MathGroup Archive 2011

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

Search the Archive

Re: Questions concerning export of 3d plots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118444] Re: Questions concerning export of 3d plots
  • From: Alexey <lehin.p at gmail.com>
  • Date: Thu, 28 Apr 2011 06:36:00 -0400 (EDT)
  • References: <ip8o51$peu$1@smc.vnet.net>

> In Mathematica
> (and OpenGL, ...) you say something like
>
> Polygon[{p1,p2,...}, VertexColors->{c1,c2,...}]
>
> and specify the color at each vertex. The whole polygon is then drawn by
> interpolating the colors of the vertices at each position. It
> "seems" (and here I'm really not sure) that either the PDF file format
> does not support this or it needs the hell of space for this.

In really recent versions of PDF and EPS fully support vertex colors.
See this thread:

http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/f2327233ca2faa9f/2dad0f66979ad134

and this video (14 Mb):

http://research.microsoft.com/en-us/um/people/jiansun/videos/GMesh_336.wmv

> So if you have for instance Inkscape installed to convert from svg to
> pdf, then you could compare these 3 pdf files:
>
> ExportSVG[filename_String, gr : (Graphics3D[___] | Graphics[___])] :=
>
>   Block[{svg = ExportString[Normal[gr], "SVG"], stream},
>   Export[filename, StringReplace[svg,
>     Shortest[
>       StringExpression["<polygon stroke=\"none\" fill=", color__,
>        " points=", pt__, "/>"]] :>
>      "<polygon stroke=" ~~ color ~~ " stroke-width=\"0.6px\" fill=" ~~
>        color ~~ " points=" ~~ pt ~~ "/>"], "Text"]
>   ]
>
> gr = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, Mesh -> None,
>    MaxRecursion -> 5, PlotPoints -> 20, BoundaryStyle -> None,
>    ImageSize -> 500];
>
> Export["grMma1.pdf", gr]
> Export["grMma2.pdf", gr, "AllowRasterization" -> False]
> ExportSVG["grInk.svg", gr]
>
> Run["inkscape", "-D", "-A grInk.pdf", "grInk.svg"]
>
> On my machine I have sizes:
>
> 17M grMma1.pdf
> 860K grMma2.pdf
> 1.1M grInk.pdf
>
> and the last pdf looks pretty ok.

Very interesting! Thank you for sharing!

You can be also interested in Jens Nockel's thoughts on the matter:

http://pages.uoregon.edu/noeckel/MathematicaGraphics.html#ExportShading


Alexey


  • Prev by Date: Re: Output Precision Exploration
  • Next by Date: Re: Output Precision Exploration
  • Previous by thread: Re: Questions concerning export of 3d plots
  • Next by thread: Color of Hyperlinks