[vtkusers] Segmentation fault with vtkBooleanOperationPolyDataFilter using 2 cylinders [HELP]

Drak draktharrblorf at gmail.com
Wed Aug 19 16:56:15 EDT 2015


I've noticed that by playing with the radius value and the resolution of the
cylinder, the boolean operation filter may or may not crash 

Here is my code bellow.    

    // The outer cylinder
    vtkCylinderSource * _cylinderSource1 = vtkCylinderSource::New();
    _cylinderSource1->SetCenter(0, 0, 0);
    _cylinderSource1->SetHeight(width);
    _cylinderSource1->SetRadius(0.13);
    _cylinderSource1->SetResolution(10);
    _cylinderSource1->Update();

    vtkTriangleFilter * _cylinder1Triangle = vtkTriangleFilter::New();
    _cylinder1Triangle->SetInputData(_cylinderSource1->GetOutput());
    _cylinder1Triangle->Update();

    // The inner cylinder
    vtkCylinderSource * _cylinderSource2 = vtkCylinderSource::New();
    _cylinderSource2->SetCenter(0, 0, 0);
    _cylinderSource2->SetHeight(width+0.01);
    _cylinderSource2->SetRadius(0.001);
    _cylinderSource2->SetResolution(20);
    _cylinderSource2->Update();

    vtkTriangleFilter * _cylinder2Triangle = vtkTriangleFilter::New();
    _cylinder2Triangle->SetInputData(_cylinderSource2->GetOutput());
    _cylinder2Triangle->Update();

    vtkBooleanOperationPolyDataFilter * _filter =
vtkBooleanOperationPolyDataFilter::New();
    _filter->SetOperationToDifference();
    _filter->SetInputData(0, _cylinder1Triangle->GetOutput());
    _filter->SetInputData(1, _cylinder2Triangle->GetOutput());
    _filter->Update(); // CRASH

What should I do to make it work 100 % of the time? I don't care if I have
sometimes weird holes, but I cannot accept to have crashes in my program :\
.



--
View this message in context: http://vtk.1045678.n5.nabble.com/Segmentation-fault-with-vtkBooleanOperationPolyDataFilter-using-2-cylinders-HELP-tp5733567.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list