gnuplotcomputational-geometryconvex-hull

Convex hull figure from vertice points


I would like to make convex hull figure giving Gnuplot the vertices that join the surfaces of the figure.

I have been testing, but I have not any clear way to make this.

I can plot the points with this script:

set encoding iso_8859_1
set terminal postscript eps enhanced color  size 4.0in,4.0in #"Helvetica" 16
set output "RG1.eps"
set view 50,220
unset colorbox
splot "convex1.dat" with lines notitle ,\
"convex1.dat" u 1:2:3 with points palette pointsize 3 pointtype 7

where convex1.dat contains these points

0   0   0
0   0   0.285957
0   0.285957    0.285957
0   0.3812378724    0.1906189362
0   0.571914    0
0.1906761276    0.3812378724    0.1906189362
0.285957    0.285957    0.285957
0.571914    0   0
0.571914    0   0.285957 

The representation of this script is:

enter image description here

I can make the convex hull with these points with the Mathematica environment and create the type of figure I am looking for:

enter image description here

The question is: how can I make a convex hull, like the Mathematica figure, with Gnuplot, and how could I use transparency to make figures with comparing two convex hulls with the same axis?


Solution

  • Gnuplot is primarily a renderer for structured numerical data; it's not much of a mathematical processing system, or a renderer for geometry data. There's the pm3d style for splot which allows you to plot arbitrary polygon collections, but it doesn't do hidden surface removal, let alone complex renderings based on the intersection of multiple polygons. In fact, the documentation itself says:

    Gnuplot is not [a] virtual reality tool to calculate intersections of filled polygon meshes.

    For this sort of thing, you'll want to use an actual mathematical processing package (like Mathematica!) which can output to a vector format, and then use that directly rather than going through Gnuplot.