Commit 84922a2a authored by Ben Boeckel's avatar Ben Boeckel

tcl: remove Tcl tests

parent 055e1c18

Too many changes to show.

To preserve performance only 429 of 429+ files are displayed.

vtk_add_test_tcl(
TestParametricFunctions.tcl
CSpline.tcl
KSpline.tcl
closedSplines.tcl
)
package require vtk
package require vtkinteraction
# Now create the RenderWindow, Renderer and Interactor
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkMath math
set numberOfInputPoints 30
vtkCardinalSpline aSplineX
vtkCardinalSpline aSplineY
vtkCardinalSpline aSplineZ
# generate random points
vtkPoints inputPoints
for {set i 0} {$i < $numberOfInputPoints} {incr i 1} {
set x [math Random 0 1]
set y [math Random 0 1]
set z [math Random 0 1]
aSplineX AddPoint $i $x
aSplineY AddPoint $i $y
aSplineZ AddPoint $i $z
inputPoints InsertPoint $i $x $y $z
}
vtkPolyData inputData
inputData SetPoints inputPoints
vtkSphereSource balls
balls SetRadius .01
balls SetPhiResolution 10
balls SetThetaResolution 10
vtkGlyph3D glyphPoints
glyphPoints SetInputData inputData
glyphPoints SetSourceConnection [balls GetOutputPort]
vtkPolyDataMapper glyphMapper
glyphMapper SetInputConnection [glyphPoints GetOutputPort]
vtkActor glyph
glyph SetMapper glyphMapper
eval [glyph GetProperty] SetDiffuseColor 1 0.4 0.4
[glyph GetProperty] SetSpecular .3
[glyph GetProperty] SetSpecularPower 30
ren1 AddActor glyph
# create a polyline
vtkPoints points
vtkPolyData profileData
set numberOfOutputPoints 400
set offset 1.0
proc fit {} {
global numberOfInputPoints numberOfOutputPoints offset
points Reset
for {set i 0} {$i< $numberOfOutputPoints} {incr i 1} {
set t [expr ( $numberOfInputPoints - $offset ) / ( $numberOfOutputPoints - 1) * $i]
points InsertPoint $i [aSplineX Evaluate $t] [aSplineY Evaluate $t] [aSplineZ Evaluate $t]
}
profileData Modified
}
fit
vtkCellArray lines
lines InsertNextCell $numberOfOutputPoints
for {set i 0} {$i < $numberOfOutputPoints} {incr i 1} {
lines InsertCellPoint $i
}
profileData SetPoints points
profileData SetLines lines
vtkTubeFilter profileTubes
profileTubes SetNumberOfSides 8
profileTubes SetInputData profileData
profileTubes SetRadius .005
vtkPolyDataMapper profileMapper
profileMapper SetInputConnection [profileTubes GetOutputPort]
vtkActor profile
profile SetMapper profileMapper
eval [profile GetProperty] SetDiffuseColor 1 1 0.6
[profile GetProperty] SetSpecular .3
[profile GetProperty] SetSpecularPower 30
ren1 AddActor profile
ren1 ResetCamera
[ren1 GetActiveCamera] Dolly 1.5
ren1 ResetCameraClippingRange
renWin SetSize 400 400
# render the image
#
iren Initialize
iren AddObserver UserEvent {wm deiconify .vtkInteract}
proc opened {} {
global offset
set offset 1.0
aSplineX ClosedOff
aSplineY ClosedOff
aSplineZ ClosedOff
fit
renWin Render
}
proc varyLeft {} {
for {set left -1} { $left <= 1 } {set left [expr $left + .05]} {
aSplineX SetLeftValue $left
aSplineY SetLeftValue $left
aSplineZ SetLeftValue $left
fit
renWin Render
}
}
proc varyRight {} {
for {set right -1} { $right <= 1 } {set right [expr $right + .05]} {
aSplineX SetRightValue $right
aSplineY SetRightValue $right
aSplineZ SetRightValue $right
fit
renWin Render
}
}
proc constraint {value } {
aSplineX SetLeftConstraint $value
aSplineY SetLeftConstraint $value
aSplineZ SetLeftConstraint $value
aSplineX SetRightConstraint $value
aSplineY SetRightConstraint $value
aSplineZ SetRightConstraint $value
}
proc closed {} {
global offset
set offset 0.0
aSplineX ClosedOn
aSplineY ClosedOn
aSplineZ ClosedOn
fit
renWin Render
}
# prevent the tk window from showing up then start the event loop
wm withdraw .
package require vtk
package require vtkinteraction
# Now create the RenderWindow, Renderer and Interactor
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkMath math
set numberOfInputPoints 30
vtkKochanekSpline aSplineX
vtkKochanekSpline aSplineY
vtkKochanekSpline aSplineZ
# generate random points
vtkPoints inputPoints
for {set i 0} {$i<$numberOfInputPoints} {incr i 1} {
set x [math Random 0 1]
set y [math Random 0 1]
set z [math Random 0 1]
aSplineX AddPoint $i $x
aSplineY AddPoint $i $y
aSplineZ AddPoint $i $z
inputPoints InsertPoint $i $x $y $z
}
vtkPolyData inputData
inputData SetPoints inputPoints
vtkSphereSource balls
balls SetRadius .01
balls SetPhiResolution 10
balls SetThetaResolution 10
vtkGlyph3D glyphPoints
glyphPoints SetInputData inputData
glyphPoints SetSourceConnection [balls GetOutputPort]
vtkPolyDataMapper glyphMapper
glyphMapper SetInputConnection [glyphPoints GetOutputPort]
vtkActor glyph
glyph SetMapper glyphMapper
eval [glyph GetProperty] SetDiffuseColor 1 0.6 0.6
[glyph GetProperty] SetSpecular .3
[glyph GetProperty] SetSpecularPower 30
ren1 AddActor glyph
vtkPoints points
# create a line
set tension 0
set bias 0
set continuity 0
aSplineX SetDefaultTension $tension
aSplineX SetDefaultBias $bias
aSplineX SetDefaultContinuity $continuity
aSplineY SetDefaultTension $tension
aSplineY SetDefaultBias $bias
aSplineY SetDefaultContinuity $continuity
aSplineZ SetDefaultTension $tension
aSplineZ SetDefaultBias $bias
aSplineZ SetDefaultContinuity $continuity
vtkPolyData profileData
set numberOfOutputPoints 300
set offset 1.0
proc fit {} {
global numberOfInputPoints numberOfOutputPoints offset
points Reset
for {set i 0} {$i< $numberOfOutputPoints} {incr i 1} {
set t [expr ( $numberOfInputPoints - $offset ) / ($numberOfOutputPoints - 1) * $i]
points InsertPoint $i [aSplineX Evaluate $t] [aSplineY Evaluate $t] [aSplineZ Evaluate $t]
}
profileData Modified
}
fit
vtkCellArray lines
lines InsertNextCell $numberOfOutputPoints
for {set i 0} {$i< $numberOfOutputPoints} {incr i 1} {
lines InsertCellPoint $i
}
profileData SetPoints points
profileData SetLines lines
vtkTubeFilter profileTubes
profileTubes SetNumberOfSides 8
profileTubes SetInputData profileData
profileTubes SetRadius .005
vtkPolyDataMapper profileMapper
profileMapper SetInputConnection [profileTubes GetOutputPort]
vtkActor profile
profile SetMapper profileMapper
eval [profile GetProperty] SetDiffuseColor 1 1 0.7
[profile GetProperty] SetSpecular .3
[profile GetProperty] SetSpecularPower 30
ren1 AddActor profile
[ren1 GetActiveCamera] Dolly 1.5
ren1 ResetCamera
ren1 ResetCameraClippingRange
renWin SetSize 400 400
# render the image
#
iren Initialize
iren AddObserver UserEvent {wm deiconify .vtkInteract}
# prevent the tk window from showing up then start the event loop
wm withdraw .
proc defaults {} {
aSplineX SetDefaultBias 0
aSplineX SetDefaultTension 0
aSplineX SetDefaultContinuity 0
aSplineY SetDefaultBias 0
aSplineY SetDefaultTension 0
aSplineY SetDefaultContinuity 0
aSplineZ SetDefaultBias 0
aSplineZ SetDefaultTension 0
aSplineZ SetDefaultContinuity 0
fit
renWin Render
}
proc varyBias {} {
defaults
for {set bias -1} { $bias <= 1 } {set bias [expr $bias + .05]} {
aSplineX SetDefaultBias $bias
aSplineY SetDefaultBias $bias
aSplineZ SetDefaultBias $bias
fit
renWin Render
}
}
proc varyTension {} {
defaults
for {set tension -1} { $tension <= 1 } {set tension [expr $tension + .05]} {
aSplineX SetDefaultTension $tension
aSplineY SetDefaultTension $tension
aSplineZ SetDefaultTension $tension
fit
renWin Render
}
}
proc varyContinuity {} {
defaults
for {set Continuity -1} { $Continuity <= 1 } {set Continuity [expr $Continuity + .05]} {
aSplineX SetDefaultContinuity $Continuity
aSplineY SetDefaultContinuity $Continuity
aSplineZ SetDefaultContinuity $Continuity
fit
renWin Render
}
}
proc closed {} {
global offset
set offset 0.0
aSplineX ClosedOn
aSplineY ClosedOn
aSplineZ ClosedOn
fit
renWin Render
}
proc opened {} {
global offset
set offset 1.0
aSplineX ClosedOff
aSplineY ClosedOff
aSplineZ ClosedOff
fit
renWin Render
}
# ------------------------------------------------------------
# Purpose: Test the parametric functions.
# ------------------------------------------------------------
# -------------------------------------------------------------
# Call the VTK Tcl packages to make available all VTK commands
# ------------------------------------------------------------
package require vtk
package require vtkinteraction
# NOTE: this test has a companion .py test. The threshold set
# here should be the same as the threshold in the .py
# test. Both tests should produce exactly the same results.
set threshold 10
# ------------------------------------------------------------
# Get a texture`
# ------------------------------------------------------------
vtkJPEGReader textureReader
textureReader SetFileName "$VTK_DATA_ROOT/Data/beach.jpg"
vtkTexture texture
texture SetInputConnection [textureReader GetOutputPort]
# ------------------------------------------------------------
# For each parametric surface:
# 1) Create it
# 2) Assign mappers and actors
# 3) Position the object
# 5) Add a label
# ------------------------------------------------------------
# ------------------------------------------------------------
# Create a torus
# ------------------------------------------------------------
vtkParametricTorus torus
vtkParametricFunctionSource torusSource
torusSource SetParametricFunction torus
torusSource SetScalarModeToPhase
vtkPolyDataMapper torusMapper
torusMapper SetInputConnection [torusSource GetOutputPort]
torusMapper SetScalarRange 0 360
vtkActor torusActor
torusActor SetMapper torusMapper
torusActor SetPosition 0 12 0
vtkTextMapper torusTextMapper
torusTextMapper SetInput "Torus"
[torusTextMapper GetTextProperty] SetJustificationToCentered
[torusTextMapper GetTextProperty] SetVerticalJustificationToCentered
[torusTextMapper GetTextProperty] SetColor 1 0 0
[torusTextMapper GetTextProperty] SetFontSize 14
vtkActor2D torusTextActor
torusTextActor SetMapper torusTextMapper
[torusTextActor GetPositionCoordinate] SetCoordinateSystemToWorld
[torusTextActor GetPositionCoordinate] SetValue 0 9.5 0
# ------------------------------------------------------------
# Create a Klein bottle
# ------------------------------------------------------------
vtkParametricKlein klein
vtkParametricFunctionSource kleinSource
kleinSource SetParametricFunction klein
kleinSource SetScalarModeToU0V0
vtkPolyDataMapper kleinMapper
kleinMapper SetInputConnection [kleinSource GetOutputPort]
kleinMapper SetScalarRange 0 3
vtkActor kleinActor
kleinActor SetMapper kleinMapper
kleinActor SetPosition 8 10.5 0
vtkTextMapper kleinTextMapper
kleinTextMapper SetInput "Klein"
[kleinTextMapper GetTextProperty] SetJustificationToCentered
[kleinTextMapper GetTextProperty] SetVerticalJustificationToCentered
[kleinTextMapper GetTextProperty] SetColor 1 0 0
[kleinTextMapper GetTextProperty] SetFontSize 14
vtkActor2D kleinTextActor
kleinTextActor SetMapper kleinTextMapper
[kleinTextActor GetPositionCoordinate] SetCoordinateSystemToWorld
[kleinTextActor GetPositionCoordinate] SetValue 8 9.5 0
# ------------------------------------------------------------
# Create a Figure-8 Klein
# ------------------------------------------------------------
vtkParametricFigure8Klein klein2
vtkParametricFunctionSource klein2Source
klein2Source SetParametricFunction klein2
klein2Source GenerateTextureCoordinatesOn
vtkPolyDataMapper klein2Mapper
klein2Mapper SetInputConnection [klein2Source GetOutputPort]
klein2Mapper SetScalarRange 0 3
vtkActor klein2Actor
klein2Actor SetMapper klein2Mapper
klein2Actor SetPosition 16 12 0
klein2Actor SetTexture texture
vtkTextMapper fig8KleinTextMapper
fig8KleinTextMapper SetInput "Fig-8 Klein"
[fig8KleinTextMapper GetTextProperty] SetJustificationToCentered
[fig8KleinTextMapper GetTextProperty] SetVerticalJustificationToCentered
[fig8KleinTextMapper GetTextProperty] SetColor 1 0 0
[fig8KleinTextMapper GetTextProperty] SetFontSize 14
vtkActor2D fig8KleinTextActor
fig8KleinTextActor SetMapper fig8KleinTextMapper
[fig8KleinTextActor GetPositionCoordinate] SetCoordinateSystemToWorld
[fig8KleinTextActor GetPositionCoordinate] SetValue 16 9.5 0
# ------------------------------------------------------------
# Create a Mobius strip
# ------------------------------------------------------------
vtkParametricMobius mobius
vtkParametricFunctionSource mobiusSource
mobiusSource SetParametricFunction mobius
mobiusSource GenerateTextureCoordinatesOn
vtkPolyDataMapper mobiusMapper
mobiusMapper SetInputConnection [mobiusSource GetOutputPort]
vtkActor mobiusActor
mobiusActor SetMapper mobiusMapper
mobiusActor RotateX 45
mobiusActor SetPosition 24 12 0
mobiusActor SetTexture texture
vtkTextMapper mobiusTextMapper
mobiusTextMapper SetInput "Mobius"
[mobiusTextMapper GetTextProperty] SetJustificationToCentered
[mobiusTextMapper GetTextProperty] SetVerticalJustificationToCentered
[mobiusTextMapper GetTextProperty] SetColor 1 0 0
[mobiusTextMapper GetTextProperty] SetFontSize 14
vtkActor2D mobiusTextActor
mobiusTextActor SetMapper mobiusTextMapper
[mobiusTextActor GetPositionCoordinate] SetCoordinateSystemToWorld
[mobiusTextActor GetPositionCoordinate] SetValue 24 9.5 0
# ------------------------------------------------------------
# Create a super toroid
# ------------------------------------------------------------
vtkParametricSuperToroid toroid
toroid SetN1 2
toroid SetN2 3
vtkParametricFunctionSource toroidSource
toroidSource SetParametricFunction toroid
toroidSource SetScalarModeToU
vtkPolyDataMapper toroidMapper
toroidMapper SetInputConnection [toroidSource GetOutputPort]
toroidMapper SetScalarRange 0 6.28
vtkActor toroidActor
toroidActor SetMapper toroidMapper
toroidActor SetPosition 0 4 0
vtkTextMapper superToroidTextMapper
superToroidTextMapper SetInput "Super Toroid"
[superToroidTextMapper GetTextProperty] SetJustificationToCentered
[superToroidTextMapper GetTextProperty] SetVerticalJustificationToCentered
[superToroidTextMapper GetTextProperty] SetColor 1 0 0
[superToroidTextMapper GetTextProperty] SetFontSize 14
vtkActor2D superToroidTextActor
superToroidTextActor SetMapper superToroidTextMapper
[superToroidTextActor GetPositionCoordinate] SetCoordinateSystemToWorld
[superToroidTextActor GetPositionCoordinate] SetValue 0 1.5 0
# ------------------------------------------------------------
# Create a super ellipsoid
# ------------------------------------------------------------
vtkParametricSuperEllipsoid superEllipsoid