[vtkusers] Manually constructing a vtkPolyData

Randall Hand randall.hand at gmail.com
Tue May 17 17:15:49 EDT 2005


I have a code block similar to this:

// First load the points
vtkPoints *newPts = vtkPoints::New();
newPts->Allocate(countVert);
for(i=1; i<=countVert; i++) {
newPts->InsertPoint(i-1, x, y, z);
}

// Now load up the connectivity
vtkIdList *pts = vtkIdList::New();
pts->Allocate(VTK_CELL_SIZE);
vtkCellArray *newPolys = vtkCellArray::New();
newPolys->Allocate(countPoly);

for(i=1; i<=countPoly; i++) {
pts->Reset();
pts->InsertNextId(v1-1);
pts->InsertNextId(v2-1);
pts->InsertNextId(v3-1);
newPolys->InsertNextCell(pts);
}
fclose(fptr);

vtkPolyData *output = vtkPolyData::New();
output->SetPoints(newPts);
newPts->Delete();
output->SetPolys(newPolys);
newPolys->Delete();
pts->Delete();

Now when I try to query the resulting vtkPolyData, I get segfaults in the 
ComputeBounds routines. I tried connecting it to a vtkPLYWriter, and it 
saves a file to disk that crashes both 3DSMax & Paraview. Any ideas what I'm 
missing here?

-- 
Randall Hand
http://www.yeraze.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050517/8e639e7d/attachment.htm>


More information about the vtkusers mailing list