Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# This file: # http://angg.twu.net/GNUPLOT/a.dem.html # http://angg.twu.net/GNUPLOT/a.dem # (find-angg "GNUPLOT/a.dem") # Author: Eduardo Ochs <eduardoochs@gmail.com> # # Polygons as individual objects first, # then "splot with polygons" # # The vertices of an icosahedron are circular permutations of (0, ±1, ±ϕ) # where ϕ = (1 + √5) / 2 is the golden ratio. phi = (1.0 + sqrt(5.)) / 2. array v1 = [0., 1., phi] array v2 = [0., 1., -phi] array v3 = [0., -1., phi] array v4 = [0., -1., -phi] array v5 = [ 1., phi, 0.] array v6 = [ 1., -phi, 0.] array v7 = [ -1., phi, 0.] array v8 = [ -1., -phi, 0.] array v9 = [ phi, 0., 1.] array v10 = [ -phi, 0., 1.] array v11 = [ phi, 0., -1.] array v12 = [ -phi, 0., -1.] # define one point per vertex do for [i=1:12] { eval( sprintf("set label %d 'v%d' at v%d[1], v%d[2], v%d[3]", i,i,i,i,i )) } seq1 = "v5 v7 v10 v3 v9 v5" n = 1 do for [i=1:5] { vert1 = word(seq1,i) vert2 = word(seq1,i+1) eval( sprintf("set obj %d polygon from v1[1], v1[2], v1[3] to %s[1],%s[2],%s[3] to %s[1],%s[2],%s[3]", n, vert1, vert1, vert1, vert2, vert2, vert2) ) n = n+1 } set for [o=1:n] obj o polygon depthorder fs transparent solid 0.8 fc "gray75" set pm3d depthorder border lc "black" lw 2 set xrange [-2:2]; set yrange [-2:2]; set zrange [-2:2] set view equal xyz set view 30,30,1.5 unset border unset tics unset key unset label undefine v* undefine seq* set title "Faces of an icosahedron drawn as 20 individual objects" splot -10 pause -1 "Hit return to continue" # reset #: * (eepitch-shell) #: * (eepitch-kill) #: * (eepitch-shell) #: gnuplot a.dem # (find-node "(gnuplot)load") # (find-node "(gnuplot)labels" "set label") # (find-node "(gnuplot)object") # (find-node "(gnuplot)New_plot_styles_and_style_options") # (find-node "(gnuplot)New_plot_styles_and_style_options" "pm3d") # (find-node "(gnuplot)New_commands_and_command_options" "set view") # (find-node "(gnuplot)polygons") # (find-node "(gnuplot)Plotting") # (find-node "(gnuplot)Plotting" "splot") # (find-node "(gnuplot)Plotting" "splot" "can plot surfaces and contours") # (find-node "(gnuplot)3D_plots") # (find-node "(gnuplot)PM3D_plots") # (find-node "(gnuplot)PM3D_plots" "set pm3d depthorder") # (find-node "(gnuplot)pm3d") # Local Variables: # mode: gnuplot # End: