File: deciFranFace.tcl

package info (click to toggle)
vtk 5.8.0-13
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 130,524 kB
  • sloc: cpp: 1,129,256; ansic: 708,203; tcl: 48,526; python: 20,875; xml: 6,779; yacc: 4,208; perl: 3,121; java: 2,788; lex: 931; sh: 660; asm: 471; makefile: 299
file content (91 lines) | stat: -rw-r--r-- 2,389 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
package require vtk
package require vtkinteraction

# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderer ren2
vtkRenderer ren3
vtkRenderer ren4
vtkRenderWindow renWin
    renWin AddRenderer ren1
    renWin AddRenderer ren2
    renWin AddRenderer ren3
    renWin AddRenderer ren4

vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

vtkPNGReader pnm1
    pnm1 SetFileName "$VTK_DATA_ROOT/Data/fran_cut.png"

vtkTexture atext
  atext SetInputConnection [pnm1 GetOutputPort]
  atext InterpolateOn

# create a cyberware source
#
vtkPolyDataReader fran
    fran SetFileName "$VTK_DATA_ROOT/Data/fran_cut.vtk"

set topologies "On Off"
set accumulates "On Off"
foreach topology $topologies {
  foreach accumulate $accumulates {
    vtkDecimatePro deci$topology$accumulate
      deci$topology$accumulate SetInputConnection [fran GetOutputPort]
      deci$topology$accumulate SetTargetReduction .95
      deci$topology$accumulate PreserveTopology$topology
      deci$topology$accumulate AccumulateError$accumulate
    vtkPolyDataMapper mapper$topology$accumulate
      mapper$topology$accumulate SetInputConnection [deci$topology$accumulate GetOutputPort]
    vtkActor fran$topology$accumulate
      fran$topology$accumulate SetMapper mapper$topology$accumulate
      fran$topology$accumulate SetTexture atext
  }
}

# Add the actors to the renderer, set the background and size
#
ren1 SetViewport 0 .5 .5 1
ren2 SetViewport .5 .5 1 1
ren3 SetViewport 0 0 .5 .5
ren4 SetViewport .5 0 1 .5

ren1 AddActor franOnOn
ren2 AddActor franOnOff
ren3 AddActor franOffOn
ren4 AddActor franOffOff

vtkCamera camera
ren1 SetActiveCamera camera
ren2 SetActiveCamera camera
ren3 SetActiveCamera camera
ren4 SetActiveCamera camera

[ren1 GetActiveCamera] SetPosition 0.314753 -0.0699988 -0.264225 
[ren1 GetActiveCamera] SetFocalPoint 0.00188636 -0.136847 -5.84226e-09 
[ren1 GetActiveCamera] SetViewAngle 30
[ren1 GetActiveCamera] SetViewUp  0 1 0

ren1 ResetCameraClippingRange
ren2 ResetCameraClippingRange
ren3 ResetCameraClippingRange
ren4 ResetCameraClippingRange

ren1 SetBackground 1 1 1
ren2 SetBackground 1 1 1
ren3 SetBackground 1 1 1
ren4 SetBackground 1 1 1

renWin SetSize 500 500

# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize

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