[vtkusers] Problem with vtkUnstructuredGrid

Parvaneh Saeedi parvanes at ece.ubc.ca
Thu Jul 4 17:22:12 EDT 2002


Hi vtk users,

I am trying to move an object along a known 3D path. In order to make my
motion smoother I interpolate the 3D position between every two points of
the path and update the position of my moving object. I have used the
UnstructuredGrid to create my path.

These are my definitions:

vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::New();
    ugrid->Allocate(5);
 ugrid->SetPoints(vtkpoints);

vtkDataSetMapper *ugridMapper = vtkDataSetMapper::New();
   ugridMapper->SetInput(ugrid);
   ugridMapper->ImmediateModeRenderingOn();

vtkActor *ugridActor = vtkActor::New();
   ugridActor->SetMapper(ugridMapper);
   ugridActor->GetProperty()->SetColor(1,1,1);

ren1->AddActor(ugridActor);

vtkpoints->SetPoint(0,acc_pos[0], acc_pos[1],acc_pos[2]);  <-This is my very
first point of the path.

In each frame of  i, I add a cell . My pts are {{0, 1}, {1, 2}, {2, 3},
.....}.

ugrid->InsertNextCell(VTK_LINE, 2, pts[i-1]);

then for no_steps I change the value of the end point of the current cell
and I try to display such a line.

vtkpoints->InsertPoint(i, acc_dx, acc_dy, acc_dz);

My problem here is that I can not display such changes on my rendering
window. Although the values are set properly for the vtkpoints, I can only
show the very first segment of the very first line. After that I don't see
any changes. If  I set the vtkpoints values but  don't render them and only
once at the end  update the vtkDataSetMapper then I see the total path. This
however is not what I want.

I hope someone knows why such a thing happens and can provide me with some
guidance.

Thanks,

Parvaneh Saeedi





More information about the vtkusers mailing list