Sign in to follow this  
dangerdaveCS

Linear interpolation of cube corner vals inside cube

Recommended Posts

This should be straightforward, but I have a feeling that there should be some mathematical law or something that I'm not using. I have a cube with each of the 8 corners assigned a different value. I have a point somewhere inside that cube. I need to find the linearly interpolated value at that point using the values at the 8 corners of the cube. The way I'm doing it now is to get each of the 8 corner values and use the distance to each over the total distance to all as the ratio of their contribution to the final value. I have a feeling, though, that at least the total distance to all the corners is a constant depending on cube size, but I have no idea what that is. Just ignore that previous paragraph if I'm waffling, my main problem remains, can anyone give me a general solution to this interpolation problem? Cheers,

Share this post


Link to post
Share on other sites
I don't know either, but I have a few suggestions:

- output the computed distance on the screen, so that you'll see what type of value it is, and maybe you'll start to suspect what kind of equation it is

- simplify the problem to 2d rectangle - draw a rectangle on a piece of paper, draw a point and connect it with two corners, and draw a line between two corners, and try to do sth with the triangle that you'll get

HTH

Share this post


Link to post
Share on other sites
Hi.

This is a common problem within volume rendering and isosurfacing: given a cube with 8 values at its vertices, what is the value at a point p within the cube. The usual approach is to use trilinear interpolation. There are a lot papers describing this. For example, see the beggining os section 2 of this paper.

Share this post


Link to post
Share on other sites
Quote:
Original post by wolverine
For example, see the beggining os section 2 of this paper.


Awesome, exactly the info I needed, thanks. Looks like I was completely wrong in my previous implementation - which actually might just explain a few problems I've been having.

Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this