[vtkusers] Holes in mesh after vtkBooleanOperationPolyDataFilter

Bryn Lloyd lloyd at itis.ethz.ch
Tue May 22 08:05:46 EDT 2012


The boolean operations are not robust for parallel surfaces.

One way to try to resolve the problem is to move the objects by some 
small delta before applying the boolean operation.


On 5/22/2012 11:15 AM, Malsoaz James wrote:
> Hi VTK users,
>
> I'm using the vtkBooleanOperationPolyDataFilter to apply boolean 
> operations to polydata. Unfortunately, I got unexpected results (holes 
> in the mesh).
>
> You can see here 
> http://www.hostingpics.net/viewer.php?id=210273error.png an example.
> I'm creating a cylinder, then I'm adding a cube and finally I'm adding 
> another cylinder. The holes appear with the last operation.
>
>
> Can someone explain me the reason(s) of these results ?
>
> Here are my source code :
> vtkCylinderSource * cylinder1 = vtkCylinderSource::New();
> cylinder1->SetCenter(0, 10, 0);
> cylinder1->SetHeight(50);
> cylinder1->SetRadius(5);
> cylinder1->SetResolution(100);
> cylinder1->Update();
>
> vtkTriangleFilter * cylinder1Triangle = vtkTriangleFilter::New();
> cylinder1Triangle->SetInput(cylinder1->GetOutput());
> cylinder1Triangle->Update();
>
> cylinder1->Delete();
>
> vtkCubeSource * cube = vtkCubeSource::New();
> cube->SetCenter(0, 10, 0);
> cube->SetXLength(50);
> cube->SetYLength(20);
> cube->SetZLength(10);
> cube->Update();
>
> vtkTriangleFilter *cubeTriangle = vtkTriangleFilter::New();
> cubeTriangle->SetInput(cube->GetOutput());
> cubeTriangle->Update();
>
> cube->Delete();
>
> vtkCylinderSource * cylinder2 = vtkCylinderSource::New();
> cylinder2->SetCenter(-25, 15, 0);
> cylinder2->SetHeight(30);
> cylinder2->SetRadius(3);
> cylinder2->SetResolution(100);
> cylinder2->Update();
>
> vtkTriangleFilter * cylinder2Triangle = vtkTriangleFilter::New();
> cylinder2Triangle->SetInput(cylinder2->GetOutput());
> cylinder2Triangle->Update();
>
> cylinder2->Delete();
>
> vtkBooleanOperationPolyDataFilter * add1 = 
> vtkBooleanOperationPolyDataFilter::New();
> add1->SetOperationToUnion();
> add1->SetInput(0, cylinder1Triangle->GetOutput());
> add1->SetInput(1, cubeTriangle->GetOutput());
> add1->Update();
>
> cubeTriangle->Delete();
> cylinder1Triangle->Delete();
>
> vtkBooleanOperationPolyDataFilter * add = 
> vtkBooleanOperationPolyDataFilter::New();
> add->SetOperationToUnion();
> add->SetInput(0, add1->GetOutput());
> add->SetInput(1, cylinder2Triangle->GetOutput());
> add->Update();
>
> add1->Delete();
> cylinder2Triangle->Delete();
>
> Am I doing something wrong in the use of 
> vtkBooleanOperationPolyDataFilter ?
>
> Thank you.
> Best
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120522/4a1cbbe4/attachment.htm>


More information about the vtkusers mailing list