srecord noeq G22MeshScrambler(G22Mesh mesh) { delegate Anchor, Curve to G22Mesh. G22Mesh scrambledMesh; new Map anchorMap; G22Mesh get() { scrambledMesh = new G22Mesh; // copy anchors in shuffled order for (a1 : shuffled(mesh.anchors())) { var a2 = scrambledMesh.newAnchor(a1.pt); anchorMap.put(a1, a2); } // copy curves (optionally flipping them) for (c1 : shuffled(mesh.curves())) { bool flip = flipCoin(); var path = flip ? c1.path.reversed() : c1.path; scrambledMesh.addCurve(new Curve( anchorMap.get(c1.anchor(flip)), anchorMap.get(c1.anchor(!flip)), path )); } ret scrambledMesh; } }