The brute force method would be to check for every cell of the input data whether it’s (partially) within a cell of the grid but I’m trying to find a better solution.

I found vtkClipPolyData which sounded promising but when I defined a square 2D vtkBox the result looked more like a floppy disk:

I tried it with the example code (adding clipper->Update() and clipper->GetOutputDataObject(0)) and then played around with it a bit (e.g. using less planes) but all I got was an empty object.

This samples on points from another DataSet. Maybe it could work but it’s not what I had in mind.

I want to use a grid (like in the second picture of my post) and then calculate the average area value of that cell.
Each of the polygons/triangles stores one value (the area of the original polygons seen in the first picture). In the grid cell, I want to calculate the median value stored in the polygons/triangles below relative to its area within the cell.
The goal is to “smooth” or reduce big steps between the values within the polygons.

I have now realized that resampling with points is almost as precise (depending on the number of points) and is enough for my purpose. This means ResampleWithDataSet is perfect. Thanks for trying to help!