Is there a variation of trilinear interpolation that works on a "cube" that has been distorted (by moving one or more of its corners by an arbitrary amount into an arbitrary direction)?

I know that I could use the inverse of the distance to each of the 8 corners as weights to get an interpolated point within the distorted cube, but that would involve taking a lot of square roots which would slow my algorithm way down. I like the elegant way of trilinear interpolation but I can't figure out how to adapt it to a distorted cube. Any hint on a fast interpolation method for this situation would be much appreciated.

  • $\begingroup$ Can you explain what trilinear interpolation is? $\endgroup$ – Yuval Filmus Nov 9 '17 at 14:34
  • $\begingroup$ It combines two bilinear and one linear interpolation to find the value of a feature at a known coordinate within a cube of which you know the values of that feature for the 8 cube corners: en.wikipedia.org/wiki/Trilinear_interpolation $\endgroup$ – Simeon Nov 9 '17 at 14:45
  • $\begingroup$ Are you also assuming that the values are linear in all cardinal directions? $\endgroup$ – Yuval Filmus Nov 9 '17 at 14:46
  • $\begingroup$ Yes, for my application I assume the values are linear. My features are basically 3D coordinates. My input are coordinates in a distorted cube and I want to know the coordinates if you were to un-distort the cube (back to a unit cube). The distortion (by way of moving the cube corners) is supposed to be linear. $\endgroup$ – Simeon Nov 9 '17 at 14:53

Imagine a cube with each corner a different RGB color value - as you know you could interpolate the colors inside the cube using trilinear interpolation.

You can reuse this same logic for coordinates as well -- set the RGB values of the corners to be the XYZ coords of your distorted cube's corners.

Now the RGB "color" you sample in this cube is the distorted coordinate -- eg, it is the coordinate of your sampling point after that point has been "remapped" to the now-distorted cube, using the normal trilinear algorithm.

Hope this helps.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.