# Make vtk filter update only certain aspects of output

**URL:** https://discourse.vtk.org/t/make-vtk-filter-update-only-certain-aspects-of-output/7167
**Category:** Web
**Created:** [November 13, 2021, 7:15pm UTC](https://discourse.vtk.org/t/make-vtk-filter-update-only-certain-aspects-of-output/7167 "2021-11-13T19:15:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ebrahim\_Ebrahim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ebrahim_ebrahim/32/5752_2.png) [@Ebrahim\_Ebrahim](https://discourse.vtk.org/u/Ebrahim_Ebrahim)
#### Post date: [November 13, 2021, 7:15pm UTC](https://discourse.vtk.org/t/make-vtk-filter-update-only-certain-aspects-of-output/7167/1 "2021-11-13T19:15:59Z")

</div>

I’m making a “source” object, similar to `vtkSphereSource`, so I have set up the `requestData` method to construct and return a `vtkPolyData` (“return” in the sense of filling the output parameter `outData`)

Now every time I modify the source object, it rebuilds that `vtkPolyData` completely. But I only need it to update the points array. It doesn’t need to rebuild topology or normals.

What’s the proper vtk way to make `requestData` build everything initially, but then only rebuild the points array when the object gets modified?

(This is vtk.js, btw)

* * *

EDIT: One thought I had is to make two filters. One source object generates a `vtkPolyData` with topology and normals, but no points (or a zero-initialized points array). Then a filter that takes a `vtkPolyData` and just populates it with points. The properties that only affect the points array can be managed by the second filter, and updating those would only update the points array.

But is this the correct vtk way of thinking? 🤔

I don’t see it done elsewhere. For example, if I’m reading the code correctly, calling `setRadius` on `vtkSphereSource` causes it to rebuild an entire `vtkPolyData`, even though it’s only the points array that changes, while normals and topology remain the same.

---

<div class="post-metadata">

### Author: ![finetjul](https://discourse.vtk.org/user_avatar/discourse.vtk.org/finetjul/32/154_2.png) [@finetjul](https://discourse.vtk.org/u/finetjul)
#### Post date: [November 15, 2021, 7:41am UTC](https://discourse.vtk.org/t/make-vtk-filter-update-only-certain-aspects-of-output/7167/2 "2021-11-15T07:41:00Z")

</div>

This is too specific to your use case to have it generalized in vtk.js.

I would check the `mtime` of the input arrays (polys, pointdata, celldata…) in `requestData` and decide to reuse the previous output arrays.

Hth,  
Julien.

---

<div class="post-metadata">

### Author: ![Ebrahim\_Ebrahim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ebrahim_ebrahim/32/5752_2.png) [@Ebrahim\_Ebrahim](https://discourse.vtk.org/u/Ebrahim_Ebrahim)
#### Post date: [November 15, 2021, 4:14pm UTC](https://discourse.vtk.org/t/make-vtk-filter-update-only-certain-aspects-of-output/7167/3 "2021-11-15T16:14:30Z")

</div>

> This is too specific to your use case to have it generalized in vtk.js.

My question is _about_ my use case; I’m not trying to generalize something to vtk.js

> I would check the `mtime` of the input arrays …

Thanks, I will look into this approach!
