Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Solving tri-linear interpolation parameters

  1. Oct 28, 2012 #1
    I'm trying to find the tri-linear interpolation parameters of a point C within a hexahedron of 3d vectors (C000, C100, C010, C011 etc)

    You could call this "inverse tri-linear interpolation"

    Ive used the same variable names as this wikipedia article: http://en.wikipedia.org/wiki/Trilinear_interpolation

    if Xd, Yd & Zd are the 0..1 trilinear parameters for x,y & z respectively, how can I solve the equations for these parameters? The interpolated point C is known.

    Many thanks
    Last edited: Oct 28, 2012
  2. jcsd
  3. Oct 29, 2012 #2
    to break this down further, this is the tri-linear equation.

    R = ((1-Yd) * (p000 * (1-Xd) + p100 * Xd ) + (p010 * (1-Xd) + p110 * Xd ) * Yd) * (1-Zd) +
    ((1-Yd) * (p001 * (1-Xd) + p101 * Xd ) + (p011 * (1-Xd) + p111 * Xd ) * Yd) * Zd;

    where R is tri-linear interpolated result,
    P000-P111 are the 8 points of a hexahedron that define the 3D interpolation space
    R and P can be either scalar or vector

    Xd, Yd, and Zd are scalars and are the tri-lin parameters Im trying to find

    When Xd,Yd & Zd = 0, R = p000 and when Xd,Yd & Zd = 1, R = p111 etc

    Clearly there are some degenerate cases here, but my maths is a little rusty and Im finding tricky to solve for R... any ideas? Thanks!
  4. Oct 29, 2012 #3
    I'll add to this as I progress, but interestingly Wolfram Alpha could only solve this for the simplest factor Z: (only 2 occurances)

    Z = (a X Y+a (-X)-a Y+a-b X Y+b X-c X Y+c Y+d X Y-R)/(a X Y+a (-X)-a Y+a-b X Y+b X-c X Y+c Y+d X Y-e X Y+e X+e Y-e+f X Y-f X+g X Y-g Y-h X Y)

    Since factors a-h form a cube of values, I can swap them around to create two other equations in the exact form above wrt X and Y.

    Assuming I have all 3 equations, what is the safest way to combine all 3 equations to calculate X, Y & Z?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook