Take a look at the kd-tree and octree datastructures on Wikipedia. I think a kd-tree or octree would work for you. I'm assuming you have randomly scattered pairs of points, not some lattice of calculated values. (Which do you have?)
Be more clear in your description. First of all, why would you have trouble representing your gradient? It's a triple of real numbers. I don't know what language you're using, but this is easy to do.
As for calculating the gradient, I take it you mean you want to interpolate. Search for interpolation methods online. If linear interpolation is sufficient, you'd want to find the four nearest neighbors and use them to get a linear function of gradient w.r.t. position. (It's just solving a linear system of equations.) If you need some other kind of interpolation (approximating second derivatives, etc), I don't really know anything about those methods (I could make up a few on the spot that would work, but wouldn't be ideal), but if you told me what you were thinking, I could tell you if it makes sense.
Last edited by Rashakil Fol; Nov 20th, 2007 at 3:04 am.
Reputation Points: 1135
Solved Threads: 172
Super Senior Demiposter
Offline 2,479 posts
since Jun 2005