BandWeaver is a resource function that returns polygon bands of twice a given half width for an over/under weaving of self-intersecting polylines. Function’s documentation page: https://resources.wolframcloud.com/FunctionRepository/resources/BandWeaver/
Examples
Examples
Turn a polyline into woven bands:
In[]:=
polyline={{0,0},{6,0},{6,9},{3,9},{3,3},{9,3},{9,6},{0,6},{0,0}};bands=[polyline,1]
Out[]=
Polygon,Polygon,Polygon
Look at the polyline and the generated polygon bands:
In[]:=
Row[Flatten[Join[{Graphics[{Line[polyline]}],Graphics[#]&/@bands[[1]]}]]]
Out[]=
Look at the full woven band:
In[]:=
Graphics[{EdgeForm[{Black,Thick}],Cyan,bands}]
Out[]=
Show knight moves:
In[]:=
knight={{0,0},{1,2},{2,0},{0,1},{2,2},{1,0},{0,2},{2,1},{0,0}};GraphicsEdgeForm[{Black,Thick}],Red,[knight,.06]
Out[]=
The possible band thickness is limited, most of the time:
In[]:=
polyline={{0,1},{2,0},{1,1},{3,2},{2,3},{1,2},{3,1},{1,0},{2,1},{0,2},{1,3},{2,2},{0,1}};GraphicsEdgeForm[{Black,Thick}],Green,[polyline,.05]
Out[]=
In[]:=
GraphicsEdgeForm[{Black,Thick}],Green,[{{0,0},{0,1},{1,1},{1,0}},.1]
Out[]=
A single self-intersection is enough:
In[]:=
GraphicsEdgeForm[{Black,Thick}],Green,[{{0,0},{0,1},{1,0},{1,1}},.1]
Out[]=
In[]:=
pts1=;pts5=;
In[]:=
bands=[{pts1,pts5},.25];Graphics[{EdgeForm[{Black,Thick}],Green,bands[[1]],Red,bands[[2]]}]
Out[]=
Scope
Scope
Results of can be combined with other graphics:
BandWeaver
In[]:=
polyline={{0,0},{2,1},{1,0},{0,1},{2,0},{1,1}};part=Partition[polyline,2,1,1];GraphicsEdgeForm[{Gray,Thin}],Yellow,[polyline,.05],Blue,Table[Text[k,(3part[[k,1]]+2part[[k,2]])/5],{k,1,6}]
Out[]=
BandWeaver
In[]:=
lines=3N[CirclePoints[9]][[#]]&/@Transpose[Partition[Range[9],3]];bands=[lines,.1];Graphics[{EdgeForm[{Black,Thick}],Cyan,bands[[1]],Green,bands[[2]],Blue,bands[[3]]}]
Out[]=
Applications
Applications
Code for a bouncing ball:
Let's make a Celtic weave out of it:
Let's try weaving some weaving:
Show a knight's tour:
Possible Issues
Possible Issues
The possible band thickness is limited, most of the time:
A single self-intersection is enough:
Neat Examples
Neat Examples
Code for making star polylines:
Weave together two 9-pointed stars:
Still using the star code, make woven bands out of many stars:
More elaborate star-like weavings:
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
BandWeaver: turn polylines into woven bands
by Ed Pegg
Wolfram Community, STAFF PICKS, February 25, 2026
https://community.wolfram.com/groups/-/m/t/3645058
by Ed Pegg
Wolfram Community, STAFF PICKS, February 25, 2026
https://community.wolfram.com/groups/-/m/t/3645058