# Trying boolean operation on a voronoi 2D Mesh

**URL:** https://discourse.vtk.org/t/trying-boolean-operation-on-a-voronoi-2d-mesh/10139
**Category:** Support
**Created:** [December 9, 2022, 5:49pm UTC](https://discourse.vtk.org/t/trying-boolean-operation-on-a-voronoi-2d-mesh/10139 "2022-12-09T17:49:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![AndreAhmed](https://discourse.vtk.org/user_avatar/discourse.vtk.org/andreahmed/32/6061_2.png) [@AndreAhmed](https://discourse.vtk.org/u/AndreAhmed)
#### Post date: [December 9, 2022, 5:49pm UTC](https://discourse.vtk.org/t/trying-boolean-operation-on-a-voronoi-2d-mesh/10139/1 "2022-12-09T17:49:33Z")

</div>

Hi, Thanks for your help in advance.

I’ve the following two polydata as shown in the figure I’m trying to do boolean operation on them, but it says that the voronoi mesh has non manfiold data, and there is no contact. How to fix that ?

> vtkNew tri1;  
> tri1-\>SetInputData(vornoi\_2d-\>GetOutput());  
> vtkNew clean1;  
> clean1-\>SetInputConnection(tri1-\>GetOutputPort());  
> clean1-\>Update();
> 
> vtkNew tri2;  
> tri2-\>SetInputData(polydata);  
> tri2-\>Update();  
> vtkNew clean2;  
> clean2-\>SetInputConnection(tri2-\>GetOutputPort());  
> clean2-\>Update();
> 
> vtkNew extrude;  
> extrude-\>SetInputData(clean2-\>GetOutput());  
> extrude-\>SetExtrusionTypeToNormalExtrusion();  
> extrude-\>SetVector(0, 0, 1);  
> extrude-\>SetScaleFactor(120.5);  
> extrude-\>Update();
> 
> vtkNew extrude\_vornoi;  
> extrude\_vornoi-\>SetInputData(clean1-\>GetOutput());  
> extrude\_vornoi-\>SetExtrusionTypeToNormalExtrusion();  
> extrude\_vornoi-\>SetVector(0, 0, 1);  
> extrude\_vornoi-\>SetScaleFactor(120.5);  
> extrude\_vornoi-\>Update();
> 
> vtkNew plyWriter;  
> plyWriter-\>SetFileName(“curve1.obj”);  
> plyWriter-\>SetInputData(extrude-\>GetOutput());  
> plyWriter-\>Write();
> 
> plyWriter-\>SetFileName(“curve2.obj”);  
> plyWriter-\>SetInputData(extrude\_vornoi-\>GetOutput());  
> plyWriter-\>Write();
> 
> vtkPolyDataBooleanFilter\* bf2 =  
> vtkPolyDataBooleanFilter::New();  
> bf2-\>SetInputConnection(0, extrude-\>GetOutputPort());  
> bf2-\>SetInputConnection(1, extrude\_vornoi-\>GetOutputPort());  
> bf2-\>SetOperModeToDifference();  
> bf2-\>Update();

 ![image](https://discourse.vtk.org/uploads/default/original/2X/e/e94bc43e1b576fcdf9eac1fb9dee84a50aaf3839.png)

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [December 9, 2022, 5:58pm UTC](https://discourse.vtk.org/t/trying-boolean-operation-on-a-voronoi-2d-mesh/10139/2 "2022-12-09T17:58:54Z")

</div>

What I do in situations like this is load the data into ParaView and run the feature edges filter on each input polydata. It’s possible to identify feature edges this way… of course you can do it in VTK as well but sometimes an application like PV is much easier to debug with. Anyway, once you identify the feature edges we can figure out if it’s a voronoi issue, or something else.

---

<div class="post-metadata">

### Author: ![AndreAhmed](https://discourse.vtk.org/user_avatar/discourse.vtk.org/andreahmed/32/6061_2.png) [@AndreAhmed](https://discourse.vtk.org/u/AndreAhmed)
#### Post date: [December 9, 2022, 6:03pm UTC](https://discourse.vtk.org/t/trying-boolean-operation-on-a-voronoi-2d-mesh/10139/3 "2022-12-09T18:03:10Z")

</div>

@will.schroeder  
Thanks so much for your fast reply.  
Here is the two obj files… may be you can take a look also and I will take also in paraview  
[curve1.obj](https://discourse.vtk.org/uploads/short-url/yrILJaccVOZS5v1Ctr5dN8QC5lf.obj) (253.7 KB)  
[curve2.obj](https://discourse.vtk.org/uploads/short-url/l3JlzChKepnnaTkEyWZHBg0bDYe.obj) (661.4 KB)

---

<div class="post-metadata">

### Author: ![AndreAhmed](https://discourse.vtk.org/user_avatar/discourse.vtk.org/andreahmed/32/6061_2.png) [@AndreAhmed](https://discourse.vtk.org/u/AndreAhmed)
#### Post date: [December 9, 2022, 6:16pm UTC](https://discourse.vtk.org/t/trying-boolean-operation-on-a-voronoi-2d-mesh/10139/4 "2022-12-09T18:16:30Z")

</div>

@will.schroeder

 ![image](https://discourse.vtk.org/uploads/default/original/2X/1/1290c48211b1f622ddc0af3a2cc2b41960f25f9d.png)  
here is the output of feature edges…  
it seems it’s true that there are non-manifold edges.  
The question : How do I generate voronoi coherent with manifold edges ?

---

<div class="post-metadata">

### Author: ![AndreAhmed](https://discourse.vtk.org/user_avatar/discourse.vtk.org/andreahmed/32/6061_2.png) [@AndreAhmed](https://discourse.vtk.org/u/AndreAhmed)
#### Post date: [December 9, 2022, 7:43pm UTC](https://discourse.vtk.org/t/trying-boolean-operation-on-a-voronoi-2d-mesh/10139/5 "2022-12-09T19:43:08Z")

</div>

@will.schroeder  
I tried to remove non manfiold edges, and it says in paraview there are no non-manifold edges there.  
Here are the two meshes, however it still says that the voronoi mesh has non-manifold edges.  
[curve2.obj](https://discourse.vtk.org/uploads/short-url/41A1R1saS5oxP1MCKaq8MWvlNfo.obj) (75.9 KB)  
[curve1.obj](https://discourse.vtk.org/uploads/short-url/aMFxjxAkCVWEU965oyXRyhHJQcT.obj) (256.6 KB)
