Bicubic Interpolation: bcucof() bug?


Diffraction
11-28-2005, 12:29 AM
NEVER MIND:D


I am trying to code bicubic interpolation in an application's psuedo-C scripting language (OSLO CCL). I am thinking the wt[16][16] matrix is not correct (NR 2nd edition, page 126). My test case is a tilted plane. I am getting garbage results.

Assumed plane is z(t,u)=A+Bt+Cu where t and u are the normalized (0 to 1) horizontal and vertical coordinates in the cell. My x[16] vector looks correct. I believe that a linear expansion about the lower left corner of cell requires that the matrix c[1..4][1..4] should have elements c[1][1]=A, c[1][2]=C, c[2][1]=B and all others should be zero. This is not happening.

I have considered issues of 0-based vs 1-based indexing. I have considered row-major vs column-major storage. This has not helped.

To get the 3 non-zero elements, I believe that the 2nd row of the wt[][] matrix should be all zeros except for a one in the 3rd column and that the 5th row should be all zeros except for a one in the 2nd column. If not, I don't see how my planar test case can be matched in the neighborhood of the lower left (t=u=0) corner.

ephesus
05-26-2006, 07:36 AM
Hi ,

I tried to derive the coefficients also , and my matrix (16x16) is not similar with the given matrix "wt" in the subroutine bcucof. I think the authors tried to bring the matrix in a certain form to solve the coeff. easily !? :confused:

ephesus
06-01-2006, 01:57 AM
Hi,
The w matrix in subroutine bcuof is the inverse of the coefficient matrix and is true... I tried the subroutine also and it works ... :)