[vtkusers] Re : Holes in mesh after vtkBooleanOperationPolyDataFilter

Malsoaz James jmalsoaz at yahoo.fr
Tue May 22 09:02:58 EDT 2012


Thank you,

I'm gonna try this solution.

Is this problem due to the implementation of the algorithm to compute the boolean operation ?

I'm a bit confused, because the holes doesn't appear in a place where there are intersections or unions.

I have been trying to use this website : http://evanw.github.com/csg.js/ to test another implentation of the CSG and it works even with parallel surfaces.
You can try the following in the text box at the end of the page (note that the page requires WebGL) :

var a = CSG.cylinder({radius:0.2, center:[0, 0, 0]});
var b = CSG.cube({radius:[1, 0.5, 0.2], center:[0, 0, 0]});
var c = CSG.cylinder({radius:0.2, start: [-1, -1, 0], end: [-1, 1, 0]});
return a.union(b).union(c);

Best.


________________________________
 De : Bryn Lloyd <lloyd at itis.ethz.ch>
À : vtkusers at vtk.org 
Envoyé le : Mardi 22 mai 2012 14h05
Objet : Re: [vtkusers] Holes in mesh after vtkBooleanOperationPolyDataFilter
 

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 
_______________________________________________
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/290b6146/attachment.htm>


More information about the vtkusers mailing list