Parametric Curve With Given Beginning and End Points

140 Views Asked by At

I need to find optimal curve between two given points, let's say $(1,1)$ and $(4,4)$ where the curve is second order polynomial. What would be the best way so that when remaining unknown coefficients are tweaked the shape of the curve changes but starting and end points stay the same?

I could do

$$ x = 1 + a_1 t + a_2 t^2 $$

$$ y = 1 + b_1 t + b_2 t^2 $$

where $0 \le t \le 10$ (the value 10 was chosen arbitrarily). This allows me to control the beginning of the curve and I can tweak the coefficients that give me different shapes but I have no control over the end point. I guess I am looking for a "class" of parametrized curve that stil has unknown coefficients (for shape) but has given beginning and end points.

I could also work with a parameterized curve that passes through two given points (I could simply adjust $t$ to limit the curve to the area of interest).

I will be using this curve to find an optimal path, so I need to be able to adjust the shape through coefficients but the two end points must remain the same.

One idea I had after reading this was that, limit $t$ to $0 \le t \le 1$, then from $(1,1)$ we can find $a_0=1,b_0=1$. Then for $t=1$, the end point,

$$ 4 = 1 + a_1(1) + a_2(1)^2 $$

$$ 4 = 1 + b_1(1) + b_2(1)^2 $$

which means as long as I choose $a_1,a_1,b_1,b_2$ so that $a_1+a_2=3$ and $b_1+b_2=3$ this could work.

2

There are 2 best solutions below

0
On BEST ANSWER

The approach I outlined seemed to work, the code

t = np.linspace(0,1.0)

a1=0.4
b1=2.9

sx,sy=(1,1)
ex,ey=(4,4)

a2 = ex - sx - a1
b2 = ey - sy - b1

print (a1+a2)
print (b1+b2)

x = 1.0 + a1*t + a2*t**2
y = 1.0 + b1*t + b2*t**2

plt.xlim(0,5.0)
plt.ylim(0,5.0)
plt.plot(x,y)

produces

enter image description here

For more complicated (higher degree) polynomials I could instruct my optimization routine for that specific sum $a_1+a_2+...+a_n = e_x$, same for $e_y$.

0
On

COMMENT.- There are an infinite number of parabolas that pass through points $(1,1$) and $(4,4)$ and that correspond in your case to the four coefficients $a_1, a_2, b_1, b_2$. You can arbitrarily choose, for example, three of them and the fourth is determined. Besides your parametric equations always give the point $(1,1)$ for $t=0$ so your only problem is the point $(4,4)$.

enter image description here