[vtkusers] VTKPolydata -Points modify

Ganesh Sankaranarayanan ganeshs at uta.edu
Sun Jul 15 17:19:59 EDT 2001


Hello VTK Users,

In one of my application i read the points and connectivity from
vtkPolydata.I modify the points
in my deformation routine and reload it to vtkPolydata so that the new
points are rendered.
I encountered problems in reloaded points to vtkPolydata.
I tested with a sphere Source

vtkPolyData *poly=sphere->GetOutput();
//This is the part of the code in which i transfer  the points where p is
the pointer to a float array of size 3
	sphere->Update();
	{
	p=poly->GetPoint(i);
	mass[k].x[0]=*p;
	mass[k].x[1]=*(p+1);
	mass[k].x[2]=*(p+2);
	}

//This is the part of the code in which i transfer the polygon and
connectivity
vtkCellArray *cells=poly->GetVerts();
vtkIntArray *polyarray=vtkIntArray::New();
cells=poly->GetPolys();
polyarray=(vtkIntArray *)cells->GetData();

After i modify the points is there any easy way to put the points back in
Polydata.I tried doing  this way.
vtkPoints *points=vtkPoints::New();

	{
	temp[0]=mass[i].x[0];
	temp[1]=mass[i].x[1];
	temp[2]=mass[i].x[2];
	points->InsertPoint(i,temp);
	}
	poly->SetPoints(points);
	poly->Update();
This part gives me unexpected results.I suspect it is the prob in the way i
put the points back.Is there any simple way to set the points?

Thanks,
Ganesh





More information about the vtkusers mailing list