[vtkusers] how to link new points added to a polydata

David Doria daviddoria at gmail.com
Thu Sep 13 08:01:29 EDT 2012


On Thu, Sep 13, 2012 at 6:15 AM, cerina <cerine-baratelli at hotmail.fr> wrote:
> Good morning,
> I have a 3D Mesh, with the MouseinteractorStyle class i added new points to
> this polydata. But, how can I build links between those points and the
> existed points of my polydata (adding edges, creating cells for my new
> points...)
> here is how i added the new points:
> polydata->GetPoints()->InsertPoint(150,-1.79482e-008, 0.0012, -0.0048);
> polydata->GetPoints()->InsertPoint(151,-0.00083353, 0.0012, -0.00472707);
> polydata->GetPoints()->InsertPoint(152,-0.00164172, 0.0012, -0.00451052);
> cout<<"ok d'insertion des points"<<endl;
> polydata->GetPoints()->Modified();
> polydata->Modified();
> polydata->Update();
> polydata->IsEdge(150,151);
> polydata->IsEdge(150,152);
> polydata->IsEdge(151,152);
> cout<<"ok d'insertion edge"<<endl;
> polydata->BuildLinks(3);
> vtkIdList* pts=vtkIdList::New();
> pts->InsertId(0,150);
> pts->InsertNextId(151);
> pts->InsertNextId(152);
> polydata->GetPolys()->InsertNextCell(pts);
> vtkIdList* ptss=vtkIdList::New();
> ptss->InsertId(0,11);
> ptss->InsertNextId(151);
> ptss->InsertNextId(152);
> polydata->GetPolys()->InsertNextCell(ptss);
> polydata->GetPolys()->Modified();
> polydata->Modified();
> polydata->Update();
>
> this example is added to the MouseInteractorStyle of the sphereSource
> example.When running my program, the points are added, but the cells and
> egde are not (the program is crashed when it come to add edges)
>
> is there any suggestion to how to do this.
> thanks
>
> Cerina

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



More information about the vtkusers mailing list