Libraryless. Click here for Pure Java version (11917L/69K).
srecord noeq G22MeshScrambler(G22Mesh mesh) { delegate Anchor, Curve to G22Mesh. G22Mesh scrambledMesh; new Map<Anchor> 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; } }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035374 |
Snippet name: | G22MeshScrambler - reorder anchors, flip curves (but keep mesh the same) |
Eternal ID of this version: | #1035374/3 |
Text MD5: | 669ef3023f3d75f2db2a35594da26770 |
Transpilation MD5: | 501439120f7d8c4697f76ffb2c8a14e5 |
Author: | stefan |
Category: | javax / gazelle 22 |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-05-03 13:14:39 |
Source code size: | 760 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 139 / 224 |
Version history: | 2 change(s) |
Referenced in: | [show references] |