[vtkusers] Updating

Renato Cesar Pompeu rcpompeu at hotmail.com
Tue May 6 10:51:40 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);  }
_________________________________________________________________
Conheça o Windows Live Spaces, a rede de relacionamentos do Messenger!
http://www.amigosdomessenger.com.br/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080506/c74d0e3d/attachment.htm>


More information about the vtkusers mailing list