[vtkusers] run time error when calling BuildLinks() method of vtkPolyData class

Reda, Fitsum A fitecx at gmail.com
Wed Mar 14 18:03:29 EDT 2012


Hi
I was trying to compute curvature of a triangular 3D surface mesh using the
vtkCurvature class. I converted my surface data structure (isurf) to
vtkPolyData but I get run time error (Access violation reading
location.....) when I call the BuildLinks () method of the vtkPolyData
class. The code is shown below, in red is the line that is causing the run
time error.... I would appreciate your help as always!

Thanks
Dotcho

vtkPoints* pnts = vtkPoints::New();
vtkCellArray* cells = vtkCellArray::New();
vtkPolyData* polys = vtkPolyData::New();
 vtkPolyDataNormals* norms = vtkPolyDataNormals::New();
pnts->SetNumberOfPoints(isurf->numvrts);
 for(ii=0;ii<isurf->numvrts;ii++)
pnts->InsertPoint(ii,isurf->vertices[3*ii],isurf->vertices[3*ii+1],isurf->vertices[3*ii+2]);
 for(ii=0; ii<isurf->numtris;ii++)
cells->InsertNextCell(3,reinterpret_cast<vtkIdType*>(isurf->triangles+3*ii));
 polys->SetPoints(pnts);
polys->SetPolys(cells);
 polys->Update();
polys->BuildLinks(); //polys->BuildLinks(0);

norms->SetInput(polys);
vtkCurvatures* mcurv = vtkCurvatures::New();
 mcurv->SetInputConnection(norms->GetOutputPort());
mcurv->SetCurvatureTypeToMean();
 mcurv->Update();

pnts->Delete();
cells->Delete();
 polys->Delete();
norms->Delete();
mcurv->Delete();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120314/f9a0c1e5/attachment.htm>


More information about the vtkusers mailing list