[vtkusers] Create Cells from Points

David Doria daviddoria at gmail.com
Tue Feb 10 13:30:44 EST 2009


If I create points one at a time, I have to add them to a CellArray
one at a time too, like this

vtkPoints* points3D = vtkPoints::New();
vtkCellArray* Vertices = vtkCellArray::New();

for ( unsigned int i = 0; i < NumPoints(); ++i )
{	
	vtkIdType pid[1];
	vgl_point_3d<double> Point = getPoint(i);
	pid[0] = points3D->InsertNextPoint(Point.x(), Point.y(), Point.z());
	Vertices->InsertNextCell(1,pid);
}

Is there a better way to do this? Also, what is the idea of having to
use cells for everything rather than operating on the array of points
directly?


-- 
Thanks,

David



More information about the vtkusers mailing list