Subject: Re: Fwd: Interpolation problem
Date: Friday 15th October 2010 15:49:12 UTC (over 7 years ago)
If I can, I would like to expand the conversation a little bit because I don’t think the technical details are telling the whole story. The root of the problem is that the interpolation of a scalar field based on the four corners of a square (or any quadrilateral) is in general ill-defined. We usually mean for field to be linearly interpolated between the points. That is, find some function of the form f(x,y) = a*x + b*y + c that gives the correct scalar for all four points. But, in fact, four points over constrain the problem and no such linear function exists. So really, the differences you are seeing are the differences between how the internal VTK functions resolve the interpolation and how your rendering hardware is doing it. I haven’t looked at the source code, but I’m assuming that VTK is using something like bilinear interpolation. Bilinear interpolation works by first interpolating the scalar on opposite edges and then interpolating again between these edges to get a point in the interior. Bilinear interpolation has several advantages: it can be done independently of neighboring polygons and still be C0 continuous, it is easy to implement, it is smooth in the interior, and it gives an interpolation that intuitively makes sense. Note, however, that bilinear interpolation is not linear. This is evident by your plot (which is a parabola). Your graphics driver is much more concerned with speed. As such, it takes your quadrilateral and breaks it into triangles. This circumvents the whole interpolation problem because the three vertices of the triangle perfectly constrain the linear function. It is also easy for the graphics hardware to compute the interior of the triangle. Of course, the result is not as, shall we say, pleasant as bilinear interpolation. It is not smooth: There is a C1 discontinuity at the line where the quadrilateral was split into triangles. Also, this splitting is arbitrary. The split could just as easily been made in the opposite direction. In that case, you would see a red line go from upper left to lower right instead of that blue line from lower left to upper right. So the rendering is probably not what was indented when defining the scalar value on a quadrilateral. However, ParaView allows it because correcting the problem would make the rendering prohibitively slow. Furthermore, it is rarely even noticeable. The square in this example is worst case. Not only do no linear functions fit, they are not even close. Thus, the different ways to resolve the issue are dramatically different. In a practical application, this does not occur. The scalar values tend to more closely fit a linear function. If a quadrilateral like this occurred in a real data set, it might be indicative of a meshing problem. Furthermore, real meshes have lots of facets. If this square was a small part of a much bigger surface, differences in interpolation are less meaningful. In short, the interpolation your graphics hardware performs is sufficient for qualitative analysis (getting an overview of behavior), which is all its really good for anyway. When you do qualitative analysis (showing actual numbers in the data) such as in your plot, the more accurate interpolation models of VTK are used. -Ken On 10/14/10 9:06 AM, "Andy Bauer"