Hi <div>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!</div>


<div><br></div><div>Thanks </div><div>Dotcho</div><div><br></div><div><div>vtkPoints* pnts = vtkPoints::New();</div><div><span style="white-space:pre-wrap">        </span>vtkCellArray* cells = vtkCellArray::New();</div><div><span style="white-space:pre-wrap">        </span>vtkPolyData* polys = vtkPolyData::New();</div>


<div><span style="white-space:pre-wrap">        </span>vtkPolyDataNormals* norms = vtkPolyDataNormals::New();</div><div><span style="white-space:pre-wrap">        </span>pnts-&gt;SetNumberOfPoints(isurf-&gt;numvrts);</div>
<div><span style="white-space:pre-wrap">        </span>for(ii=0;ii&lt;isurf-&gt;numvrts;ii++)</div><div><span style="white-space:pre-wrap">                </span>pnts-&gt;InsertPoint(ii,isurf-&gt;vertices[3*ii],isurf-&gt;vertices[3*ii+1],isurf-&gt;vertices[3*ii+2]);</div>


<div><span style="white-space:pre-wrap">        </span>for(ii=0; ii&lt;isurf-&gt;numtris;ii++)</div><div><span style="white-space:pre-wrap">                </span>cells-&gt;InsertNextCell(3,reinterpret_cast&lt;vtkIdType*&gt;(isurf-&gt;triangles+3*ii));</div>


<div><span style="white-space:pre-wrap">        </span>polys-&gt;SetPoints(pnts);<span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>polys-&gt;SetPolys(cells);</div>
<div><span style="white-space:pre-wrap">        </span>polys-&gt;Update();</div><div><span style="white-space:pre-wrap">        </span><font color="#990000">polys-&gt;BuildLinks();<span style="white-space:pre-wrap">        </span>//polys-&gt;BuildLinks(0);</font></div>


<div><br></div><div><span style="white-space:pre-wrap">        </span>norms-&gt;SetInput(polys);</div><div><span style="white-space:pre-wrap">        </span>vtkCurvatures* mcurv = vtkCurvatures::New();</div>
<div><span style="white-space:pre-wrap">        </span>mcurv-&gt;SetInputConnection(norms-&gt;GetOutputPort());</div><div><span style="white-space:pre-wrap">        </span>mcurv-&gt;SetCurvatureTypeToMean();</div>
<div><span style="white-space:pre-wrap">        </span>mcurv-&gt;Update();</div><div><br></div><div><span style="white-space:pre-wrap">        </span>pnts-&gt;Delete();</div><div><span style="white-space:pre-wrap">        </span>cells-&gt;Delete();</div>


<div><span style="white-space:pre-wrap">        </span>polys-&gt;Delete();</div><div><span style="white-space:pre-wrap">        </span>norms-&gt;Delete();</div><div><span style="white-space:pre-wrap">        </span>mcurv-&gt;Delete();</div>
</div><div><br></div><div><br></div><div> <br></div>