Hi, I'm implimenting a method presented in(adsbygoogle = window.adsbygoogle || []).push({});

http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf

Part of the way through it it presents a linear interpolation method, which I wanted to expand to three dimensions, but I don't understand how it works in two dimensions.

I've done linear interpolation before, but this seems very different:

(the part in bold is where the linear interpolation takes place, and I don't get what they're doing).Code (Text):

void advect ( int N, int b, float * d, float * d0, float * u, float * v, float dt )

{

int i, j, i0, j0, i1, j1;

float x, y, s0, t0, s1, t1, dt0;

dt0 = dt*N;

for ( i=1 ; i<=N ; i++ ) {

for ( j=1 ; j<=N ; j++ ) {

x = i-dt0*u[IX(i,j)]; y = j-dt0*v[IX(i,j)];

if (x<0.5) x=0.5; if (x>N+0.5) x=N+ 0.5; i0=(int)x; i1=i0+1;

if (y<0.5) y=0.5; if (y>N+0.5) y=N+ 0.5; j0=(int)y; j1=j0+1;

s1 = x-i0; s0 = 1-s1; t1 = y-j0; t0 = 1-t1;

[b]

d[IX(i,j)] = s0*(t0*d0[IX(i0,j0)]+t1*d 0[IX(i0,j1)])+

s1*(t0*d0[IX(i1,j0)]+t1*d0[IX(i1,j1)]);

[/b]

}

}

set_bnd ( N, b, d );

}

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Linear interpolation

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads for Linear interpolation |
---|

Linear Regression, etc : Standard vs ML Techniques |

**Physics Forums | Science Articles, Homework Help, Discussion**