Triangle interpolation with 6 control points?

166 Views Asked by At

Through a costly simulation, I am able to calculate the value of a function at several discrete points on a plane. My task now is to interpolate, to find the values at all points of the grid. (It is a simulation of a sheet of rubber, with the sheet tessellated with a triangle grid.)

Now I have seen some similar questions on the site, on how to interpolate within a triangle, and the consensus seems to be to use barycentric coordinates. I have implemented this, and the result is shown on the left/top. For comparison, a result using the inverse of the distance to get the weights resulted in the picture on the right/bottom.

enter image description here

(I have not explicitly visualised the nodes, but from the second picture it's pretty obvious, where they are.)

Now, although the result with barycentric coordinates is not bad, esp. when compared to the other result, I'm not completely satisfied. Notice how the triangular/hexagonal structure is very visible, for example the bright lines emanating from the yellow spot.

My question: is there a better weighting function?

I strongly assume there is nothing better that only takes the 3 given control points into consideration, but I was wondering if there is a weighting function that uses the 6 nearest control points, so A-F instead of A-C in this figure:

enter image description here

Though there is a section on 'generalised' barycentric coordinates on the wikipedia site, I can't say it's something I understand how to apply. I've also looked at bicubic interpolation, but that is only possible on a square or rectangular grid.

Many thanks!

1

There are 1 best solutions below

0
On

I'm back to answer my own question. Kinda.

Yes, it's possible to do a more generalised barycentric interpolation, for example in the shape ADCFBE shown in the question. I found this great article, which I've implemented into a small python repository here. The interpolation within - and extrapolation around! - a polygon does an amazing job:

enter image description here

The only limitation here is that the points need to be on a polygon, i.e., in a closed loop. If the points deviate far from a convex shape, the interpolation starts to go off the rails. For example, the dark (=low-value) patch indicated with the arrow in this image, is surrounded by higher values, and seems implausibly low:

enter image description here

What does not work so well either, is what I was planning on doing above: to have a 'rolling window', the size of 4 triangles, move over the plane, and use the 6 values (ABCDEF in the image in the question) to interpolate the values in the central triangle ABC. The reason is that points that are close together, but on either side of an edge, will be interpolated using different windows. I was hoping this wouldn't make a big difference in their values, but it does quite visibly so:

enter image description here

So, my new question is this: is it possible to tessellate the plane with non-overlapping polygons, instead of triangles? For example under the condition that all polygons are convex. Each tile of the tessellation would then potentially have >3 points, and therefore a better interpolated value. Yet, due to interpolating of each tile completely instead of partially (as was done in the rolling window), the sharp edges would be gone.