|
From: Timothée L. <tim...@lp...> - 2008-02-27 09:18:11
|
Daniel Farrell a écrit : > Hello, > > I was listing to the latest FLOSS Weekly Podcast (http://twit.tv/ > floss24) in which the topic was POV-Ray; an open source ray tracing > program. After some idle surfing I found that somebody has contributed > patches to gnuplot for a POV-Ray terminal; fancy ray-traced figures > found here, (http://t-kita.net/gnuplot_povrml/) and the submitted > patch here, (http://sourceforge.net/tracker/index.php?func=detail&aid=1262281&group_id=2055&atid=302055 > ). > > I cannot apply this patch successfully to the gnuplot-4.0.0 source? I > am going like this, > > cp -r gnuplot-4.0.0 gnuplot > cp -r gnuplot gnuplot-patch > mv povray.diff gnuplot > cd gnuplot > patch -p1 < povray.diff > > Anybody have gnuplot and POV-Ray working together? > > Cheers, > > Dan. > > > Hi Daniel, You have found a wonderful peace of work there ! The povray figures that are given in http://t-kita.net/gnuplot_povrml/ are simply gorgeous. The two authors, KITA Toshihiro and MIYATA Shigeo, have done something that others (I included) have probably dreamed of sometimes : let the terminal driver handle 3D instead of letting gnuplot core do all the work. Here POV-ray gives a very valuable addition compared to gnuplot 3D routines : it does true (isometric) perspective, plus realistic shading, something that is desperately lacking in gnuplot today. There is a patch on SF.net for adding perspective to gnuplot 3D routines, but the author did not work on it until inclusion in CVS, and as far as shading (or, plot points as little spheres, etc), I had never seen such a thing for gnuplot. There's at least one thing that this work has not achieved according to the figures : it's pm3d coloring, which is very important for 3d data visualization. Perspective + shading + pm3d coloring of surfaces plots would be a great achievement. Let me add that POV-ray, like openGL, is probably able to draw polygons colored with gradients, something that is very difficult or impossible with most 2D drawing API (Cairo, for example, cannot do it). Gradients coloring makes surface plots much nicer, and gnuplot already has the mechanisms to do that, but they are used by a single terminal driver, namely the SVGA one, the one that Ethan never achieved to see working, the one that is also presumably unsecure. Too bad, isn't it ? Let's talk about the code now. You mention the following patch : http://sourceforge.net/tracker/index.php?func=detail&aid=1262281&group_id=2055&atid=302055 . This is not the patch that gave the POV-ray figures. This patch on SF.net only does 2D rendering, as the author, Gaël Varoquaux, explains on the page: > This patch is not terribly iseful as long as the 2D/3D code > in gnuplot is not refactored. This patch only implements the > 2D drawing API (as there is no 3D API currently). However, the right patch is provided in http://t-kita.net/gnuplot_povrml/gnuplot_povrml-0.3.patch First, it is offered as a public domain work, so there is no license issue. Good. It's not really large: > # diffstat gnuplot_povrml-0.3.patch > src/plot2d.c | 21 ++ > src/plot3d.c | 19 + > src/povray.c | 538 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > src/term.h | 6 > src/vrml.c | 399 +++++++++++++++++++++++++++++++++++++++++ > term/povray.trm | 152 +++++++++++++++ > term/vrml.trm | 151 +++++++++++++++ > 7 files changed, 1286 insertions(+) However, after a quick glance at the patch, it's not in a state that would allow it to be included immediately. The authors have bypassed gnuplot terminal system almost completely, and only 'splot' seems to be possible. Steps to make that patch better : - make it work with gnuplot CVS, - identify key functions to design an API to extend the current terminal one in gnuplot. - get full 2D + 3D (maybe mix this patch with Gaël's one) Thanks Daniel for making this work known ! Best regards, Timothée Lecomte |