/usr/share/vtk/Modelling/Tcl/DelMesh.tcl is in vtk-examples 5.8.0-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 | # This example demonstrates how to use 2D Delaunay triangulation.
# We create a fancy image of a 2D Delaunay triangulation. Points are
# randomly generated.
# first we load in the standard vtk packages into tcl
package require vtk
package require vtkinteraction
package require vtktesting
# Generate some random points
#
vtkMath math
vtkPoints points
for {set i 0} {$i<50} {incr i 1} {
eval points InsertPoint $i [math Random 0 1] [math Random 0 1] 0.0
}
# Create a polydata with the points we just created.
vtkPolyData profile
profile SetPoints points
# Perform a 2D Delaunay triangulation on them.
#
vtkDelaunay2D del
del SetInput profile
del SetTolerance 0.001
vtkPolyDataMapper mapMesh
mapMesh SetInputConnection [del GetOutputPort]
vtkActor meshActor
meshActor SetMapper mapMesh
eval [meshActor GetProperty] SetColor .1 .2 .4
# We will now create a nice looking mesh by wrapping the edges in tubes,
# and putting fat spheres at the points.
vtkExtractEdges extract
extract SetInputConnection [del GetOutputPort]
vtkTubeFilter tubes
tubes SetInputConnection [extract GetOutputPort]
tubes SetRadius 0.01
tubes SetNumberOfSides 6
vtkPolyDataMapper mapEdges
mapEdges SetInputConnection [tubes GetOutputPort]
vtkActor edgeActor
edgeActor SetMapper mapEdges
eval [edgeActor GetProperty] SetColor $peacock
[edgeActor GetProperty] SetSpecularColor 1 1 1
[edgeActor GetProperty] SetSpecular 0.3
[edgeActor GetProperty] SetSpecularPower 20
[edgeActor GetProperty] SetAmbient 0.2
[edgeActor GetProperty] SetDiffuse 0.8
vtkSphereSource ball
ball SetRadius 0.025
ball SetThetaResolution 12
ball SetPhiResolution 12
vtkGlyph3D balls
balls SetInputConnection [del GetOutputPort]
balls SetSourceConnection [ball GetOutputPort]
vtkPolyDataMapper mapBalls
mapBalls SetInputConnection [balls GetOutputPort]
vtkActor ballActor
ballActor SetMapper mapBalls
eval [ballActor GetProperty] SetColor $hot_pink
[ballActor GetProperty] SetSpecularColor 1 1 1
[ballActor GetProperty] SetSpecular 0.3
[ballActor GetProperty] SetSpecularPower 20
[ballActor GetProperty] SetAmbient 0.2
[ballActor GetProperty] SetDiffuse 0.8
# Create graphics objects
# Create the rendering window, renderer, and interactive renderer
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# Add the actors to the renderer, set the background and size
ren1 AddActor ballActor
ren1 AddActor edgeActor
ren1 SetBackground 1 1 1
renWin SetSize 150 150
# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 1.5
iren Initialize
# prevent the tk window from showing up then start the event loop
wm withdraw .
|