|
#
# Debugging / test code for Delaunay triangulation, χ-shapes,
# and generation of concave hulls.
#
if (!strstrt(GPVAL_COMPILE_OPTIONS, "+CHI_SHAPES")) {
print "This copy of gnuplot does not support concave hulls"
exit # return to caller
}
set title "Concave hulls" offset 0,-2 font ":Bold"
if (!exists("N")) { N = 17 }
set sample N*10
set print $DATA
do for [i=1:N] {
print rand(0), rand(0)
print rand(0) + 0.3, rand(0) + 0.5
print rand(0) + 0.6, rand(0) - 0.5
print rand(0) + 1.2, rand(0)
}
unset print
set xrange [-.5 : 2.5]
set yrange [-.5 : 2.0]
set isotropic
set key invert
set tics 0.5 nomirror rangelimited
set border 3
plot $DATA using 1:2 convexhull with lines lw 2 lt 4 title "convex", \
$DATA using 1:2 concavehull with lines lc "blue" title "concave", \
$DATA using 1:2 with points pt 7 ps 2 lc bgnd notitle, \
$DATA using 1:2:(sprintf("%d",int($0))) with labels font ",9" notitle, \
keyentry title sprintf("chi_length = %.2f",GPVAL_CHI_LENGTH) noenhanced
Click here for minimal script to generate this plot
|