[vtkusers] how to link new points added to a polydata
cerina
cerine-baratelli at hotmail.fr
Thu Sep 13 10:18:57 EDT 2012
David Doria-2-3 wrote
>
> Please make a compile example of the problem. It seems to me like the
> problem doesn't have anything to do with the way you are getting the
> points to add, so you should be able to do this in < 20 lines. (See
> http://www.vtk.org/Wiki/VTK/MinimalExample for more details).
>
> David
>
Thanks David, I resolved it.
i replace the prevous code with this:
int a=polydata->GetNumberOfPoints()-1;
int b=a+1;
int c=a+2;
polydata->GetPoints()->InsertPoint(a,-1.79482e-008, 0.12, -0.48);
polydata->GetPoints()->InsertPoint(b,-0.00083353, 0.12, -0.00472707);
polydata->GetPoints()->InsertPoint(c,-0.00164172, 0.12, -0.00451052);
polydata->GetPoints()->Modified();
polydata->Modified();
polydata->Update();
vtkIdList* pts=vtkIdList::New();
pts->InsertId(0,a);
pts->InsertNextId(b);
pts->InsertNextId(c);
cout<<"ok creation de pts"<<endl;
polydata->GetPolys()->InsertNextCell(pts);
polydata->BuildCells();
cout<<"ok ajout de cellule de pts"<<endl;
vtkIdList* ptss=vtkIdList::New();
ptss->InsertId(0,11);
ptss->InsertNextId(a);
ptss->InsertNextId(b);
polydata->GetPolys()->InsertNextCell(ptss);
polydata->GetPolys()->Modified();
polydata->Modified();
polydata->Update();
And it works: it adds new points, and new cells also :)
--
View this message in context: http://vtk.1045678.n5.nabble.com/how-to-link-new-points-added-to-a-polydata-tp5716039p5716052.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list