Hi everybody,

There is a serious bug in the interpolator function for 2D quad elements.
In the attachment I include a tar file which includes an example to
demonstrate the problem and I also include a patch which solves it
(at least for the quadsII2D.c file).

Oke. First the problem. To see it, execute the following with the files
from the attached tar:

  $ awk -f makedata.awk > data.lis
  $ dx -script
    ...
    > include "plotdata"

What you will see is a straight line! This is wrong since the awk script
generates a parabolic surface. (That can be verified by other ways, for
example with isosurface.) In the "plotdata" file if you modify
the position of the grid line a little bit from 0.97 to 0.971 then
you get a correct parabola.

To describe the problem consider three regular squares as shown below:

|-----|-----|-----|
|  1  |  2  |  3  |
|-----|--X--|-----|

Lets assume that the point which is interpolated is point "X". In this
case the current interpolator says that point "X" is in quad 1! This is
obviously wrong. The reason for this mistake is that one of the conditions 
for the checking of a point being inside is that ANY of the calculated 
areas is ZERO. And this is always true for quad 1 since point "X" lies
on the edge of quad 1. And there is no further check! This also means that
any point on the horizontal line of quad 1 will always be found inside
of quad !!!! The fix is similar to the one which is used
in the triangle interpolator, that when any of the areas is zero (as the
point is on the side) it must be also true that the sign of the other
two areas must be the same. 

The included patch does this. Please apply or let me know about any
problems.

                Best regards,

                                Peter Ivanyi

Attachment: quad.tar.gz
Description: Binary data

Reply via email to