This file is indexed.

/usr/share/doc/libplplot12/examples/tcl/x28.tcl is in plplot-tcl-dev 5.10.0+dfsg2-0.1ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# $Id: x28.tcl 11680 2011-03-27 17:57:51Z airwin $
#
#	plmtex3, plptex3 demo.
#
#   Copyright (C) 2007 Alan W. Irwin
#
#  This file is part of PLplot.
#
#  PLplot is free software; you can redistribute it and/or modify
#  it under the terms of the GNU Library General Public License as published
#  by the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  PLplot is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU Library General Public License for more details.
#
#  You should have received a copy of the GNU Library General Public License
#  along with PLplot; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
#

#
# Demonstrates plotting text in 3D.
#

proc x28 {{w loopback}} {

    # Choose these values to correspond to tick marks.
    set XPTS 2
    set YPTS 2
    set NREVOLUTION 16
    set NROTATION 8
    set NSHEAR 8

    set pi $::PLPLOT::PL_PI

    set xmin 0.
    set xmax 1.0
    set xmid [expr {0.5*($xmax + $xmin)}]
    set xrange [expr {$xmax - $xmin}]
    set ymin 0.
    set ymax 1.0
    set ymid [expr {0.5*($ymax + $ymin)}]
    set yrange [expr {$ymax - $ymin}]
    set zmin 0.
    set zmax 1.0
    set zmid [expr {0.5*($zmax + $zmin)}]
    set zrange [expr {$zmax - $zmin}]

    set ysmin [expr {$ymin + 0.1 * $yrange}]
    set ysmax [expr {$ymax - 0.1 * $yrange}]
    set ysrange [expr {$ysmax - $ysmin}]
    set dysrot [expr {$ysrange / ( $NROTATION - 1 )}]
    set dysshear [expr {$ysrange / ( $NSHEAR - 1 )}]
    set zsmin [expr {$zmin + 0.1 * $zrange}]
    set zsmax [expr {$zmax - 0.1 * $zrange}]
    set zsrange [expr {$zsmax - $zsmin}]
    set dzsrot [expr {$zsrange / ( $NROTATION - 1 )}]
    set dzsshear [expr {$zsrange / ( $NSHEAR - 1 )}]

    # p1string must be exactly one character + the null termination
    # character.
    set p1string "O"
    set pstring "The future of our civilization depends on software freedom."
    # Allocate and define the minimal x, y, and z to insure 3D box
    matrix x f $XPTS
    matrix y f $YPTS
    matrix z f $XPTS $YPTS

    for {set i 0} {$i < $XPTS} {incr i} {
	x $i = [expr {$xmin + double($i) * ($xmax-$xmin)/ double($XPTS-1)}]
    }

    for {set j 0} {$j < $YPTS} {incr j} {
	y $j = [expr {$ymin + double($j) * ($ymax-$ymin)/ double($YPTS-1)}]
    }

    for {set i 0} {$i < $XPTS} {incr i} {
	for {set j 0} {$j < $YPTS} {incr j} {
	    z $i $j = 0.
	}
    }

    # Page 1: Demonstrate inclination and shear capability pattern.

    $w cmd pladv 0
    $w cmd plvpor -0.15 1.15 -0.05 1.05
    $w cmd plwind -1.2 1.2 -0.8 1.5
    $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45.

    $w cmd plcol0 2
    $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
	"b" "" [expr {$ymax-$ymin}] 0 \
	"bcd" "" [expr {$zmax-$zmin}] 0

    # z = zmin.
    $w cmd plschr 0. 1.0
    for  {set i 0} {$i < $NREVOLUTION} {incr i} {
	set omega [expr {2.*$pi*double($i)/double($NREVOLUTION)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set x_inclination [expr {0.5*$xrange*$cos_omega}]
	set y_inclination [expr {0.5*$yrange*$sin_omega}]
	set z_inclination 0.
	set x_shear [expr {-0.5*$xrange*$sin_omega}]
	set y_shear [expr {0.5*$yrange*$cos_omega}]
	set z_shear 0.
	$w cmd plptex3 \
	    $xmid $ymid $zmin \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.0 "  revolution"
    }

    # x = xmax.
    $w cmd plschr 0. 1.0
    for {set i 0} {$i < $NREVOLUTION} {incr i} {
	set omega [expr {2.*$pi*double($i)/double($NREVOLUTION)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set x_inclination 0.
	set y_inclination [expr {-0.5*$yrange*$cos_omega}]
	set z_inclination [expr {0.5*$zrange*$sin_omega}]
	set x_shear 0.
	set y_shear [expr {0.5*$yrange*$sin_omega}]
	set z_shear [expr {0.5*$zrange*$cos_omega}]
	$w cmd plptex3 \
	    $xmax $ymid $zmid \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.0 "  revolution"
    }

    # y = ymax.
    $w cmd plschr 0., 1.0
    for {set i 0} {$i < $NREVOLUTION} {incr i} {
	set omega [expr {2.*$pi*double($i)/double($NREVOLUTION)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set x_inclination [expr {0.5*$xrange*$cos_omega}]
	set y_inclination 0.
	set z_inclination [expr {0.5*$zrange*$sin_omega}]
	set x_shear [expr {-0.5*$xrange*$sin_omega}]
	set y_shear 0.
	set z_shear [expr {0.5*$zrange*$cos_omega}]
	$w cmd plptex3 \
	    $xmid $ymax $zmid \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.0 "  revolution"
    }
    # Draw minimal 3D grid to finish defining the 3D box.
    $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]

    # Page 2: Demonstrate rotation of string around its axis.
    $w cmd pladv 0
    $w cmd plvpor -0.15 1.15 -0.05 1.05
    $w cmd plwind -1.2 1.2 -0.8 1.5
    $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45.

    $w cmd plcol0 2
    $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
	"b" "" [expr {$ymax-$ymin}] 0 \
	"bcd" "" [expr {$zmax-$zmin}] 0

    # y = ymax.
    $w cmd plschr 0. 1.0
    set x_inclination 1.
    set y_inclination 0.
    set z_inclination 0.
    set x_shear 0.
    for {set i 0} {$i < $NROTATION} {incr i} {
	set omega [expr {2.*$pi*double($i)/double($NROTATION)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set y_shear [expr {0.5*$yrange*$sin_omega}]
	set z_shear [expr {0.5*$zrange*$cos_omega}]
        set zs [expr {$zsmax - $dzsrot*$i}]
	$w cmd plptex3 \
	    $xmid $ymax $zs \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.5 "rotation for y = y#dmax#u"
    }

    # x = xmax.
    $w cmd plschr 0. 1.0
    set x_inclination 0.
    set y_inclination -1.
    set z_inclination 0.
    set y_shear 0.
    for {set i 0} {$i < $NROTATION} {incr i} {
	set omega [expr {2.*$pi*double($i)/double($NROTATION)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set x_shear [expr {0.5*$xrange*$sin_omega}]
	set z_shear [expr {0.5*$zrange*$cos_omega}]
	set zs [expr {$zsmax - $dzsrot*$i}]
    	$w cmd plptex3 \
	    $xmax $ymid $zs \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.5 "rotation for x = x#dmax#u"
    }

    # z = zmin.
    $w cmd plschr 0. 1.0
    set x_inclination 1.
    set y_inclination 0.
    set z_inclination 0.
    set x_shear 0.
    for {set i 0} {$i < $NROTATION} {incr i} {
	set omega [expr {2.*$pi*double($i)/double($NROTATION)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set y_shear [expr {0.5*$yrange*$cos_omega}]
	set z_shear [expr {0.5*$zrange*$sin_omega}]
        set ys [expr {$ysmax - $dysrot*$i}]
	$w cmd plptex3  \
	    $xmid $ys $zmin \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.5 "rotation for z = z#dmin#u"
    }
    # Draw minimal 3D grid to finish defining the 3D box.
    $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]

    # Page 3: Demonstrate shear of string along its axis.
    # Work around xcairo and pngcairo (but not pscairo) problems for
    # shear vector too close to axis of string. (N.B. no workaround
    # would be domega = 0.)
    set domega 0.05
    $w cmd pladv 0
    $w cmd plvpor -0.15 1.15 -0.05 1.05
    $w cmd plwind -1.2 1.2 -0.8 1.5
    $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45.

    $w cmd plcol0 2
    $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
	"b" "" [expr {$ymax-$ymin}] 0 \
	"bcd" "" [expr {$zmax-$zmin}] 0

    # y = ymax.
    $w cmd plschr 0. 1.0
    set x_inclination 1.
    set y_inclination 0.
    set z_inclination 0.
    set y_shear 0.
    for {set i 0} {$i < $NSHEAR} {incr i} {
	set omega [expr {$domega + 2.*$pi*double($i)/double($NSHEAR)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set x_shear [expr {0.5*$xrange*$sin_omega}]
	set z_shear [expr {0.5*$zrange*$cos_omega}]
	set zs [expr {$zsmax - $dzsshear*$i}]
	$w cmd plptex3 \
	    $xmid $ymax $zs \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.5 "shear for y = y#dmax#u"
    }

    # x = xmax.
    $w cmd plschr 0. 1.0
    set x_inclination 0.
    set y_inclination -1.
    set z_inclination 0.
    set x_shear 0.
    for {set i 0} {$i < $NSHEAR} {incr i} {
	set omega [expr {$domega + 2.*$pi*double($i)/double($NSHEAR)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set y_shear [expr {-0.5*$yrange*$sin_omega}]
	set z_shear [expr {0.5*$zrange*$cos_omega}]
	set zs [expr {$zsmax - $dzsshear*$i}]
	$w cmd plptex3 \
	    $xmax $ymid $zs \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.5 "shear for x = x#dmax#u"
    }

    # z = zmin.
    $w cmd plschr 0. 1.0
    set x_inclination 1.
    set y_inclination 0.
    set z_inclination 0.
    set z_shear 0.
    for {set i 0} {$i < $NSHEAR} {incr i} {
	set omega [expr {$domega + 2.*$pi*double($i)/double($NSHEAR)}]
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set y_shear [expr {0.5*$yrange*$cos_omega}]
	set x_shear [expr {0.5*$xrange*$sin_omega}]
	set ys [expr {$ysmax - $dysshear*$i}]
	$w cmd plptex3 \
	    $xmid $ys $zmin \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.5 "shear for z = z#dmin#u"
    }
    # Draw minimal 3D grid to finish defining the 3D box.
    $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]

    # Page 4: Demonstrate drawing a string on a 3D path.
    $w cmd pladv 0
    $w cmd plvpor -0.15 1.15 -0.05 1.05
    $w cmd plwind -1.2 1.2 -0.8 1.5
    $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 40. -30.

    $w cmd plcol0 2
    $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
	"b" "" [expr {$ymax-$ymin}] 0 \
	"bcd" "" [expr {$zmax-$zmin}] 0

    $w cmd plschr 0. 1.2
    # domega controls the spacing between the various characters of the
    # string and also the maximum value of omega for the given number
    # of characters in *pstring.
    set pslen [string length $pstring]
    set domega [expr {2.*$pi/$pslen}]
    set omega 0.
    # 3D function is a helix of the given radius and pitch
    set radius 0.5
    set pitch [expr {1./(2.*$pi)}]
    for {set i 0} {$i < $pslen} {incr i} {
	set sin_omega [expr {sin($omega)}]
	set cos_omega [expr {cos($omega)}]
	set xpos [expr {$xmid + $radius*$sin_omega}]
	set ypos [expr {$ymid - $radius*$cos_omega}]
	set zpos [expr {$zmin + $pitch*$omega}]
	# In general, the inclination is proportional to the derivative of
	# the position wrt theta.
	set x_inclination [expr {$radius*$cos_omega}]
	set y_inclination [expr {$radius*$sin_omega}]
	set z_inclination [expr {$pitch}]
	# The shear vector should be perpendicular to the 3D line with Z
	# component maximized, but for low pitch a good approximation is
	# a constant vector that is parallel to the Z axis.
	set x_shear 0.
	set y_shear 0.
	set z_shear 1.
	$w cmd plptex3 \
	    $xpos $ypos $zpos \
	    $x_inclination $y_inclination $z_inclination \
	    $x_shear $y_shear $z_shear \
	    0.5 [string range $pstring $i $i]
	set omega [expr {$omega + $domega}]
    }
    # Draw minimal 3D grid to finish defining the 3D box.
    $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]

    # Page 5: Demonstrate plmtex3 axis labelling capability
    $w cmd pladv 0
    $w cmd plvpor -0.15 1.15 -0.05 1.05
    $w cmd plwind -1.2 1.2 -0.8 1.5
    $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45.

    $w cmd plcol0 2
    $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
	"b" "" [expr {$ymax-$ymin}] 0 \
	"bcd" "" [expr {$zmax-$zmin}] 0

    $w cmd plschr 0. 1.0
    $w cmd plmtex3 "xp" 3.0 0.5 0.5 "Arbitrarily displaced"
    $w cmd plmtex3 "xp" 4.5 0.5 0.5 "primary X-axis label"
    $w cmd plmtex3 "xs" -2.5 0.5 0.5 "Arbitrarily displaced"
    $w cmd plmtex3 "xs" -1.0 0.5 0.5 "secondary X-axis label"
    $w cmd plmtex3 "yp" 3.0 0.5 0.5 "Arbitrarily displaced"
    $w cmd plmtex3 "yp" 4.5 0.5 0.5 "primary Y-axis label"
    $w cmd plmtex3 "ys" -2.5 0.5 0.5 "Arbitrarily displaced"
    $w cmd plmtex3 "ys" -1.0 0.5 0.5 "secondary Y-axis label"
    $w cmd plmtex3 "zp" 4.5 0.5 0.5 "Arbitrarily displaced"
    $w cmd plmtex3 "zp" 3.0 0.5 0.5 "primary Z-axis label"
    $w cmd plmtex3 "zs" -2.5 0.5 0.5 "Arbitrarily displaced"
    $w cmd plmtex3 "zs" -1.0 0.5 0.5 "secondary Z-axis label"
    # Draw minimal 3D grid to finish defining the 3D box.
    $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]

}