Function to represent curve between two 2D points

1.4k Views Asked by At

I need a (simplest) function that interpolates values in range from predefined point $A$ to $B$ with rules:

  • it must be smooth curve
  • direction near $B$ must be the same as predefined $D$ vector

enter image description here

I have a variant to build circle arc but is too complex. Maybe some sort of splines, but I don't know how to represent it with my $A$, $B$ points and $D$ vector.

1

There are 1 best solutions below

1
On BEST ANSWER

Given a starting point $A$, ending point $B$ and final direction $D$, you can define a quadratic Bezier curve. Let $M=B-D$, $M$ being the middle point used to define the curve. The curve $f$ is given by

$$f(t)=(1-t)[(1-t)A+tM]+t[(1-t)M+tB],\ 0\leq t\leq 1$$

You can adjust the smoothness of the curve by changing the placement of $M$. You can do this by choosing a scaling factor $x>0$ and setting $M=B-xD$.