How do you find the two arcs to make a path between two points and two tangents?

509 Views Asked by At

Say I have two points $A$ and $B$ in an $(x,y)$ plane and tangents of the points which are normalised vectors $\mathrm{dir} A$ $\mathrm{dir} B$, how do you find a path made of two arcs that join them together?

Here is a visual of what I mean. Since the images are not clear, the grey vectors from the two tangents are equal in magnitude but the magnitude is unknown.

enter image description here

Note: I am looking for perfect arcs not cubic bezier curves.

1

There are 1 best solutions below

17
On BEST ANSWER

Geogebra drawing

Say that you have a line $a$ defined by two points, $A$ and $A'$, and a line $b$ defined by points $B$ and $B'$. In my Geogebra drawing you can adjust directions of lines $a,b$ by moving points $A'$ and $B'$. You want to create a smooth curve APB made of two circular arcs, $AP$ and $PB$, so that arc $AP$ is tangent to line $a$ at point $A$ and arc $PB$ is tangent to line $b$ at point $B$.

First of all, if nothing else is given, there are infinitely many solutions. I will show that exactly one solution can be obtianed by fixing point $D$ on line $a$ so that line $DPE$ is tangent to both arcs at point $P$.

Introduce $F=a\cap b$. I will discuss only one case

  • when point $F$ exists ($a \not\parallel b$)
  • point $D$ is between $F$ and $A$
  • point $E$ is between $F$ and $B$

Other cases can be discussed in a similar way.

enter image description here

The followin lengths and angle are known:

$p=FA, q=FB, x=FD, \alpha=\angle AFB$

The only problem is to calculate $y=FE$. Note that:

$$DE=DP+EP=DA+EB=(FA-FD)+(FB-FE)=p-x+q-y$$

On the other side:

$$DE^2=FD^2+FE^2-2FD\cdot FE \cos\angle AFB\tag{1}$$

or:

$$(p-x+q-y)^2=x^2+y^2-2xy\cos\alpha$$

$$p^2+q^2-2px+2pq-2py-2xq+2xy-2qy=-2xy\cos\alpha$$

$$p^2+q^2-2px+2pq-2xq=2py-2xy+2qy-2xy\cos\alpha$$

$$(p+q)^2-2x(p+q)=2y(p+q-x(1+\cos\alpha))$$

$$FE=y=\frac{p+q}{2}\ \frac{p+q-2x}{p+q-x(1+\cos\alpha)}$$

Now that you have point $E$, finding point P is easy (because $DP=DA,EP=EB$).

Center of arc AP can be found by intersecting line perpendicular to $DP$ at $P$ and bisector of angle $PDA$. In a similar way you can find the center of arc $BP$ (construction not shown).

You can play with my Geogebra drawing by moving lines $a$ and $b$ and adjusting position of point $D$. Basically, you can play with blue dots.

enter image description here

Other cases, for example, when $A$ is between $F$ and $D$ are also interesting. I'll leave detailed analysis up to you:

enter image description here

enter image description here

EDIT:

In the meantime WDUK added another condition:

$$AD=DP=PE=BE=z$$

In this case, by applying cosine theorem (1) to triangle $FDE$ we get the following equation:

$$(p-z)^2+(q-z)^2-2(p-z)(q-z)\cos\alpha=(2z)^2$$

The solutions are:

$$z_1=\frac{-p-q+(p+q)\cos\alpha+\sqrt{3p^2+2pq+3q^2-8pq\cos\alpha+(p-q)^2\cos^2\alpha}}{2(1+\cos\alpha)}$$

$$z_2=-\frac{p+q-(p+q)\cos\alpha+\sqrt{3p^2+2pq+3q^2-8pq\cos\alpha+(p-q)^2\cos^2\alpha}}{2(1+\cos\alpha)}$$

...and therefore we have two possible solutions, $APB$ and $AQB$:

enter image description here

Geogebra

EDIT 2:

Another example:

$$FA=p,\ FB=q,\ AD=DP=PE=BE=z$$

In this case, by applying cosine theorem (1) to triangle $FDE$ we get the following equation:

$$(p+z)^2+(q-z)^2-2(p+z)(q-z)\cos\alpha=(2z)^2$$

The positive solution of this quadratic equation is:

$$z=\frac{-p+q+(-p+q)\cos\alpha-\sqrt{3p^2-2pq+3q^2-8pq\cos\alpha+(p+q)^2\cos^2\alpha}}{2(-1+\cos\alpha)}$$

This defines positions of points $D$ and $E$. The rest of the construction is trivial.

enter image description here