Moreland, Kenneth | 15 Oct 17:49 2010
Picon

Re: Fwd: Interpolation problem

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" <andy.bauer <at> kitware.com> wrote:



2010/10/14 小縣信也 <so0208jp <at> gmail.com>
Hi Andy,

Thank you for replying.
Do you mean that the rendering image doesn't reflect the result of
interpolation ?

Yes.
 
If so, what is the most common usage?
In what situation is the interpolation used ?

If your grid uses triangles then the image should match the interpolation for the typical node/point based interpolation.

 
Shinya


2010/10/13 Andy Bauer <andy.bauer <at> kitware.com>:
> I think this is a rendering issue and not an interpolation issue.  From the
> 2d plot you can see that it's properly interpolating the values.  I think
> the quadrilateral is getting rendered as 2 triangles in which case the
> diagonal values appear to be constant since the 2 end points are at the same
> value.
>
> 2010/10/12 小縣信也 <so0208jp <at> gmail.com>
>>
>> Hello
>>
>> I'm sending  the following  e-mail again ,because nobody answered it.
>> Does anyone have information on my problem?
>>
>> Shinya
>>
>>
>> ---------- Forwarded message ----------
>> From: 小縣信也 <so0208jp <at> gmail.com>
>> Date: 2010/10/7
>> Subject: Interpolation problem
>> To: paraview <at> paraview.org
>>
>>
>> Hello, paraview users
>>
>> I draw the file “Sample_inter.vtk” on ParaView. (ref:attached file)
>> I chose “Gouraud” in Interpolation option.
>> The contor picture doesn’t seem to be interpolated by 4 points.
>> However,the graph which is made by PlotOverLine shows the gradation of
>> 4 points scalar.
>> Why are they different?
>> Does anyone know this problem?
>> How can I make contour picture interpolated by  Gouraud ?
>>
>> I look forward to your reply to my inquiry
>>
>> Shinya Ogata
>>
>> _______________________________________________
>> Powered by www.kitware.com <http://www.kitware.com>
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>
>


<div>
<span>If I can, I would like to expand the conversation a little bit because I don&rsquo;t think the technical details are telling the whole story.<br><br>
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. &nbsp;We usually mean for field to be linearly interpolated between the points. &nbsp;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. &nbsp;But, in fact, four points over constrain the problem and no such linear function exists.<br><br>
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. &nbsp;I haven&rsquo;t looked at the source code, but I&rsquo;m assuming that VTK is using something like bilinear interpolation. &nbsp;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. &nbsp;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. &nbsp;Note, however, that bilinear interpolation is not linear. &nbsp;This is evident by your plot (which is a parabola).<br><br>
Your graphics driver is much more concerned with speed. &nbsp;As such, it takes your quadrilateral and breaks it into triangles. &nbsp;This circumvents the whole interpolation problem because the three vertices of the triangle perfectly constrain the linear function. &nbsp;It is also easy for the graphics hardware to compute the interior of the triangle. &nbsp;Of course, the result is not as, shall we say, pleasant as bilinear interpolation. &nbsp;It is not smooth: There is a C1 discontinuity at the line where the quadrilateral was split into triangles. &nbsp;Also, this splitting is arbitrary. &nbsp;The split could just as easily been made in the opposite direction. &nbsp;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.<br><br>
So the rendering is probably not what was indented when defining the scalar value on a quadrilateral. &nbsp;However, ParaView allows it because correcting the problem would make the rendering prohibitively slow. &nbsp;Furthermore, it is rarely even noticeable. &nbsp;The square in this example is worst case. &nbsp;Not only do no linear functions fit, they are not even close. &nbsp;Thus, the different ways to resolve the issue are dramatically different. &nbsp;In a practical application, this does not occur. &nbsp;The scalar values tend to more closely fit a linear function. &nbsp;If a quadrilateral like this occurred in a real data set, it might be indicative of a meshing problem. &nbsp;Furthermore, real meshes have lots of facets. &nbsp;If this square was a small part of a much bigger surface, differences in interpolation are less meaningful.<br><br>
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. &nbsp;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.<br><br>
-Ken<br><br><br>
On 10/14/10 9:06 AM, "Andy Bauer" &lt;<a href="andy.bauer <at> kitware.com">andy.bauer <at> kitware.com</a>&gt; wrote:<br><br></span><blockquote>
<span><br><br>
2010/10/14 &#23567;&#32291;&#20449;&#20063; &lt;<a href="so0208jp <at> gmail.com">so0208jp <at> gmail.com</a>&gt;<br></span><blockquote><span>Hi Andy,<br><br>
Thank you for replying.<br>
Do you mean that the rendering image doesn't reflect the result of<br>
interpolation ?<br></span></blockquote>
<span><br>
Yes.<br>
&nbsp;<br></span><blockquote><span>If so, what is the most common usage?<br>
In what situation is the interpolation used ?<br></span></blockquote>
<span><br>
If your grid uses triangles then the image should match the interpolation for the typical node/point based interpolation. <br><br>
&nbsp;<br></span><blockquote><span>Shinya<br><br><br>
2010/10/13 Andy Bauer &lt;<a href="andy.bauer <at> kitware.com">andy.bauer <at> kitware.com</a>&gt;:<br>
&gt; I think this is a rendering issue and not an interpolation issue. &nbsp;From the<br>
&gt; 2d plot you can see that it's properly interpolating the values. &nbsp;I think<br>
&gt; the quadrilateral is getting rendered as 2 triangles in which case the<br>
&gt; diagonal values appear to be constant since the 2 end points are at the same<br>
&gt; value.<br>
&gt;<br>
&gt; 2010/10/12 &#23567;&#32291;&#20449;&#20063; &lt;<a href="so0208jp <at> gmail.com">so0208jp <at> gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hello<br>
&gt;&gt;<br>
&gt;&gt; I'm sending &nbsp;the following &nbsp;e-mail again ,because nobody answered it.<br>
&gt;&gt; Does anyone have information on my problem?<br>
&gt;&gt;<br>
&gt;&gt; Shinya<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ---------- Forwarded message ----------<br>
&gt;&gt; From: &#23567;&#32291;&#20449;&#20063; &lt;<a href="so0208jp <at> gmail.com">so0208jp <at> gmail.com</a>&gt;<br>
&gt;&gt; Date: 2010/10/7<br>
&gt;&gt; Subject: Interpolation problem<br>
&gt;&gt; To: <a href="paraview <at> paraview.org">paraview <at> paraview.org</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hello, paraview users<br>
&gt;&gt;<br>
&gt;&gt; I draw the file &ldquo;Sample_inter.vtk&rdquo; on ParaView. (ref:attached file)<br>
&gt;&gt; I chose &ldquo;Gouraud&rdquo; in Interpolation option.<br>
&gt;&gt; The contor picture doesn&rsquo;t seem to be interpolated by 4 points.<br>
&gt;&gt; However,the graph which is made by PlotOverLine shows the gradation of<br>
&gt;&gt; 4 points scalar.<br>
&gt;&gt; Why are they different?<br>
&gt;&gt; Does anyone know this problem?<br>
&gt;&gt; How can I make contour picture interpolated by &nbsp;Gouraud ?<br>
&gt;&gt;<br>
&gt;&gt; I look forward to your reply to my inquiry<br>
&gt;&gt;<br>
&gt;&gt; Shinya Ogata<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by www.kitware.com &lt;<a href="http://www.kitware.com">http://www.kitware.com</a>&gt; <br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the ParaView Wiki at:<br>
&gt;&gt; <a href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br></span></blockquote>
<span><br><br></span>
</blockquote>
</div>

Gmane