File: hidden2.dem

package info (click to toggle)
gnuplot 6.0.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,940 kB
  • sloc: ansic: 95,319; cpp: 7,590; makefile: 2,470; javascript: 2,328; sh: 1,531; lisp: 664; perl: 304; pascal: 191; tcl: 88; python: 46
file content (89 lines) | stat: -rw-r--r-- 2,341 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#
# PM3D surfaces are not fully included in the calculation of hidden line removal.
# Older versions of gnuplot allowed you to approximate the correct occlusion
# by drawing the surface twice, once "with pm3d" to produce the surface you
# want to show, and once "with lines lt -2" to include the same surface in
# hidden3d calculations but drawn with invisible lines.
# gnuplot version 5 does the approximation for you so the extra copy of the
# surface is no longer necessary.
#
set isosamples 25,25
set xyplane at 0
unset key

set palette rgbformulae 31,-11,32
set style fill solid 0.5
set cbrange [-1:1]

set title "Mixing pm3d surfaces with hidden-line plots"

f(x,y) = sin(-sqrt((x+5)**2+(y-7)**2)*0.5)

set hidden3d front
splot f(x,y) with pm3d, x*x-y*y with lines lc rgb "black"

pause -1 "Hit return to continue"
reset

#
# Image surfaces are similarly overlooked in the calculation of hidden line removal.
# I.e. this demo doesn't actually work yet.  It's here for testing.
#
set isosamples 25,25
set xyplane at 0
unset key

set cbrange [0:255]
set palette cubehelix

set title "Mixing image surface with hidden-line plots"

set hidden3d front
splot 'blutux.rgb' binary array=(128,128) flip=y format='%uchar%uchar%uchar' origin=(-10,-10,0) dx=0.156 dy=0.156 using ($1+$2+$3)/3 with image, \
x*x-y*y with lines lc rgb "black"

pause -1 "Hit return to continue"
reset
#
# Another example of pm3d hidden surface removal,
# this time using pm3d depth-ordering
#
set multiplot title "Interlocking Tori"
set title "PM3D surface\nno depth sorting"

set parametric
set urange [-pi:pi]
set vrange [-pi:pi]
set isosamples 50,20

set origin -0.02,0.0
set size 0.55, 0.9

unset key
unset xtics
unset ytics
unset ztics
set border 0
set view 60, 30, 1.5, 0.9
unset colorbox

set pm3d scansbackward
splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d, \
      1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d

set title "PM3D surface\ndepth sorting"

set origin 0.40,0.0
set size 0.55, 0.9
set colorbox vertical user origin 0.9, 0.15 size 0.02, 0.50
set format cb "%.1f"

set pm3d depthorder
splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d, \
      1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d

unset multiplot

pause -1 "Hit return to continue"

reset