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

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=
[◼]
BandWeaver
[polyline,1]
Out[]=
Polygon
Number of points: 10
Embedding dimension: 2
,Polygon
Number of points: 10
Embedding dimension: 2
,Polygon
Number of points: 8
Embedding dimension: 2

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}};GraphicsEdgeForm[{Black,Thick}],Red,
[◼]
BandWeaver
[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}};GraphicsEdgeForm[{Black,Thick}],Green,
[◼]
BandWeaver
[polyline,.05]
Out[]=
Without self-intersection, the
ResourceFunction
PerforatePolygons is needed instead:
In[]:=
GraphicsEdgeForm[{Black,Thick}],Green,
[◼]
BandWeaver
[{{0,0},{0,1},{1,1},{1,0}},.1]
Out[]=
A single self-intersection is enough:
In[]:=
GraphicsEdgeForm[{Black,Thick}],Green,
[◼]
BandWeaver
[{{0,0},{0,1},{1,0},{1,1}},.1]
Out[]=
In[]:=
pts1=
;​​pts5=
;
In[]:=
bands=
[◼]
BandWeaver
[{pts1,pts5},.25];​​Graphics[{EdgeForm[{Black,Thick}],Green,bands[[1]],Red,bands[[2]]}]
Out[]=

Scope

Results of
BandWeaver
can be combined with other graphics:
In[]:=
polyline={{0,0},{2,1},{1,0},{0,1},{2,0},{1,1}};​​part=Partition[polyline,2,1,1];​​GraphicsEdgeForm[{Gray,Thin}],Yellow,
[◼]
BandWeaver
[polyline,.05],​​Blue,Table[Text[k,(3part[[k,1]]+2part[[k,2]])/5],{k,1,6}]
Out[]=
BandWeaver
works for multiple polylines:
In[]:=
lines=3N[CirclePoints[9]][[#]]&/@Transpose[Partition[Range[9],3]];​​bands=
[◼]
BandWeaver
[lines,.1];​​Graphics[{EdgeForm[{Black,Thick}],Cyan,bands[[1]],Green,bands[[2]],Blue,bands[[3]]}]
Out[]=

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

The possible band thickness is limited, most of the time:
A single self-intersection is enough:

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

BandWeaver: turn polylines into woven bands​
by Ed Pegg​
Wolfram Community, STAFF PICKS, February 25, 2026
​https://community.wolfram.com/groups/-/m/t/3645058