# Is it possible to turn off triangles on vtkClipDataSet filter?

**URL:** <https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279>\
**Category:** Support\
**Created:** [February 14, 2019, 10:13pm UTC](https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279 "2019-02-14T22:13:21Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)\
**Post date:** [July 5, 2019, 4:54pm UTC](https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279/22 "2019-07-05T16:54:28Z")

</div>

> [@Vincent\_Rivola](#):
>
> Did you try vtkTableBasedClipDataSet ?

This did it!! So far I am having success with the `vtkTableBasedClipDataSet` filter and using it the same way as I would a `vtkClipDataSet` filter. Thanks for your input, @Vincent_Rivola!

---

<div class="post-metadata">

**Author:** ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)\
**Post date:** [July 5, 2019, 4:57pm UTC](https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279/23 "2019-07-05T16:57:00Z")

</div>

`vtkTableBasedClipDataSet` provides exactly what I want! Preserved cells where the clip doesn’t happen and intersection polygons along the implicit clip function:

 ![download](https://discourse.vtk.org/uploads/default/original/1X/4e1727e8cc1d9f442f12fee11c7478f5efe0a112.png)

---

<div class="post-metadata">

**Author:** ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)\
**Post date:** [July 5, 2019, 5:05pm UTC](https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279/24 "2019-07-05T17:05:10Z")

</div>

One last lingering question…

Is there any advantage to using `vtkClipVolume` over `vtkTableBasedClipDataSet` for `vtkImageData`? From my perspective it looks like I always want to use the `vtkTableBasedClipDataSet` filter because it will preserve the cells in the image data while `vtkClipVolume` triangulates the volume.

Use of `vtkClipVolume` with `vtkImageData` (plane clip):

 ![download](https://discourse.vtk.org/uploads/default/original/1X/f4d6323845bec3afa3fa8f34fb2226592c4941c3.png)

Use of `vtkTableBasedClipDataSet` with the same dataset and clip function. Note that there are no triangulated cells which is likely preferred when working with `vtkImageData`:

 ![download](https://discourse.vtk.org/uploads/default/original/1X/65a97998fd24b05d006beb49278415919077c246.png)

---

<div class="post-metadata">

**Author:** ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)\
**Post date:** [July 5, 2019, 6:00pm UTC](https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279/25 "2019-07-05T18:00:03Z")

</div>

Bane,

As you discovered, looks like TableBasedClipDataSet is the way to go. I ran it on the data you provided and got this result.  
BTW: Can I use your dataset in the VTKExamples Project?

![TableBasedClip](https://discourse.vtk.org/uploads/default/original/1X/15ff454598eb5bfbe296f442dee4b2d771b9d949.png)

---

<div class="post-metadata">

**Author:** ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)\
**Post date:** [July 5, 2019, 6:06pm UTC](https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279/26 "2019-07-05T18:06:22Z")

</div>

> [@lorensen](#):
>
> BTW: Can I use your dataset in the VTKExamples Project?

That should be fine!

Also, any input on this new thread which is highly related would be greatly appreciated!: [Box clip with vtkTableBasedClipDataSet and sharp edges? - #2 by banesullivan](https://discourse.vtk.org/t/box-clip-with-vtktablebasedclipdataset-and-sharp-edges/1286/2)

---

<div class="post-metadata">

**Author:** ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)\
**Post date:** [July 6, 2019, 7:41pm UTC](https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279/27 "2019-07-06T19:41:37Z")

</div>

I’ve added two nex examples to the [VTKExamples Project](https://lorensen.github.io/VTKExamples/site/). They illustrate the difference between [vtkTableBasedClipDataSet](https://vtk.org/doc/nightly/html/classvtkTableBasedClipDataSet.html#details) and [vtkClipDataSet](https://vtk.org/doc/nightly/html/classvtkClipDataSet.html#details).

1. [ClipUnstructuredGridWithPlane](https://lorensen.github.io/VTKExamples/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/)
2. [ClipUnstructuredGridWithPlane2](https://lorensen.github.io/VTKExamples/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2)

The former is faster and produces many fewer cells because it retains the original cells outside the clip boundary. See the difference in these images:  
 ![TestClipUnstructuredGridWithPlane](https://discourse.vtk.org/uploads/default/original/1X/66d5b1299221d1095b0c6d786a262192b6183f98.png)  
 ![TestClipUnstructuredGridWithPlane2](https://discourse.vtk.org/uploads/default/original/1X/e864e99370c61da3e86622c80d2f5fa7784b9092.png)

If you have been using vtkClipDataSet you may wish to switch to vtkTableBasedClipDataSet.

Thanks to Bane Sullivan for bringing up the original problem and for helping to track down a solution.

Also, he provided a great unstructured grid test dataset.

[Previous page](https://discourse.vtk.org/t/is-it-possible-to-turn-off-triangles-on-vtkclipdataset-filter/279.md?page=1)
