Contents
raw proof

Rounded Corners on Path Segment

Robert Eisele

Given a path segment by three points \(A\), \(B\) and \(C\) as well as a the radius \(r\) we want to have at point \(B\). Now the vectors the vectors from \(B\) to \(A\) and \(C\) respectively are \(\mathbf{a}=A-B\) and \(\mathbf{b}=C-B\). The bisector of these two vectors is \(\mathbf{v}=\hat{\mathbf{a}}+\hat{\mathbf{b}}\).

vMBACXY

The mid-point of the circle \(M\) is given by

\[\begin{array}{rl} M&= B + \hat{\mathbf{v}}\frac{r}{\sin\frac{\theta}{2}}\\ &= B + \hat{\mathbf{v}}\frac{r}{\frac{\sqrt{1-\hat{\mathbf{a}}\cdot\hat{\mathbf{b}}}}{\sqrt{2}}}\\ &= B + \hat{\mathbf{v}}\frac{\sqrt{2}r}{\sqrt{1-\hat{\mathbf{a}}\cdot\hat{\mathbf{b}}}}\\ &= B + \frac{\hat{\mathbf{a}}+\hat{\mathbf{b}}}{\sqrt{|\hat{\mathbf{a}}+\hat{\mathbf{b}}|^2}}\cdot\frac{\sqrt{2}r}{\sqrt{1-\hat{\mathbf{a}}\cdot\hat{\mathbf{b}}}}\\ &= B + (\hat{\mathbf{a}}+\hat{\mathbf{b}})\frac{\sqrt{2}r}{\sqrt{(\hat{\mathbf{a}}+\hat{\mathbf{b}})\cdot(\hat{\mathbf{a}}+\hat{\mathbf{b}})\cdot(1-\hat{\mathbf{a}}\cdot\hat{\mathbf{b}})}}\\ &= B + (\hat{\mathbf{a}}+\hat{\mathbf{b}})\frac{r}{\sqrt{1-(\hat{\mathbf{a}}\cdot\hat{\mathbf{b}})^2}}\\ \end{array}\]

Now the intersection points \(X\) and \(Y\) on \(\vec{BA}\) and \(\vec{BC}\) respectively can be found with

\[X = B + \hat{\mathbf{a}}w\]

\[Y = B + \hat{\mathbf{b}}w\]

where the weight \(w\) is

\[\begin{array}{rl} w &= \frac{r}{\tan\frac{\theta}{2}}\\ &= \frac{r}{\tan\left(\frac{1}{2}\cos^{-1}(\hat{\mathbf{a}}\cdot\hat{\mathbf{b}})\right)}\\ &= \frac{r}{\frac{\sqrt{1-\hat{\mathbf{a}}\cdot\hat{\mathbf{b}}}}{\sqrt{1+\hat{\mathbf{a}}\cdot\hat{\mathbf{b}}}}}\\ &= \frac{r}{\sqrt{\frac{2}{1+\hat{\mathbf{a}}\cdot\hat{\mathbf{b}}}-1}}\\ &= r\cdot \sqrt{\frac{2}{1-\hat{\mathbf{a}}\cdot\hat{\mathbf{b}}}-1} \end{array}\]