Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Represent a polyline with rounded corners
| ResourceFunction["RoundedLine"][{p1,…,pn},r] represents a rounded polyline with points pi and rounding radius r. | |
| ResourceFunction["RoundedLine"][{{p11,p12,…},{p21,…},…},r] represents a collection of rounded polylines. | 
A rounded polyline:
| In[1]:= | ![Graphics[ResourceFunction[
  "RoundedLine"][{{1., 0.}, {2., 1.}, {3., 0.}, {4., 1.}}, 0.2]]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/6ce13acdd7c52b3d.png)  | 
| Out[1]= |   | 
| In[2]:= | ![Graphics3D[
 ResourceFunction[
  "RoundedLine"][{{1., 1., -1.}, {2., 2., 1.}, {3., 3., -1.}, {4., 4.,
     1.}}, 0.2]]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/3a2a70afc26d0003.png)  | 
| Out[2]= |   | 
Apply styling to a rounded polyline:
| In[3]:= | ![Graphics[{Directive[Blue, DotDashed], ResourceFunction["RoundedLine"][Line[{{0, 0}, {2, 1}, {4, 0}}], 0.4]}]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/3c7a189cf2e1c0c0.png)  | 
| Out[3]= |   | 
Multiple disconnected rounded polylines:
| In[4]:= | ![s = {{0, 0}, {2, 1}, {4, 0}};
Graphics[ResourceFunction["RoundedLine"][Line[{s, s + 1}], 0.3]]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/2aa09fec2e9c5caf.png)  | 
| Out[4]= |   | 
Use RoundedLine with Arrow:
| In[5]:= | ![Graphics[Arrow[
  ResourceFunction["RoundedLine"][{{0, 0}, {2, 1}, {4, 0}}, 0.6]]]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/1058a7a1406762a8.png)  | 
| Out[5]= |   | 
Use RoundedLine with Tube:
| In[6]:= | ![Graphics3D[
 Tube[ResourceFunction[
   "RoundedLine"][{{-1, -1, -1}, {0, 0, 1}, {1, 1, -1}}, 0.16], 0.3]]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/644b523d362fc245.png)  | 
| Out[6]= |   | 
If there are less than two points, a plain line is returned:
| In[8]:= | ![ResourceFunction["RoundedLine"][{{0, 0}, {1, 0}}, 1/2]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/544ee8dd55809241.png)  | 
| Out[8]= |   | 
No rounding is done for 180° angles:
| In[9]:= | ![ResourceFunction["RoundedLine"][{{0, 0}, {1/2, 0}, {1, 0}}, 1/2]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/1396f57f552d1d7a.png)  | 
| Out[9]= |   | 
If the rounding radius is too large, RoundedLine may give unexpected results:
| In[10]:= | ![Graphics[{Thick, ResourceFunction[
   "RoundedLine"][{{0., 0.}, {2., 0.}, {1.5, 1.}, {0.5, 1.}}, 0.6]}]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/27d86ff20143d0c7.png)  | 
| Out[10]= |   | 
Use a smaller rounding radius:
| In[11]:= | ![Graphics[{Thick, ResourceFunction[
   "RoundedLine"][{{0., 0.}, {2., 0.}, {1.5, 1.}, {0.5, 1.}}, 0.3]}]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/49a765aae4bc0da1.png)  | 
| Out[11]= |   | 
A rounded dragon curve:
| In[12]:= | ![Graphics[ResourceFunction["RoundedLine"][
  AnglePath[KroneckerSymbol[-1, Range[2048]] \[Pi]/2], 0.6]]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/5d307baa95ad4e56.png)  | 
| Out[12]= |   | 
A rounded Hilbert curve:
| In[13]:= | ![Graphics3D[
 Tube[ResourceFunction["RoundedLine"][HilbertCurve[3, 3], 0.2], 0.1]]](https://www.wolframcloud.com/obj/resourcesystem/images/1e2/1e2025e7-6106-4565-b44e-abd557640356/44bcd5d93824c1c9.png)  | 
| Out[13]= |   | 
This work is licensed under a Creative Commons Attribution 4.0 International License