[vtkusers] failed to add a group of points and cells to existed polydata

Tasnim hanene-jeder at hotmail.fr
Fri Sep 14 16:01:06 EDT 2012


good evening vtkUsers,
I stored a list of point's coordinates in a first vector, and a list of
cell's vertex in a second vector. when, i tried to add just 3 or 4 points
and their faces, i can visualize that there are new cells in my polydata.
But when i tried to add all vertor's points and cells, i see like  if i
added just one point and the other points are connected to it.

 double* ss=vertex[0];// 2D vector of new vertex
	   int a=polydata->GetNumberOfPoints();
		  int b=a+1;
		 int c=a+2;
for( int i=0; i<nbrligne;i++)
{
	double* b=vertex[i];
	int number=polydata->GetNumberOfPoints();

polydata->GetPoints()->InsertPoint(number,b[0],b[1],b[2]);  
polydata->GetPoints()->Modified(); 
polydata->Modified(); 
polydata->Update();
}
int j=0;
 while(j<nbrface)
 {
	 int pp=polydata->GetNumberOfPoints();
	 int* f=face[j];
	 int p0=pp+f[0];
	 int p1=pp+f[1];
	 int p2=pp+f[2];
	 vtkIdList* pts=vtkIdList::New(); 
pts->InsertId(0,p0); 
pts->InsertNextId(p1); 
pts->InsertNextId(p2); 
polydata->GetPolys()->InsertNextCell(pts); 
polydata->BuildCells();
polydata->GetPolys()->Modified(); 
polydata->Modified(); 
polydata->Update(); 
j++;
  }


Any suggestion to correct my function is welcome and thanks in advance.

Tasnim



--
View this message in context: http://vtk.1045678.n5.nabble.com/failed-to-add-a-group-of-points-and-cells-to-existed-polydata-tp5716095.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list