Function Repository Resource:

Biarc

Source Notebook

Generate a biarc through two points

Contributed by: Jan Mangaldan

ResourceFunction["Biarc"][p1,d1,p2,d2]

represents the biarc through the points p1 and p2, with corresponding tangent directions d1 and d2.

Details

A biarc is a smooth curve formed from two circular arcs, whose continuity is imposed by making the two arcs have the same tangent at the point where they meet.
ResourceFunction["Biarc"] produces a JoinedCurve object which can be used in Graphics (two-dimensional graphics).
ResourceFunction["Biarc"][p1,d1,p2,d2,"Circle"] gives a list of Circle objects that comprise the biarc.

Examples

Basic Examples (1) 

Show a biarc through two points, with given tangent directions:

In[1]:=
Graphics[
 ResourceFunction["Biarc"][{0, 0}, AngleVector[\[Pi]/4], {1, 0}, AngleVector[\[Pi]/3]]]
Out[1]=

Scope (2) 

Show biarcs with varying tangent directions:

In[2]:=
Graphics[
 Table[{Hue[1 - Rescale[\[Theta], {-\[Pi]/3, \[Pi]/3}]/2], ResourceFunction["Biarc"][{0, 0}, {2, 1}, {1, 0}, AngleVector[\[Theta]]]}, {\[Theta], -\[Pi]/2, \[Pi]/2, \[Pi]/12}],
  PlotRange -> All]
Out[2]=

Give the circle arcs comprising a biarc:

In[3]:=
ResourceFunction["Biarc"][{0, 0}, {2, 1}, {1, 0}, {-1, 2}, "Circle"]
Out[3]=

Show the circle arcs and their corresponding centers along with the biarc:

In[4]:=
Graphics[{{AbsoluteThickness[5], ColorData[97, 1], ResourceFunction[
    "Biarc"][{0, 0}, {2, 1}, {1, 0}, {-1, 2}]}, {AbsoluteThickness[2],
    AbsolutePointSize[6], Transpose[{{ColorData[97, 4], ColorData[97, 3]}, %, Point[#1] & @@@ %}]}}]
Out[4]=

Applications (1) 

Interactively manipulate a biarc:

In[5]:=
Manipulate[
 Graphics[{{ColorData[97, 1], AbsoluteThickness[2], ResourceFunction["Biarc"][pt[[1]], pt[[2]] - pt[[1]], pt[[3]], pt[[4]] - pt[[3]]]}, {Arrowheads[Medium], ColorData[97, 4], Arrow[{pt[[1]], pt[[2]]}], Arrow[{pt[[3]], pt[[4]]}]}}, PlotRange -> 4], {{pt, N[{{-2, 0}, {-2, 1}, {2, 0}, {2, 1}}]}, Locator}, SaveDefinitions -> True]
Out[5]=

Properties and Relations (1) 

Biarc gives a JoinedCurve object:

In[6]:=
ResourceFunction["Biarc"][{0, 0}, {2, 1}, {1, 0}, {-1, 2}] // Head
Out[6]=

Version History

  • 1.0.0 – 23 June 2022

Source Metadata

License Information