# 4 point interpolation

• May 4th 2011, 11:17 PM
riggs3344
4 point interpolation
Hello, I hope this post belongs to the right topic.

I have a problem where i want to calculate a value at a normalized (x,y) position on a square field where values for the four corner points are known. I know this sounds like a problem found anyware so there should be a simple way of doing this.

Problem:
Given a square field with corners (0,0)=A (1,0)=B (0,1)=C (1,1)=D, calculate interpolated value at point (x,y) where x={0..1} and y={0..1}

Solution (brutal force):
x1=A+(B-A)x
x2=C+(D-C)x
y1=A+(C-A)y
y2=B+(D-B)y
result = (x1+(x2-x1)x + y1+(y2-y1)y)/2

Is there a simple way?
• May 5th 2011, 02:09 AM
CaptainBlack
Quote:

Originally Posted by riggs3344
Hello, I hope this post belongs to the right topic.

I have a problem where i want to calculate a value at a normalized (x,y) position on a square field where values for the four corner points are known. I know this sounds like a problem found anyware so there should be a simple way of doing this.

Problem:
Given a square field with corners (0,0)=A (1,0)=B (0,1)=C (1,1)=D, calculate interpolated value at point (x,y) where x={0..1} and y={0..1}

Solution (brutal force):
x1=A+(B-A)x
x2=C+(D-C)x
y1=A+(C-A)y
y2=B+(D-B)y
result = (x1+(x2-x1)x + y1+(y2-y1)y)/2

Is there a simple way?