[vtkusers] vtkPolyData & vtkActor...
Andrea Gavana
andrea.gavana at gmail.com
Sun Apr 9 12:33:30 EDT 2006
Hello NG,
I am trying to visualize some lines in a 3D space. Every line may
have 2 different colours depending on the state of a certain variable,
something like:
a) MyVariable = True => Line is Red
b) MyVariable = False => Line is Grey
At the moment, I am doing this (sorry, it's Python):
for ii in range(len(MyLines)):
poly = vtk.vtkPolyData()
poly.SetPoints(vtk_pts)
poly.SetLines(vtk_lines)
profileTubes = vtk.vtkTubeFilter()
profileTubes.SetRadius(radius)
profileTubes.SetNumberOfSides(20)
profileTubes.SetInput(poly)
wellMapper = vtk.vtkPolyDataMapper()
wellMapper.SetInput(profileTubes.GetOutput())
wellMapper.GlobalImmediateModeRenderingOn()
wellActor = vtk.vtkActor()
wellActor.SetMapper(wellMapper)
if MyVariable:
wellActor.GetProperty().SetColor(red)
else:
wellActor.GetProperty().SetColor(grey)
But this snippet of code creates a polydata, filter, a mapper for
every line I have... this, together with the unstructured grid I also
visualize, may kill the performances of my app.
Is there a way to specify all the lines and the points in a single
call to vtkPolyData, putting them in a single vtkTubeFilter, using a
single vtkPolyDataMapper and then assigning an actor to every line in
vtkPolyData? Or is there a better alternative to what I am doing now?
Thank you very much for your suggestions.
Andrea.
--
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/
More information about the vtkusers
mailing list