Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
I would guess Bezier Curves. – axblount Aug 21 '12 at 14:38
How to set control point so the curve will have exact D direction in point B? – brigadir Aug 21 '12 at 14:44
You will have the place the middle point $M$ along the line through $B$ in direction $D$. You can place $M$ anywhere along that line. Roughly speaking, placing $M$ closer to the mid point between $A$ and $B$ (still along the $B$-$D$ line) will give you a smoother curve. – axblount Aug 21 '12 at 14:47
Basically the midpoint $M$ should be $B-D$. – axblount Aug 21 '12 at 14:54
up vote 0 down vote accepted

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$.

share|cite|improve this answer
Yes, looks like what I need. Thanks. x should be 1, otherwise the curve 'magnets' to one of points. – brigadir Aug 21 '12 at 15:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.