File: TestExponentialPointSource.py

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (125 lines) | stat: -rwxr-xr-x 3,183 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/env python
from vtkmodules.vtkFiltersCore import vtkAppendPolyData
from vtkmodules.vtkFiltersSources import vtkPointSource
from vtkmodules.vtkRenderingCore import (
    vtkActor,
    vtkPolyDataMapper,
    vtkRenderWindow,
    vtkRenderWindowInteractor,
    vtkRenderer,
)
import vtkmodules.vtkInteractionStyle
import vtkmodules.vtkRenderingFreeType
import vtkmodules.vtkRenderingOpenGL2

# Control the size of the test. Bigger numbers create more points.
numPts = 1000
radius = 0.5

# Create nine point sources with exponential distributions.
# Each has a different rate (lambda) factor. The nine
# sources are regularly placed within a cube, and then
# appended together.
ps0 = vtkPointSource()
ps0.SetDistributionToExponential()
ps0.SetCenter(-1,-1,-1)
ps0.SetRadius(radius)
ps0.SetNumberOfPoints(numPts)
ps0.SetLambda(.1)

ps1 = vtkPointSource()
ps1.SetDistributionToExponential()
ps1.SetCenter(1,-1,-1)
ps1.SetRadius(radius)
ps1.SetNumberOfPoints(numPts)
ps1.SetLambda(-10)

ps2 = vtkPointSource()
ps2.SetDistributionToExponential()
ps2.SetCenter(1,1,-1)
ps2.SetRadius(radius)
ps2.SetNumberOfPoints(numPts)
ps2.SetLambda(0.6)

ps3 = vtkPointSource()
ps3.SetDistributionToExponential()
ps3.SetCenter(-1,1,-1)
ps3.SetRadius(radius)
ps3.SetNumberOfPoints(numPts)
ps3.SetLambda(0.8)

ps4 = vtkPointSource()
ps4.SetDistributionToExponential()
ps4.SetCenter(0,0,0)
ps4.SetRadius(radius)
ps4.SetNumberOfPoints(numPts)
ps4.SetLambda(1.0)

ps5 = vtkPointSource()
ps5.SetDistributionToExponential()
ps5.SetCenter(-1,-1,1)
ps5.SetRadius(radius)
ps5.SetNumberOfPoints(numPts)
ps5.SetLambda(2)

ps6 = vtkPointSource()
ps6.SetDistributionToExponential()
ps6.SetCenter(1,-1,1)
ps6.SetRadius(radius)
ps6.SetNumberOfPoints(numPts)
ps6.SetLambda(4)

ps7 = vtkPointSource()
ps7.SetDistributionToExponential()
ps7.SetCenter(1,1,1)
ps7.SetRadius(radius)
ps7.SetNumberOfPoints(numPts)
ps7.SetLambda(6)

ps8 = vtkPointSource()
ps8.SetDistributionToExponential()
ps8.SetCenter(-1,1,1)
ps8.SetRadius(radius)
ps8.SetNumberOfPoints(numPts)
ps8.SetLambda(10)

# Comment out two point sources which are aligned along
# the camera view vector and the center point cloud -
# they just clutter the display.
appendF = vtkAppendPolyData()
#appendF.AddInputConnection(ps0.GetOutputPort())
appendF.AddInputConnection(ps1.GetOutputPort())
appendF.AddInputConnection(ps2.GetOutputPort())
appendF.AddInputConnection(ps3.GetOutputPort())
appendF.AddInputConnection(ps4.GetOutputPort())
appendF.AddInputConnection(ps5.GetOutputPort())
appendF.AddInputConnection(ps6.GetOutputPort())
#appendF.AddInputConnection(ps7.GetOutputPort())
appendF.AddInputConnection(ps8.GetOutputPort())

mapper = vtkPolyDataMapper()
mapper.SetInputConnection(appendF.GetOutputPort())

actor = vtkActor()
actor.SetMapper(mapper)

# Create the RenderWindow, Renderer and Interactive Renderer
#
ren1 = vtkRenderer()
renWin = vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

ren1.AddActor(actor)
ren1.SetBackground(0, 0, 0)

renWin.SetSize(300, 300)

renWin.Render()
ren1.GetActiveCamera().SetPosition(1,1,1)
ren1.ResetCamera()
renWin.Render()

iren.Initialize()
iren.Start()