[vtkusers] delete points
rimona
rim_slama at yahoo.fr
Fri Nov 5 08:54:46 EDT 2010
I need to reuse the polydata (after deleeting the points), the probleme is
that poly->deletepoint(i), only mark ième point as deleted but don't remove
it from the structure, i want delete it and it's links frim the structure
and can see really fewer points in polydata when i do
poly->getnumberofpoints();
here is two ways i tried to do :
1- i tried to guet vtkpoints structure of the polydata and keep up points i
want to delete and then do
poly->setpoints(point), point:is the polydata reconstructed with deleted
point. the problem here is that links are generated in a wrong way.
//////////////////////////////////////////////////////////////
vtkPLYReader *ply_ref=vtkPLYReader::New();
ply_ref->SetFileName("D:\\B**.ply");
out=ply_test->getoutput();
for (vtkIdType i=0;i<ply_test->GetOutput()->GetNumberOfPoints();i++){
dist = m->Distance2BetweenPoints(out->GetPoint(i),
ply_ref->GetOutput()->GetPoint(loc->FindClosestPoint(out->GetPoint(i))));
Point=out->GetPoints();
if(dist>seuil)
{
ReallyDeletePoint(Point,i);
out->GetPointCells(i,cellIds);
for(vtkIdType j=0;j<cellIds->GetNumberOfIds();j++){
b=cellIds->GetId(j);
out->BuildLinks();
out->RemoveReferenceToCell(i,b);
}
//
out->ResizeCellList(i,(out->GetNumberOfCells()-cellIds->GetNumberOfIds()));
//out->DeletePoint(i);
}
}out->BuildLinks();
out->SetPoints(Point);
void ReallyDeletePoint(vtkPoints* Points, unsigned int id)
{
vtkSmartPointer<vtkPoints> NewPoints = vtkSmartPointer<vtkPoints>::New();
for(unsigned int i = 0; i < Points->GetNumberOfPoints(); i++)
{
if(i != id)
{
double p[3];
Points->GetPoint(i,p);
NewPoints->InsertNextPoint(p);
}
}
Points->ShallowCopy(NewPoints);
}
2-i make only delete point and then tried to delete its links to cells but
it is bloked when doing buildlinks or it doesn't work.
for (vtkIdType i=0;i<ply_test->GetOutput()->GetNumberOfPoints();i++){
dist = m->Distance2BetweenPoints(out->GetPoint(i),
ply_ref->GetOutput()->GetPoint(loc->FindClosestPoint(out->GetPoint(i))));
if(dist>seuil)
{cmp++;
out->GetPointCells(i,cellIds);
for(int j=0;j<cellIds->GetNumberOfIds();j++){
out->DeleteCell(cellIds->GetId(j));
}
out->DeletePoint(i);
}
}
out->RemoveDeletedCells();
out->DeleteLinks();
out->Modified();
out->Update();
/////////////////////////////////////////////
after that i neet out to do an other treetment on it after deleeting this
points.
--
View this message in context: http://vtk.1045678.n5.nabble.com/delete-points-tp3251583p3251757.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list