Wolfram Research

Function Repository Resource:

ArcLine

Source Notebook

A curved line between two points

Contributed by: Jon McLoone

ResourceFunction["ArcLine"][{p1,p2},r]

represents a curved 2D line segment joining points p1 and p2 with radius r.

ResourceFunction["ArcLine"][{p1,p2},Scaled[n]]

represents a curved 2D line segment joining points p1 and p2 with radius n times the distance between p1 and p2.

ResourceFunction["ArcLine"][{p1,p2}]

represents a curved 2D line segment joining points p1 and p2 with radius Scaled[1].

Examples

Basic Examples

Generate an arc between two points:

In[1]:=
c = ResourceFunction["ArcLine"][{{0, 0}, {1, 1}}]
Out[1]=

Show this arc segment:

In[2]:=
Graphics[c, Axes -> True]
Out[2]=

Scope

Arc radius can be set anywhere between the 1/2 of the Euclidean distance between the points and infinity. :

In[3]:=
Graphics[Table[
  ResourceFunction["ArcLine"][{{0, 0}, {1, 1}}, r], {r, Sqrt[2]/2, 3, 0.1}]]
Out[3]=

Negative radius values change the orientation of the arc:

In[4]:=
Graphics[Table[
  ResourceFunction["ArcLine"][{{0, 0}, {1, 1}}, -r], {r, Sqrt[2]/2, 3,
    0.1}]]
Out[4]=

Arc radius can be given as a multiple of EuclidianDistance between the points:

In[5]:=
Graphics[Table[
  ResourceFunction["ArcLine"][{{0, 0}, {n, n}}, Scaled[1]], {n, 1, 10}]]
Out[5]=

Properties and Relations

ArcLine with an Infinite radius is equivalent to Line:

In[6]:=
ResourceFunction["ArcLine"][{{0, 0}, {1, 1}}, Infinity]
Out[6]=

Possible Issues

The radius of the ArcLine cannot be less than 1/2 of the EuclideanDistance between the points:

In[7]:=
ResourceFunction["ArcLine"][{{0, 0}, {1, 1}}, Scaled[1/4]]
Out[7]=
In[8]:=
ResourceFunction["ArcLine"][{{0, 0}, {1, 1}}, 0.1]
Out[8]=

Neat Examples

You can create rounded regular polygons using CirclePoints:

In[9]:=
Graphics[ResourceFunction["ArcLine"][#, 1] & /@ Partition[CirclePoints[5.], 2, 1, 1]]
Out[9]=
In[10]:=
Graphics[ResourceFunction["ArcLine"][#, -2] & /@ Partition[CirclePoints[5.], 2, 1, 1]]
Out[10]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information