<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Dear All,<br><br>Is it possible to set both a varying radius *and* independently varying color (scalar, RGB triples...) when using vtkTubeFilter? (i.e. with two sets of scalar arrays)<br><br>I have a running code using SetVaryRadiusToVaryRadiusByScalar (with scalar values added to the input vtkPolyData with "...->GetPointData()->SetScalars(...)").<br><br>The coloring of the resulting tube is also then based on these same scalars...<br>I would have liked to set the RGB values for each segment of the tube using another vtkUnsignedCharArray of RGB triples, as I do for surfaces.<br><br>An excerpt of the (fairly unoriginal) code is as follows:<br><br>//------------------<br>...<br><br>// v: Pointer to array of tube path coordinates<br>// nV: Length of v<br><br>// Tube path points<br>vtkSmartPointer<vtkPoints> tpoints =
vtkSmartPointer<vtkPoints>::New();<br>for(i=0; i<nV; i++) tpoints->InsertPoint(i,v[i],v[nV+i],v[2*nV+i]);<br><br>// and (somewhat trivial) lines<br>vtkSmartPointer<vtkCellArray> tlines = vtkSmartPointer<vtkCellArray>::New();<br>tlines->InsertNextCell(nV);<br>for (i=0; i < nV; i++) tlines->InsertCellPoint(i);<br><br>// Scalars for tube radius (from array 'trad')<br>vtkSmartPointer<vtkDoubleArray> tscalars = vtkSmartPointer<vtkDoubleArray>::New();<br>tscalars->SetNumberOfTuples(nV);<br>for (i=0 ;i<nV ; i++) tscalars->SetTuple1(i,trad[i]);<br>tscalars->GetRange(tscalar_range);<br><br>vtkSmartPointer<vtkPolyData> tprofile = vtkSmartPointer<vtkPolyData>::New();<br>tprofile->SetPoints((vtkPoints *)(tpoints));<br>tprofile->SetLines(tlines);<br>tprofile->GetPointData()->SetScalars(tscalars);<br>tprofile->BuildLinks();<br><br>vtkSmartPointer<vtkTubeFilter> tube =
vtkSmartPointer<vtkTubeFilter>::New();<br>tube->SetInput(tprofile);<br>tube->SetVaryRadiusToVaryRadiusByScalar();<br>tube->SetRadius(tscalar_range[0]);<br>tube->SetRadiusFactor(tscalar_range[1]/tscalar_range[0]);<br><br>vtkSmartPointer<vtkPolyDataMapper> tubeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();<br>tubeMapper->SetInput(tube->GetOutput());<br>surfActor->SetMapper(tubeMapper);<br>...<br>//------------------<br><br>Many thanks, MT<br><br><br><br></td></tr></table><br>__________________________________________________<br>Do You Yahoo!?<br>Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. <br>http://mail.yahoo.com