[vtkusers] vtkDecimatePro crash with CopyNormals=Off

Xabi Riobe xabivtk at gmail.com
Thu Apr 14 09:45:44 EDT 2016


I still don't fully understand the mechanism of the vtkDataSetAttributes
copy flags when passing from a filter to another, is there some
documentation anywhere? (appart from the doxygen)

And is someone familiar with the vtkDecimatePro to help me find a fix for
the case of points insertion with normals?

Thanks

2016-04-12 15:45 GMT+02:00 Xabi Riobe <xabivtk at gmail.com>:

> Hi,
>
> I have a crash when using vtkDecimatePro (vtk 6.3) if my input has normals
> with the CopyNormals flag set to 0 (='off').
>
> Attached is a reproductible case with its input.
>
> The crash occurs at line 409:
> outputPD->CopyData(meshPD,ptId,map[ptId]);
>
> 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.
>
> 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.
>
> 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)?
>
> And second, is there something to fix in vtkDecimatePro?
>
>
> Thanks for your feedback
>
>
> link to data (vtp): *http://www.filedropper.com/mesh9
> <http://www.filedropper.com/mesh9>*
>
>
> #include <vtkSmartPointer.h>
> #include <vtkXMLPolyDataReader.h>
> #include <vtkDecimatePro.h>
> #include <vtkPolyData.h>
> #include <vtkPolyDataNormals.h>
>
> int main ()
> {
>    // Read the input polydata
>    vtkSmartPointer<vtkXMLPolyDataReader> reader =
> vtkSmartPointer<vtkXMLPolyDataReader>::New();
>    reader->SetFileName("./Mesh9.vtp");
>    reader->Update();
>
>    vtkSmartPointer<vtkPolyDataNormals> norm =
> vtkSmartPointer<vtkPolyDataNormals>::New();
>    norm->SetInputConnection(reader->GetOutputPort());
>    norm->ComputePointNormalsOn();
>    norm->Update();
>
>    const double reduction = 0.98;
>
>    vtkSmartPointer<vtkDecimatePro> decimate =
> vtkSmartPointer<vtkDecimatePro>::New();
>    decimate->SetInputConnection(norm->GetOutputPort());
>    decimate->SetTargetReduction(reduction);
>    decimate->PreserveTopologyOff();
>    decimate->Update();
>
>    return EXIT_SUCCESS;
> }
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160414/53e7178d/attachment.html>


More information about the vtkusers mailing list