You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
package require vtk
|
|
package require vtkinteraction
|
|
|
|
vtkSphereSource sphere
|
|
|
|
vtkElevationFilter elevation
|
|
elevation SetInputConnection [sphere GetOutputPort]
|
|
elevation SetLowPoint -1 0 0
|
|
elevation SetHighPoint 1 0 0
|
|
|
|
vtkPointDataToCellData p2c
|
|
p2c SetInputConnection [elevation GetOutputPort]
|
|
|
|
vtkStripper stripper
|
|
stripper SetInputConnection [p2c GetOutputPort]
|
|
stripper PassCellDataAsFieldDataOn
|
|
|
|
vtkPolyDataMapper sphereMapper
|
|
sphereMapper SetInputConnection [stripper GetOutputPort]
|
|
sphereMapper SelectColorArray "Elevation"
|
|
sphereMapper SetColorModeToMapScalars
|
|
sphereMapper SetScalarModeToUseFieldData
|
|
sphereMapper SetScalarRange 0.28 0.72
|
|
|
|
vtkActor sphereActor
|
|
sphereActor SetMapper sphereMapper
|
|
#interpolation must be set to flat for cell colors to work
|
|
#for triangle strips.
|
|
[sphereActor GetProperty] SetInterpolationToFlat
|
|
|
|
vtkRenderer ren1
|
|
ren1 AddActor sphereActor
|
|
|
|
vtkRenderWindow renWin
|
|
renWin AddRenderer ren1
|
|
renWin SetSize 200 200
|
|
|
|
vtkRenderWindowInteractor iren
|
|
iren SetRenderWindow renWin
|
|
|
|
iren AddObserver UserEvent {wm deiconify .vtkInteract}
|
|
renWin Render
|
|
wm withdraw .
|
|
|