Every side of the hat is a short or a long side of one of its kites. Give all the short sides one length a and all the long ones another length b, keep the angles, and the copies still fit together the same way. The hat's finders call such a shape Tile(a, b).
The source code is at github.com/KirillOsenkov/LiveGeometry. It is written in .NET and Avalonia.