[vtkusers] How to color a line
Patrick (Peng) Cheng
peng-cheng at uiowa.edu
Thu Jul 29 13:20:25 EDT 2004
Hi,
I have the following code to draw a tube in the scene.
The tube is of the same color. Now I have some scalar values at each point
How do I use something like lookup table to color the line according to the
scalar values. Thanks a lot
vtkPolyData *data = vtkPolyData::New();
data->SetPoints(points); // points is vtkPoints
data->SetLines(line); // line is vtkCellArray
vtkCleanPolyData *clean = vtkCleanPolyData::New();
clean->SetInput(data);
vtkTubeFilter *tube = vtkTubeFilter::New();
tube->SetInput(clean->GetOutput());
tube->SetRadius(0.6);
tube->SetNumberOfSides(6);
tube->SetVaryRadiusToVaryRadiusOff();
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(tube->GetOutput());
vtkProperty *pro = vtkProperty::New();
pro->SetColor(1,0,0);
vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
actor->SetProperty(pro);
---------------------------
Patrick (Peng) Cheng
Biomedical Engineering
University of Iowa
Tel:(319) 400-7442
Email: peng-cheng at uiowa.edu
More information about the vtkusers
mailing list