Calculate curve using 3 points

778 Views Asked by At

I'm trying to find a way of creating a curve using 3 points in x,y space so I can use it to find other points.

Essentially I have a unit which moves up and down on the y axis and I want to be able to track it's position to another unit pointing at it. I don't know how far away that unit will be or at what height relative to the moving object.

If for example I need an output of 15 for 0, 45 for 50 and 60 for 100 would that allow me to plot a curve?

Does anyone have any ideas?

Example Image

1

There are 1 best solutions below

0
On

An interpolating polynomial could work here. I find the Lagrange interpolating polynomial intuitive to explain.

Let the $x$ coordinates of the $n$ points be distinct. Then for every set of $n-1$ points, we can construct the polynomial $(t-x_1)(t-x_2)\dots(t-x_{n-1})$ which will be zero at all $n-1$ points and a nonzero number at the last point. We can multiply this nonzero number by a suitable factor to equal to the value of the $y$ coordinate at this point.

By adding all $n$ possible polynomials of the form $A(t-x_1)(t-x_2)\dots(t-x_{n-1})$, each point will receive the value of its $y$ coordinate.