Jump to content
  • Advertisement
Sign in to follow this  
dangerdaveCS

Linear interpolation of cube corner vals inside cube

This topic is 3511 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!