[vtkusers] Fwd: vtkDecimatePro crash with CopyNormals=Off
Xabi Riobe
xabivtk at gmail.com
Tue Apr 12 09:45:13 EDT 2016
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/20160412/4211abf6/attachment.html>
-------------- next part --------------
cmake_minimum_required(VERSION 2.8)
PROJECT(Decimate)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
add_executable(Decimate main.cpp)
if(VTK_LIBRARIES)
target_link_libraries(Decimate ${VTK_LIBRARIES})
else()
target_link_libraries(Decimate vtkHybrid vtkWidgets)
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 883 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160412/4211abf6/attachment.cpp>
More information about the vtkusers
mailing list