Interpolating point outside quad

626 Views Asked by At

I'm trying to interpolate a destination point $(x,y)$ outside of a $4$ point convex polygon given a $4$ point source polygon with known values. It's sort of like inverse bilinear interpolation, except when the interpolated point lies OUTSIDE of a convex polygon.

For instance, given the following source polygon, I know all values for the poly $(ABCD)$ the point $(P)$, and then the intersection $t$ $(0 \dots 1)$ the distance $s1$ and $s2$:

enter image description here

The points of the polygon will be translated to new points in the destination, ie: enter image description here

Where the known values are $ABCD$, the intersection of $t$ (will be the same as the source), $s2$, $s1$, but unknown $P$

Is there a way to solve for $P$ without using trigonometry? I'm sure there is but I've stared at this so long that my brain turned off.

2

There are 2 best solutions below

1
On BEST ANSWER

The general bilinear interpolation formula is: $$P(u,v) = (1-u)(1-v)C + (1-u)vD + u(1-v)A + uvB$$ You can easily see that $P(0,0)=C$, $P(0,1)=D$, $P(1,0)=A$, $P(1,1)=B$.

Furthermore, points of the form $P(0,v)$ lie along the line $CD$, points of the form $P(1,v)$ lie along $AB$, and so on. The point $P(u,v)$ lies inside the quadrilateral if $0 \le u \le 1$ and $0 \le v \le 1$, or outside otherwise.

The meanings of $s1$ and $s2$ are a bit obscure, so this is a strange way to specify a point. But anyway, given a value $t$ and two values $s1$ and $s2$, you should put

$$ u = t \quad ; \quad v = (s1+s2)/s2$$

and then plug these $u$ and $v$ values into the formula for $P(u,v)$ above. Note that $v>1$, which is to be expected since your point is outside the quadilateral.

This is the same result that was given in the other answer; it's just written in terms of general bilinear interpolation (which might be helpful), rather than in geometric terms.

0
On

$P=Q+\dfrac{s_1}{s_2}(Q-R)$, where $Q=A+t(B-A)$ and $R=C+t(D-A)$ are the two points marked with $t$ in the diagram.