[vtkusers] Updating

Renato Cesar Pompeu rcpompeu at hotmail.com
Mon May 5 19:06:01 EDT 2008


Hi All,
 
I have a value generated by a timer component (Vmaxgrad[i][j][k]). 
How is it possible to update an actor with these generated values?
 
Thanks a lot.
 
 
Her is my code:
 
vtkFloatArray *vetores = vtkFloatArray::New();  vetores->SetNumberOfComponents(3);
vtkPoints *pontos = vtkPoints::New();
vtkFloatArray *xCoords = vtkFloatArray::New();for (i=0; i<=a; i++) xCoords->InsertNextValue(xv[i]);
vtkFloatArray *yCoords = vtkFloatArray::New();for (i=0; i<=b; i++) yCoords->InsertNextValue(yv[i]);
vtkFloatArray *zCoords = vtkFloatArray::New();for (i=0; i<=c; i++) zCoords->InsertNextValue(zv[i]);
vtkRectilinearGrid *rgrid = vtkRectilinearGrid::New();  rgrid->SetDimensions(a+1,b+1,c+1);  rgrid->SetXCoordinates(xCoords);  rgrid->SetYCoordinates(yCoords);  rgrid->SetZCoordinates(zCoords);
vtkDoubleArray *array = vtkDoubleArray::New();  for (k=0; k<=c; k++)  for (j=0; j<=b; j++)  for (i=0; i<=a; i++) {        array->InsertValue(k*(a+1)*(b+1)+j*(a+1)+i, Vmaxgrad[i][j][k]);        pontos->InsertPoint(k*(a+1)*(b+1)+j*(a+1)+i, i, j, k);        vetores->InsertTuple3(k*(a+1)*(b+1)+j*(a+1)+i, vx[i][j][k], vy[i][j][k], vz[i][j][k]);}  rgrid->GetPointData()->SetVectors(vetores);  rgrid->GetPointData()->SetScalars(array);
vtkRectilinearGridGeometryFilter *plane = vtkRectilinearGridGeometryFilter::New();  plane->SetInput(rgrid);
vtkLookupTable *Table = vtkLookupTable::New();  Table->SetNumberOfColors(150);  Table->SetHueRange(0.667 , 0);  Table->SetRange(rgrid->GetScalarRange());
vtkRectilinearGridOutlineFilter *outline = vtkRectilinearGridOutlineFilter::New();  outline->SetInput(rgrid);
vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();  outlineMapper->SetInputConnection(outline->GetOutputPort());
vtkActor *outlineActor = vtkActor::New();  outlineActor->SetMapper(outlineMapper);  outlineActor->GetProperty()->SetColor( 0, 0, 0);
 
 
  VTK3->GetRenderer()->AddActor(outlineActor);  }
_________________________________________________________________
Confira vídeos com notícias do NY Times, gols direto do Lance, videocassetadas e muito mais no MSN Video!
http://video.msn.com/?mkt=pt-br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080505/4db0a311/attachment.htm>


More information about the vtkusers mailing list