Commit 7691a166 authored by Bill Lorensen's avatar Bill Lorensen Committed by Kitware Robot
Browse files

Merge topic 'RemoveUnusedTclTests'

6890ae40

 ENH: Remove unused tcl tests
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: default avatarDavid E DeMarle <dave.demarle@kitware.com>
Reviewed-by: Andrew Maclean's avatarAndrew Maclean <andrew.amaclean@gmail.com>
Merge-request: !354
parents 104bcfaa 6890ae40
package require vtk
package require vtkinteraction
# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkDiskSource disk
disk SetInnerRadius 1.0
disk SetOuterRadius 2.0
disk SetRadialResolution 1
disk SetCircumferentialResolution 20
vtkPolyDataMapper diskMapper
diskMapper SetInputConnection [disk GetOutputPort]
vtkActor diskActor
diskActor SetMapper diskMapper
# Add the actors to the renderer, set the background and size
#
ren1 AddActor diskActor
ren1 SetBackground 0.1 0.2 0.4
renWin SetSize 200 200
# Get handles to some useful objects
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
renWin Render
# prevent the tk window from showing up then start the event loop
wm withdraw .
package require vtk
package require vtkinteraction
vtkRenderWindow renWin
renWin OffScreenRenderingOn
vtkRenderer ren
renWin AddRenderer ren
vtkConeSource cone
vtkPolyDataMapper mp
mp SetInputConnection [cone GetOutputPort]
vtkActor actor
actor SetMapper mp
ren AddActor actor
renWin Render
# prevent the tk window from showing up then start the event loop
wm withdraw .
# Test the button source
package require vtk
package require vtkinteraction
# The image to map on the button
vtkJPEGReader r
r SetFileName "$VTK_DATA_ROOT/Data/beach.jpg"
r Update
vtkTexture t
t SetInputConnection [r GetOutputPort]
set dims [[r GetOutput] GetDimensions]
set d1 [lindex $dims 0]
set d2 [lindex $dims 1]
# The first elliptical button
vtkEllipticalButtonSource bs
bs SetWidth 2
bs SetHeight 1
bs SetDepth 0.2
bs SetCircumferentialResolution 64
bs SetRadialRatio 1.1
bs SetShoulderResolution 8
bs SetTextureResolution 4
bs TwoSidedOn
vtkPolyDataMapper bMapper
bMapper SetInputConnection [bs GetOutputPort]
vtkActor b1
b1 SetMapper bMapper
b1 SetTexture t
# The second elliptical button
vtkEllipticalButtonSource bs2
bs2 SetWidth 2
bs2 SetHeight 1
bs2 SetDepth 0.2
bs2 SetCircumferentialResolution 64
bs2 SetRadialRatio 1.1
bs2 SetShoulderResolution 8
bs2 SetTextureResolution 4
bs2 TwoSidedOn
bs2 SetCenter 2 0 0
bs2 SetTextureStyleToFitImage
bs2 SetTextureDimensions $d1 $d2
vtkPolyDataMapper b2Mapper
b2Mapper SetInputConnection [bs2 GetOutputPort]
vtkActor b2
b2 SetMapper b2Mapper
b2 SetTexture t
# The third rectangular button
vtkRectangularButtonSource bs3
bs3 SetWidth 1.5
bs3 SetHeight 0.75
bs3 SetDepth 0.2
bs3 TwoSidedOn
bs3 SetCenter 0 1 0
bs3 SetTextureDimensions $d1 $d2
vtkPolyDataMapper b3Mapper
b3Mapper SetInputConnection [bs3 GetOutputPort]
vtkActor b3
b3 SetMapper b3Mapper
b3 SetTexture t
# The fourth rectangular button
vtkRectangularButtonSource bs4
bs4 SetWidth 1.5
bs4 SetHeight 0.75
bs4 SetDepth 0.2
bs4 TwoSidedOn
bs4 SetCenter 2 1 0
bs4 SetTextureStyleToFitImage
bs4 SetTextureDimensions $d1 $d2
vtkPolyDataMapper b4Mapper
b4Mapper SetInputConnection [bs4 GetOutputPort]
vtkActor b4
b4 SetMapper b4Mapper
b4 SetTexture t
# Create the RenderWindow, Renderer and Interactive Renderer
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
ren1 AddActor b1
ren1 AddActor b2
ren1 AddActor b3
ren1 AddActor b4
ren1 SetBackground 0 0 0
renWin SetSize 250 150
renWin Render
[ren1 GetActiveCamera] Zoom 1.5
renWin Render
iren AddObserver UserEvent {wm deiconify .vtkInteract}
# prevent the tk window from showing up then start the event loop
wm withdraw .
package require vtk
package require vtkinteraction
package require vtktesting
# Create five instances of vtkPlatonicSolidSource
# corresponding to each of the five Platonic solids.
#
vtkPlatonicSolidSource tet
tet SetSolidTypeToTetrahedron
vtkPolyDataMapper tetMapper
tetMapper SetInputConnection [tet GetOutputPort]
vtkActor tetActor
tetActor SetMapper tetMapper
vtkPlatonicSolidSource cube
cube SetSolidTypeToCube
vtkPolyDataMapper cubeMapper
cubeMapper SetInputConnection [cube GetOutputPort]
vtkActor cubeActor
cubeActor SetMapper cubeMapper
cubeActor AddPosition 2.0 0 0
vtkPlatonicSolidSource oct
oct SetSolidTypeToOctahedron
vtkPolyDataMapper octMapper
octMapper SetInputConnection [oct GetOutputPort]
vtkActor octActor
octActor SetMapper octMapper
octActor AddPosition 4.0 0 0
vtkPlatonicSolidSource icosa
icosa SetSolidTypeToIcosahedron
vtkPolyDataMapper icosaMapper
icosaMapper SetInputConnection [icosa GetOutputPort]
vtkActor icosaActor
icosaActor SetMapper icosaMapper
icosaActor AddPosition 6.0 0 0
vtkPlatonicSolidSource dode
dode SetSolidTypeToDodecahedron
vtkPolyDataMapper dodeMapper
dodeMapper SetInputConnection [dode GetOutputPort]
vtkActor dodeActor
dodeActor SetMapper dodeMapper
dodeActor AddPosition 8.0 0 0
# Create rendering stuff
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# Add the actors to the renderer, set the background and size
#
ren1 AddActor tetActor
ren1 AddActor cubeActor
ren1 AddActor octActor
ren1 AddActor icosaActor
ren1 AddActor dodeActor
# Create a lookup table with colors for each face
#
vtkMath math
vtkLookupTable lut
lut SetNumberOfColors 20
lut Build
lut SetTableValue 0 1 0 0 1
lut SetTableValue 1 0 1 0 1
lut SetTableValue 2 1 1 0 1
lut SetTableValue 3 0 0 1 1
lut SetTableValue 4 1 0 1 1
lut SetTableValue 5 0 1 1 1
eval lut SetTableValue 6 $spring_green 1.0
eval lut SetTableValue 7 $lavender 1.0
eval lut SetTableValue 8 $mint_cream 1.0
eval lut SetTableValue 9 $violet 1.0
eval lut SetTableValue 10 $ivory_black 1.0
eval lut SetTableValue 11 $coral 1.0
eval lut SetTableValue 12 $pink 1.0
eval lut SetTableValue 13 $salmon 1.0
eval lut SetTableValue 14 $sepia 1.0
eval lut SetTableValue 15 $carrot 1.0
eval lut SetTableValue 16 $gold 1.0
eval lut SetTableValue 17 $forest_green 1.0
eval lut SetTableValue 18 $turquoise 1.0
eval lut SetTableValue 19 $plum 1.0
lut SetTableRange 0 19
tetMapper SetLookupTable lut
tetMapper SetScalarRange 0 19
cubeMapper SetLookupTable lut
cubeMapper SetScalarRange 0 19
octMapper SetLookupTable lut
octMapper SetScalarRange 0 19
icosaMapper SetLookupTable lut
icosaMapper SetScalarRange 0 19
dodeMapper SetLookupTable lut
dodeMapper SetScalarRange 0 19
set cam [ren1 GetActiveCamera]
$cam SetPosition 3.89696 7.20771 1.44123
$cam SetFocalPoint 3.96132 0 0
$cam SetViewUp -0.0079335 0.196002 -0.980571
$cam SetClippingRange 5.42814 9.78848
ren1 SetBackground 0 0 0
renWin SetSize 400 150
iren Initialize
# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
# prevent the tk window from showing up then start the event loop
wm withdraw .
package require vtk
package require vtkinteraction
# Create two polygon sources, one a closed polyline, one a polygon
#
vtkRegularPolygonSource polyline
polyline SetCenter 1 1 1
polyline SetRadius 1
polyline SetNumberOfSides 12
polyline SetNormal 1 2 3
polyline GeneratePolylineOn
polyline GeneratePolygonOff
vtkPolyDataMapper polylineMapper
polylineMapper SetInputConnection [polyline GetOutputPort]
vtkActor polylineActor
polylineActor SetMapper polylineMapper
[polylineActor GetProperty] SetColor 0 1 0
[polylineActor GetProperty] SetAmbient 1
vtkRegularPolygonSource polygon
polygon SetCenter 3 1 1
polygon SetRadius 1
polygon SetNumberOfSides 12
polygon SetNormal 1 2 3
polygon GeneratePolylineOff
polygon GeneratePolygonOn
vtkPolyDataMapper polygonMapper
polygonMapper SetInputConnection [polygon GetOutputPort]
vtkActor polygonActor
polygonActor SetMapper polygonMapper
[polygonActor GetProperty] SetColor 1 0 0
[polygonActor GetProperty] SetAmbient 1
# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# create room profile# Add the actors to the renderer, set the background and size
#
ren1 AddActor polylineActor
ren1 AddActor polygonActor
ren1 SetBackground 0 0 0
renWin SetSize 200 200
renWin Render
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
# prevent the tk window from showing up then start the event loop
wm withdraw .
package require vtk
package require vtkinteraction
# create a rendering window and renderer
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# create cones of varying resolution
vtkConeSource cone0
cone0 SetResolution 0
vtkConeSource cone1
cone1 SetResolution 1
vtkConeSource cone2
cone2 SetResolution 2
vtkConeSource cone8
cone8 SetResolution 8
vtkPolyDataMapper cone0Mapper
cone0Mapper SetInputConnection [cone0 GetOutputPort]
vtkActor cone0Actor
cone0Actor SetMapper cone0Mapper
vtkPolyDataMapper cone1Mapper
cone1Mapper SetInputConnection [cone1 GetOutputPort]
vtkActor cone1Actor
cone1Actor SetMapper cone1Mapper
vtkPolyDataMapper cone2Mapper
cone2Mapper SetInputConnection [cone2 GetOutputPort]
vtkActor cone2Actor
cone2Actor SetMapper cone2Mapper
vtkPolyDataMapper cone8Mapper
cone8Mapper SetInputConnection [cone8 GetOutputPort]
vtkActor cone8Actor
cone8Actor SetMapper cone8Mapper
# assign our actor to the renderer
ren1 AddActor cone0Actor
ren1 AddActor cone1Actor
ren1 AddActor cone2Actor
ren1 AddActor cone8Actor
ren1 SetBackground .5 .5 .5
ren1 ResetCamera
[ren1 GetActiveCamera] Elevation 30
[ren1 GetActiveCamera] Dolly 1.3
ren1 ResetCameraClippingRange
renWin SetSize 301 91
cone0Actor SetPosition -1.5 0 0
cone1Actor SetPosition -.5 0 0
cone2Actor SetPosition .5 0 0
cone8Actor SetPosition 1.5 0 0
[cone0Actor GetProperty] SetDiffuseColor 1 0 0
[cone1Actor GetProperty] SetDiffuseColor 0 1 0
[cone8Actor GetProperty] BackfaceCullingOn
[cone8Actor GetProperty] SetDiffuseColor 0 0 1
# enable user interface interactor
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
# prevent the tk window from showing up then start the event loop
wm withdraw .
package require vtk
package require vtkinteraction
# Create some random points, scalars, and vectors to glyph
#
vtkPolyData pd
vtkPoints pts
vtkFloatArray scalars
vtkFloatArray vectors
vectors SetNumberOfComponents 3
pd SetPoints pts
[pd GetPointData] SetScalars scalars
[pd GetPointData] SetVectors vectors
vtkMath math
set size 500
for {set i 0} {$i < 100} {incr i} {
pts InsertNextPoint [math Random 0 [expr $size - 1]] \
[math Random 0 [expr $size - 1]] 0.0
scalars InsertNextValue [math Random 0.0 5]
vectors InsertNextTuple3 [math Random -1 1] [math Random -1 1] 0.0
}
vtkGlyphSource2D gs
gs SetGlyphTypeToCircle
gs SetScale 20
gs FilledOff
gs CrossOn
gs Update
vtkGlyphSource2D gs1
gs1 SetGlyphTypeToTriangle
gs1 SetScale 20
gs1 FilledOff
gs1 CrossOn
gs1 Update
vtkGlyphSource2D gs2
gs2 SetGlyphTypeToSquare
gs2 SetScale 20
gs2 FilledOff
gs2 CrossOn
gs2 Update
vtkGlyphSource2D gs3
gs3 SetGlyphTypeToDiamond
gs3 SetScale 20
gs3 FilledOff
gs3 CrossOn
gs3 Update
vtkGlyphSource2D gs4
gs4 SetGlyphTypeToDiamond
gs4 SetScale 20
gs4 FilledOn
gs4 DashOn
gs4 CrossOff
gs4 Update
vtkGlyphSource2D gs5
gs5 SetGlyphTypeToThickArrow
gs5 SetScale 20
gs5 FilledOn
gs5 CrossOff
gs5 Update
# Create a table of glyphs
vtkGlyph2D glypher
glypher SetInputData pd
glypher SetSourceData 0 [gs GetOutput]
glypher SetSourceData 1 [gs1 GetOutput]
glypher SetSourceData 2 [gs2 GetOutput]
glypher SetSourceData 3 [gs3 GetOutput]
glypher SetSourceData 4 [gs4 GetOutput]
glypher SetSourceData 5 [gs5 GetOutput]
glypher SetIndexModeToScalar
glypher SetRange 0 5
glypher SetScaleModeToDataScalingOff
vtkPolyDataMapper2D mapper
mapper SetInputConnection [glypher GetOutputPort]
mapper SetScalarRange 0 5
vtkActor2D glyphActor
glyphActor SetMapper mapper
# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin SetMultiSamples 0
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# Add the actors to the renderer, set the background and size
#
ren1 AddActor glyphActor
ren1 SetBackground 1 1 1
renWin SetSize $size $size
renWin Render
# 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 .
package require vtk
package require vtkinteraction
vtkRenderWindow renWin
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkRenderer renderer
renWin AddRenderer renderer
vtkSphereSource src1
src1 SetRadius 5
src1 SetPhiResolution 20
src1 SetThetaResolution 20
vtkPolyDataMapper mapper
mapper SetInputConnection [src1 GetOutputPort]
vtkActor actor
actor SetMapper mapper
# Load the material. Here, we are loading a material
# defined in the Vtk Library. One can also specify
# a filename to a material description xml.
[actor GetProperty] LoadMaterial "GLSLTwisted"
# Turn shading on. Otherwise, shaders are not used.
[actor GetProperty] ShadingOn
# Pass a shader variable need by GLSLTwisted.
[actor GetProperty] AddShaderVariable "Rate" 1.0
renderer AddActor actor
renWin Render
[renderer GetActiveCamera] Azimuth -50
[renderer GetActiveCamera] Roll 70
renWin Render
wm withdraw .
# tests the support to pass generic vertex attributes to be used in Cg shaders.
set xmlMaterial {<?xml version="1.0" encoding="UTF-8"?>
<Material name="GenericAttributes1">
<Shader
scope="Vertex"
name="VertexShader"
location="Inline"
language="GLSL"
entry="main">
attribute vec3 genAttrVector;
varying vec4 color;
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix *gl_Vertex;
color = vec4(normalize(genAttrVector), 1.0);
}
</Shader>
<Shader scope="Fragment" name="FragmentShader" location="Inline"
language="GLSL" entry="main">
varying vec4 color;
void main(void)
{
gl_FragColor = color;
}
</Shader>
</Material>
}
package require vtk
package require vtkinteraction
vtkRenderWindow renWin
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkRenderer renderer
renWin AddRenderer renderer
vtkSphereSource src1
src1 SetRadius 5
src1 SetPhiResolution 20
src1 SetThetaResolution 20
vtkBrownianPoints randomVectors
randomVectors SetMinimumSpeed 0
randomVectors SetMaximumSpeed 1
randomVectors SetInputConnection [src1 GetOutputPort]
vtkPolyDataMapper mapper
mapper SetInputConnection [randomVectors GetOutputPort]
vtkActor actor
actor SetMapper mapper
# Load the material. Here, we are loading a material
# defined in the Vtk Library. One can also specify
# a filename to a material description xml.
[actor GetProperty] LoadMaterialFromString $xmlMaterial