Interpolating height for a point inside a grid based on a discrete height function.

Posted by fastrack20 on Stack Overflow See other posts from Stack Overflow or by fastrack20
Published on 2010-03-22T17:26:11Z Indexed on 2010/03/22 17:31 UTC
Read the original article Hit count: 219

Filed under:
|
|
|

Hi, I have been wracking my brain to come up with a solution to this problem.

Point P inside a grid square.

I have a lookup table that returns height values for various points (x,z) on the grid. For instance I can calculate the height at A, B, C and D in Figure 1. However, I am looking for a way to interpolate the height at P (which has a known (x,z)). The lookup table only has values at the grid intervals, and P lies between these intervals. I am trying to calculate values s and t such that:

A'(s) = A + s(C-A) B'(t) = B + t(P-B)

I would then use the these two equations to find the intersection point of B'(t) with A'(s) to find a point X on the line A-C. With this I can calculate the height at this point X and with that the height at point P.

My issue lies in calculating the values for s and t.

Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about graphics

Related posts about homework