Skip to content

Instantly share code, notes, and snippets.

@baku89
Created June 27, 2024 13:47
Show Gist options
  • Save baku89/5de7c85c78924d208295b1a0f802d596 to your computer and use it in GitHub Desktop.
Save baku89/5de7c85c78924d208295b1a0f802d596 to your computer and use it in GitHub Desktop.
chamfer.pave.js
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