<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hi,<div><br></div><div>I have a crash when using vtkDecimatePro (vtk 6.3) if my input has normals with the CopyNormals flag set to 0 (='off').</div><div><br></div><div>Attached is a reproductible case with its input.</div><div><br></div><div>The crash occurs at line 409:</div><div>outputPD->CopyData(meshPD,ptId,map[ptId]);<br></div><div><br></div><div>because it tries to access a part of a normals array that has not been computed properly due to the fact that it was marked with the flag to off.</div><div><br></div><div>The flag is set in vtkPolyDataNormals. A workaround is to set it back to on before the decimation, but i would like to understand what is the issue.</div><div><br></div><div>First, why this flag is not set back to On at the end of the normals filter (but other filters like vtkTransformPolyDataFilter will set it to off as well, producing the crash)?</div><div><br></div><div>And second, is there something to fix in vtkDecimatePro?</div><div><br></div><div><br></div><div>Thanks for your feedback</div><div><br></div><div><br></div><div>link to data (vtp): <b style="color:rgb(0,0,255);font-family:Arial;font-size:10pt"><a href="http://www.filedropper.com/mesh9">http://www.filedropper.com/mesh9</a></b></div>
<table>
</table><div><br></div><div><br></div><div><div>#include <vtkSmartPointer.h></div><div>#include <vtkXMLPolyDataReader.h></div><div>#include <vtkDecimatePro.h></div><div>#include <vtkPolyData.h></div><div>#include <vtkPolyDataNormals.h></div><div><br></div><div>int main ()</div><div>{</div><div> // Read the input polydata</div><div> vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();</div><div> reader->SetFileName("./Mesh9.vtp");</div><div> reader->Update();</div><div><br></div><div> vtkSmartPointer<vtkPolyDataNormals> norm = vtkSmartPointer<vtkPolyDataNormals>::New();</div><div> norm->SetInputConnection(reader->GetOutputPort());</div><div> norm->ComputePointNormalsOn();</div><div> norm->Update();</div><div><br></div><div> const double reduction = 0.98;</div><div><br></div><div> vtkSmartPointer<vtkDecimatePro> decimate = vtkSmartPointer<vtkDecimatePro>::New();</div><div> decimate->SetInputConnection(norm->GetOutputPort());</div><div> decimate->SetTargetReduction(reduction);</div><div> decimate->PreserveTopologyOff();</div><div> decimate->Update();</div><div><br></div><div> return EXIT_SUCCESS;</div><div>}</div></div><div><br></div></div>
</div><br></div>