This file is indexed.

/usr/share/vtk/Modelling/Tcl/SpherePuzzle.tcl is in vtk-examples 5.8.0-17.5.

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
#
# First we include the VTK Tcl packages which will make available 
# all of the vtk commands to Tcl
#
package require vtk
package require vtkinteraction

#
# Prevent the tk window from showing up then start the event loop
#
wm withdraw .

#
# Create the toplevel window
#
toplevel .top
wm title .top "Sphere Puzzle"
wm protocol .top WM_DELETE_WINDOW ::vtk::cb_exit

#
# Create some frames
#
frame .top.f1 
frame .top.f2

pack .top.f1 \
        -side top -anchor n \
        -expand 1 -fill both

pack .top.f2 \
        -side bottom -anchor s \
        -expand t -fill x

#
# Create the Tk render widget, and bind the events
#
vtkRenderWindow renWin

vtkRenderer ren1
    renWin AddRenderer ren1

vtkTkRenderWidget .top.f1.rw \
        -width 400 \
        -height 400 \
        -rw renWin

::vtk::bind_tk_render_widget .top.f1.rw

pack .top.f1.rw \
        -expand t -fill both

#
# Display some infos
#
label .top.f2.l1 -text "Position cursor over the rotation plane."
label .top.f2.l2 -text "Moving pieces will be highlighted."
label .top.f2.l3 -text "Press 'm' to make a move."

button .top.f2.reset \
        -text "Reset" \
	-command {puzzle Reset; renWin Render}

button .top.f2.b1 \
        -text "Quit" \
        -command ::vtk::cb_exit

pack .top.f2.l1 .top.f2.l2 .top.f2.l3 .top.f2.reset .top.f2.b1 \
	-side top \
        -expand t -fill x

#
# Create the pipeline
#
vtkSpherePuzzle puzzle

vtkPolyDataMapper mapper
   mapper SetInputConnection [puzzle GetOutputPort]

vtkActor actor
    actor SetMapper mapper

vtkSpherePuzzleArrows arrows

vtkPolyDataMapper mapper2
   mapper2 SetInputConnection [arrows GetOutputPort]

vtkActor actor2
    actor2 SetMapper mapper2

#
# Add the actors to the renderer, set the background and size
#
ren1 AddActor actor
ren1 AddActor actor2
ren1 SetBackground 0.1 0.2 0.4

ren1 ResetCamera
set cam [ren1 GetActiveCamera]
$cam Elevation -40
renWin Render

#
# Modify some bindings, use the interactor style 'switch'
#
set iren [renWin GetInteractor]
set istyle [vtkInteractorStyleSwitch istyleswitch]
$iren SetInteractorStyle $istyle
$istyle SetCurrentStyleToTrackballCamera

$iren AddObserver MouseMoveEvent MotionCallback
$iren AddObserver CharEvent CharCallback

#
# Highlight pieces
#
proc MotionCallback {} {

    global in_piece_rotation
    if {[info exists in_piece_rotation]} {
        return
    }

    global LastVal

    set iren [renWin GetInteractor]
    set istyle [[$iren GetInteractorStyle] GetCurrentStyle]

    # Return if the user is performing interaction

    if {[$istyle GetState]} {
        return
    }

    # Get mouse position

    set pos [$iren GetEventPosition]
    set x [lindex $pos 0]
    set y [lindex $pos 1]

    # Get world point

    ren1 SetDisplayPoint $x $y [ren1 GetZ $x $y]
    ren1 DisplayToWorld
    set pt [ren1 GetWorldPoint]

    set val [puzzle SetPoint [lindex $pt 0] [lindex $pt 1] [lindex $pt 2]]
    if {![info exists LastVal] || $val != $LastVal} {
	renWin Render
	set LastVal $val
    }
}

#
# Rotate the puzzle
#
proc CharCallback {} {

    set iren [renWin GetInteractor]

    set keycode [$iren GetKeyCode]
    if {$keycode != "m" && $keycode != "M"} {
        return
    }

    set pos [$iren GetEventPosition]
    ButtonCallback [lindex $pos 0] [lindex $pos 1]
}

proc ButtonCallback {x y} {

    global in_piece_rotation
    if {[info exists in_piece_rotation]} {
        return
    }
    set in_piece_rotation 1

    # Get world point

    ren1 SetDisplayPoint $x $y [ren1 GetZ $x $y]
    ren1 DisplayToWorld
    set pt [ren1 GetWorldPoint]

    set x [lindex $pt 0]
    set y [lindex $pt 1]
    set z [lindex $pt 2]

    for { set i 0} {$i <= 100} {set i [expr $i + 10]} {
	puzzle SetPoint $x $y $z
	puzzle MovePoint $i
	renWin Render
        update
    }

    unset in_piece_rotation
}

update

#
# Shuffle the puzzle
#
ButtonCallback 218 195
ButtonCallback 261 128
ButtonCallback 213 107
ButtonCallback 203 162
ButtonCallback 134 186

tkwait window .top