Created
June 27, 2024 13:47
-
-
Save baku89/5de7c85c78924d208295b1a0f802d596 to your computer and use it in GitHub Desktop.
chamfer.pave.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const r = unite([ | |
rect([20, 30], [80, 70]), | |
rect([40, 10], [60, 90]), | |
]) | |
function chamfer(path, distance) { | |
return spawnVertex(r, (seg, index, curve) => { | |
const next = Curve.nextSegment(curve, index) | |
const point = Segment.point(next, {offset: distance}) | |
return [ | |
Segment.trim(seg, 0, {offset: -distance}), | |
{command: 'L', point} | |
] | |
}) | |
} | |
stroke(chamfer(r, scalar.sinwave(time) * 10)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment