# Boolean operation to perform a substraction between polydatas is very slow

**URL:** https://discourse.vtk.org/t/boolean-operation-to-perform-a-substraction-between-polydatas-is-very-slow/1079
**Category:** Support
**Created:** [June 4, 2019, 11:08am UTC](https://discourse.vtk.org/t/boolean-operation-to-perform-a-substraction-between-polydatas-is-very-slow/1079 "2019-06-04T11:08:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [June 4, 2019, 11:08am UTC](https://discourse.vtk.org/t/boolean-operation-to-perform-a-substraction-between-polydatas-is-very-slow/1079/1 "2019-06-04T11:08:03Z")

</div>

Hi everybody,

I want to substract wo polydatas and i am using vtkBooleanOperationPolyDataFilter and it takes hours even for polydatas that are not very big. Any idea how to speed up the process? or any other way to do a substraction between 2 polydatas?. The inputs are correct because i visualized them.

Thanks

```
// Triangle Filter
vtkTriangleFilter * triangle_filter
	= vtkTriangleFilter::New();
triangle_filter->SetInputConnection
(fillHolesFilter->GetOutputPort());

vtkTriangleFilter * triangle_filter2
	= vtkTriangleFilter::New();
triangle_filter2->SetInputConnection
(warp->GetOutputPort());

vtkSmartPointer<vtkBooleanOperationPolyDataFilter> boolFilter = 	      
vtkSmartPointer<vtkBooleanOperationPolyDataFilter>::New(); 	
boolFilter->SetInputConnection(0, triangle_filter2->GetOutputPort()); 	  
boolFilter->SetInputConnection(1, triangle_filter->GetOutputPort()); 	
boolFilter->Update();
```

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [June 4, 2019, 4:49pm UTC](https://discourse.vtk.org/t/boolean-operation-to-perform-a-substraction-between-polydatas-is-very-slow/1079/2 "2019-06-04T16:49:26Z")

</div>

Sorry, it’s not a very fast algorithm ☹ Building in release mode will speed things up if you are running in debug mode, but that’s about all I can suggest.

---

<div class="post-metadata">

### Author: ![wael869](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/w/9f8e36/32.png) [@wael869](https://discourse.vtk.org/u/wael869)
#### Post date: [November 29, 2021, 7:24pm UTC](https://discourse.vtk.org/t/boolean-operation-to-perform-a-substraction-between-polydatas-is-very-slow/1079/3 "2021-11-29T19:24:11Z")

</div>

Make sure that the meshes are well designed.
