File: TestBranchExtentTranslator.tcl

package info (click to toggle)
vtk 5.0.2-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 51,080 kB
  • ctags: 67,442
  • sloc: cpp: 522,627; ansic: 221,292; tcl: 43,377; python: 14,072; perl: 3,102; java: 1,436; yacc: 1,033; sh: 469; lex: 248; makefile: 181; asm: 154
file content (95 lines) | stat: -rw-r--r-- 2,340 bytes parent folder | download | duplicates (8)
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
package require vtk
package require vtkinteraction

vtkImageGaussianSource gauss
  gauss SetWholeExtent 0 30 0 30 0 2
  gauss SetCenter 18 12 0
  gauss SetMaximum 1.0
  gauss SetStandardDeviation 6.0
  gauss Update

vtkBranchExtentTranslator translator
  translator SetOriginalSource [gauss GetOutput]
  [gauss GetOutput] SetExtentTranslator translator

vtkImageClip clip1
  clip1 SetOutputWholeExtent 7 28 0 15 1 1
  clip1 SetInputConnection [gauss GetOutputPort]
vtkDataSetSurfaceFilter surf1
  surf1 SetInputConnection [clip1 GetOutputPort]
vtkTriangleFilter tf1
  tf1 SetInputConnection [surf1 GetOutputPort]
vtkPolyDataMapper mapper1
  mapper1 SetInputConnection [tf1 GetOutputPort]
  mapper1 SetScalarRange 0 1
  mapper1 SetNumberOfPieces 4
  mapper1 SetPiece 1
vtkActor actor1
  actor1 SetMapper mapper1
  actor1 SetPosition 0 0 0



# For coverage, a case where all four sides get clipped by the whole extent.
vtkImageClip clip2
  clip2 SetOutputWholeExtent 16 18 3 10 0 0
  clip2 SetInputConnection [gauss GetOutputPort]
vtkDataSetSurfaceFilter surf2
  surf2 SetInputConnection [clip2 GetOutputPort]
vtkTriangleFilter tf2
  tf2 SetInputConnection [surf2 GetOutputPort]
vtkPolyDataMapper mapper2
  mapper2 SetInputConnection [tf2 GetOutputPort]
  mapper2 SetScalarRange 0 1
  mapper2 SetNumberOfPieces 4
  mapper2 SetPiece 1
vtkActor actor2
  actor2 SetMapper mapper2
  actor2 SetPosition 15 0 0



# nothing in intersection (empty case)
vtkImageClip clip3
  clip3 SetOutputWholeExtent 1 10 0 15 0 2
  clip3 SetInputConnection [gauss GetOutputPort]
vtkDataSetSurfaceFilter surf3
  surf3 SetInputConnection [clip3 GetOutputPort]
vtkTriangleFilter tf3
  tf3 SetInputConnection [surf3 GetOutputPort]
vtkPolyDataMapper mapper3
  mapper3 SetInputConnection [tf3 GetOutputPort]
  mapper3 SetScalarRange 0 1
  mapper3 SetNumberOfPieces 4
  mapper3 SetPiece 1
vtkActor actor3
  actor3 SetMapper mapper3
  actor3 SetPosition 30 0 0



vtkRenderer ren
ren AddActor actor1
ren AddActor actor2
ren AddActor actor3

vtkRenderWindow renWin
renWin AddRenderer ren

#set cam [ren GetActiveCamera]
#ren ResetCamera



vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
iren Initialize
iren AddObserver UserEvent {wm deiconify .vtkInteract}

wm withdraw .


renWin Render

# break loop to avoid a memory leak.
translator SetOriginalSource {}