Repository navigation
Add offsetPath: move a floor polyline sideways with mitred corners - #137
Open
dbritto-dev wants to merge 1 commit into
Open
dbritto-dev wants to merge 1 commit into
dbritto-dev wants to merge 1 commit into
Conversation
A track, a belt or a lane has two edges that follow one centreline. The kit can fillet, resample and walk a path, but not offset one, so each figure had to work out its own normals and corner joins. offsetPath(points, by, limit) returns the path moved sideways by `by`, point for point. A positive `by` moves a path that runs along +x toward +y. Corners are mitred so both legs stay `by` away, a mitre never reaches past `limit` x `by` from its corner, and repeated points move with their neighbours. It is a new export; nothing existing changes. The pages that inline the kit (dial indicator, desk computer, arcade cabinet, ripple tank, push button) gain the function and nothing else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5z2gCvevbrGU3fXgpGDmP
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Adds
offsetPath(points, by, limit = 4)to the kit: a floor polyline moved sideways byby, point for point.bymoves a path that runs along +x toward +y.byaway; a mitre never reaches pastlimit×byfrom its corner (like SVG'sstroke-miterlimit).It is in
kit/iso-kit.tsandkit/iso-kit.mjs(the transpiled output, unchanged elsewhere), listed inreferences/kit.mdunder "Solids" next toinsetPlan, and covered byscripts/offset-path.test.mjs: straight paths both ways, square corners inside and outside, the exactbydistance from both segments along a curve, the mitre limit on a hairpin, repeated points, and the TypeScript twin.Why
Two-edged things follow one centreline: both rails of a track, the edges of a belt, a lane, a road, a pair of parallel cables. The kit can
fillet,resample,cutand walk a path, but not offset one, so a figure had to compute normals and corner joins itself. A railway-junction figure needed it for its bed, both rails and its sleepers.Checks
git status --shortshows only the changes I meant. The pages that inline the kit (dial indicator, desk computer, arcade cabinet, ripple tank, push button, both themes) gain the function and nothing else.node examples/raptor-engine/build.mjs --light --auditendsaudit passedon this branch (80 tubes, 267 solids, 478 items, 1,119 depth states). This PR changes no pipe, cable or round part.node scripts/lines.mjsprintsline ends: 0on all ten pages this PR changes: dial indicator, desk computer, arcade cabinet, ripple tank and push button, light and dark.main(0 differing pixels), light and dark, with WebGL and with--no-webgl.node examples/turning-dial/build.mjs --light --auditon this branch reports the same 4 problems asmain, where the full report is every line 0 exceptcrowding: 4(cable.greenend ×hand.f3.p1at 165°,cable.blueend ×hand.f3.p1at 200°,cable.redend ×hand.f1.p1at 210°,cable.greenend ×hand.piston.rodat 285°), so they come from the turning-dial example, not this PR.scripts/turn-check.mjs examples/turning-dial/build.mjs --fidelitypasses, and the turning-dial pages rebuild byte-identical tomain.UnreleasedinCHANGELOG.md.node --test scripts/*.test.mjs: 296 of 296 pass.This and the
sideOutlinePR (#136) each add aCHANGELOG.mdline in the same spot, so whichever merges second needs a one-line rebase.Screenshots
A demo plate (not committed): the bed edges (±8), both rails (±4) and the sleepers all come from one S-curve centreline through
offsetPath.🤖 Generated with Claude Code
https://claude.ai/code/session_01S5z2gCvevbrGU3fXgpGDmP