File: ExtractTensors.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 (107 lines) | stat: -rw-r--r-- 2,890 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
96
97
98
99
100
101
102
103
104
105
106
107
package require vtk
package require vtkinteraction

# create tensor ellipsoids

# Create the RenderWindow, Renderer and interactive renderer
#
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

vtkPointLoad ptLoad
    ptLoad SetLoadValue 100.0
    ptLoad SetSampleDimensions 30 30 30
    ptLoad ComputeEffectiveStressOn
    ptLoad SetModelBounds -10 10 -10 10 -10 10

vtkExtractTensorComponents extractTensor
  extractTensor SetInputConnection [ptLoad GetOutputPort]
  extractTensor ScalarIsEffectiveStress
  extractTensor ScalarIsComponent
  extractTensor ExtractScalarsOn
  extractTensor ExtractVectorsOn
  extractTensor ExtractNormalsOff
  extractTensor ExtractTCoordsOn

vtkContourFilter contour
  contour SetInputConnection [extractTensor GetOutputPort]
  contour SetValue 0 0

vtkProbeFilter probe
  probe SetInputConnection [contour GetOutputPort]
  probe SetSource [ptLoad GetOutput]

vtkLoopSubdivisionFilter su
  su SetInputConnection [probe GetOutputPort]
  su SetNumberOfSubdivisions 1

vtkPolyDataMapper s1Mapper
    s1Mapper SetInputConnection [probe GetOutputPort]
#    s1Mapper SetInputConnection [su GetOutputPort]

vtkActor s1Actor
    s1Actor SetMapper s1Mapper

#
# plane for context
#
vtkImageDataGeometryFilter g
    g SetInputConnection [ptLoad GetOutputPort]
    g SetExtent 0 100 0 100 0 0
    g Update;#for scalar range

vtkPolyDataMapper gm
    gm SetInputConnection [g GetOutputPort]
    eval gm SetScalarRange [[g GetOutput] GetScalarRange]
vtkActor ga
    ga SetMapper gm

    eval s1Mapper SetScalarRange [[g GetOutput] GetScalarRange]
#
# Create outline around data
#
vtkOutlineFilter outline
    outline SetInputConnection [ptLoad GetOutputPort]
vtkPolyDataMapper outlineMapper
    outlineMapper SetInputConnection [outline GetOutputPort]
vtkActor outlineActor
    outlineActor SetMapper outlineMapper
    eval [outlineActor GetProperty] SetColor 0 0 0
#
# Create cone indicating application of load
#
vtkConeSource coneSrc
    coneSrc  SetRadius .5
    coneSrc  SetHeight 2
vtkPolyDataMapper coneMap
    coneMap SetInputConnection [coneSrc GetOutputPort]
vtkActor coneActor
    coneActor SetMapper coneMap;    
    coneActor SetPosition 0 0 11
    coneActor RotateY 90
    eval [coneActor GetProperty] SetColor 1 0 0

vtkCamera camera
    camera SetFocalPoint 0.113766 -1.13665 -1.01919
    camera SetPosition -29.4886 -63.1488 26.5807
    camera SetViewAngle 24.4617
    camera SetViewUp 0.17138 0.331163 0.927879
    camera SetClippingRange 1 100

ren1 AddActor s1Actor
ren1 AddActor outlineActor
ren1 AddActor coneActor
ren1 AddActor ga
ren1 SetBackground 1.0 1.0 1.0
ren1 SetActiveCamera camera

renWin SetSize 300 300
renWin Render
iren AddObserver UserEvent {wm deiconify .vtkInteract}


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