|
From: Ethan A M. <sf...@us...> - 2016-01-22 18:36:11
|
On Friday, 22 January, 2016 12:41:39 folkert wrote: > > >At http://t-kita.net/gnuplot_povrml/ I found a patch for gnuplot to add > > >povray and/or vrml output. Especially the last one I think is useful > > >because it allows one to easily view for example an splot from all > > >kinds of directions. > > >Now I'm wondering: what does it take to get it to be included in the > > >main gnuplot distribution? > > > > That looks like code outside the project, no license infringement > > technically or otherwise. Patch and compile. > > Yes but what does it take to get it integrated in the main gnuplot > distribution? I do not think that this patch is suitable for inclusion in gnuplot. The web page you link to gives a misleading impression of what the patch actually does. Let me explain. Gnuplot can be viewed as having 3 layers. (1) An input layer in which data enters the program. Currently the program can read ascii files (include csv format files), binary files, and some specific image formats. Once the data enters the program it is manipulated by ... (2) A data-processing layer. This is primarily the "plot" and "splot" commands, but also "fit" and "stats". These latter two options output analysis results and stop. The two plotting commands feed their output though ... (3) A third layer consisting of various "terminals" that format the composed plot for a specific output device. It is important to note that the interface from layer 2 to layer 3 passes only 2D coordinates. This is a historical artifact. Gnuplot was originally designed in the days of of pen plotters and character cell terminals. Today we just assume that graphics is done in 3D, but that was not true 40 years ago. The important thing is that all of the various plot styles (lines, dots, boxes, surfaces, histograms, etc) are implemented in layer 2. You can mix-and-match any choice of plot style (layer 2) with any output device (layer 3). Of course a hidden-surface plot displayed to "set term dumb" won't look very good, but you can do it if you want. OK, now to the vrml/povray patch. Although the patch claims to provide new terminals (vrml and povray), this is not true and would not be possible because a gnuplot terminal only knows about 2D coordinates. Instead it inserts a new chunk of code into layer 2 that dumps a bunch of vrml or povray header text, a formatted version of selected coordinates that were previously read in by layer 1, a trailing bunch of vrml text, and that's it. It mostly ignores all the gnuplot plot styles. I won't say this is useless. As the web page shows, you can create certain 3D plots this way. But I will say that if this is what you want to do, there are better ways to do it. Most of those better ways don't involve gnuplot at all, but if for whatever reason you want the solution to be based on gnuplot then a better approach would be to write a separate script (your choice of scripting languages) that dumps - the vrml/povray header lines - tabular output from gnuplot run as a separate process - the vrml/povray trailing lines This would have many advantages, not least that you could tweak the script without having to patch and recompile gnuplot. It would still be tricky to dump 3D coordinates, but I think it might be possible using the plot style "with table" in version 5. If not, perhaps a patch to extend that capability would be appropriate. If this works at all it would be useful for more things than just the hypothetical vrml script. Ethan > > > Folkert van Heusden > > |