[vtkusers] coloring vector-data
mirko heuegger
mheuegger at gmail.com
Thu Oct 23 09:49:39 EDT 2008
Hello!
I am trying to colour a simple vector in a Unstructured Grid.
But I'm unable to color the grids by this vector-data,
the result from my coding are everytime white polygons.
The sample code in python:
import vtk
dataReader = vtk.vtkDataSetReader()
dataReader.SetFileName(" ... twoVectorsInUnstructGrid.vtk")
dataReader.Update()
dataMapper = vtk.vtkDataSetMapper()
dataMapper.SetInput(dataReader.GetOutput())
dataReader.SetVectorsName("vector")
dataMapper.SetScalarModeToUseCellData()
dataMapper.SelectColorArray("vector")
dataMapper.GetLookupTable().SetVectorModeToMagnitude()
dataMapper.GetLookupTable().SetRange(0.9, 3)
Actor = vtk.vtkActor()
Actor.SetMapper(dataMapper)
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.AddActor(Actor)
iren.Initialize()
renWin.Render()
iren.Start()
And the corresponding vtk-file:
# vtk DataFile Version 3.1
file is twoVectorsInUnstructGrid.vtk
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 8 float
0 0 0
1 0 0
1 0.5 0
0 0.5 0
0 1 0
1 1 0
1 1.5 0
0 1.5 0
CELLS 2 10
4 0 1 2 3
4 4 5 6 7
CELL_TYPES 2
9 9
CELL_DATA 2
VECTORS vector float
1.5 1.5 0
-1.0 -1.0 0
Does anyone have any hints how to color vector-data properly?
Thanks in Advance.
Mirko
--
Real programmers don't document; if it was
hard to write, it should be hard to understand.
More information about the vtkusers
mailing list