Skip to content

Knurling round a cylinder: no crumpled diamonds where the facets' points lie near a groove's line - #2050

Merged
henmedia merged 1 commit into
henmedia:mainfrom
marcus040473:knurl-cylinder
Nov 24, 2026
Merged

henmedia merged 1 commit into
henmedia:mainfrom
marcus040473:knurl-cylinder

Conversation

@marcus040473

Copy link
Copy Markdown
Contributor

Summary

  • Reported in the Facebook group: raised knurling (spacing 2 mm, depth 0.6 mm) round a planter had a crumpled diamond here and there round the body, in the view and in the slicer.
  • Knurling is cut as two groove families (sliceStripes). For the second family sliceByField joins two triangles over their longest edge into a quad, except over an edge keepEdge says lies along a line of the first family. That edge was only recognised with both ends exactly on the line (|crossDiff| < 1e-6), measured again from the geometry, and two things put its ends off the line:
    • Round a cylinder a point cut onto the line lies on its facet's chord. Measured again by its angle round the axis (aroundAngle), it lies off the line: up to 0.06 mm on 20 facets 200 mm across, a few 0.0001 mm on a fine mesh.
    • A grid point closer to the line than the cut's snap (min(SURFACE_MIN_EDGE, P / 4)) takes the line's place without lying on it.
  • The quad was then joined across the line, its new triangles reached over the ridge, and the diamond's flanks bent inside them.
  • The first family's cut now hands every point its place across (sliceByField's withField): a point cut on a line has the line's value exactly, and a snapped grid point lies within the snap. Two points on lines count as on the same one when they lie closer together across than half the narrowest step between two lines. The straight faces' cut (cutRows) gets the same.
  • Costs a few percent more triangles for knurling, up to about 9 % on a cylinder of few facets (more quads stay two triangles).

Testing

  • npm run typecheck
  • npm test on 1.172.0
  • Manually tested the affected workflow
  • Every wall triangle checked against the pattern at its middle, on solid cylinders and tubes of 20 to 150 mm radius with 20 to 200 facets, inward and outward, spacing 1.5 to 3 mm, slant 30° and 45°, pointed and round profile. Before: triangles up to 0.3 mm off the pattern. Now: none more than 0.1 mm (what is left is the facet's chord against the round pattern).
  • Two new tests in tests/unit/surfaceTexture.test.ts, a fine planter (64 facets) and a cylinder of 20 facets. Both fail without the change.

Notes

  • A model textured before the fix keeps its bent triangles until the texture is applied again.

…nts lie near a groove's line (Facebook group)

Raised knurling round a planter had a crumpled diamond here and there, in the
view and in the slicer. The second groove family joins two triangles into a
quad except over an edge along a first-family line, and that edge was only
recognised with both ends exactly on the line (|crossDiff| < 1e-6), measured
again from the geometry. Two things put its ends off the line:

- Round a cylinder a point cut onto the line lies on its facet's chord; measured
  again by its angle round the axis it lies off the line, up to 0.06 mm on 20
  facets 200 mm across.
- A grid point closer to the line than the cut's snap takes its place without
  lying on it.

The quad was then joined across the line, its triangles reached over the ridge
and the diamond's flanks bent inside them. The first cut now hands every point
its place across (sliceByField's withField): a point cut on a line has the
line's value exactly, a snapped grid point lies within the snap. Two points on
lines are on the same one when they lie closer together across than half the
narrowest step between two lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6NM2EDqKZmFBDu96BaSKP
@henmedia
henmedia merged commit 252bf95 into henmedia:main Nov 24, 2026
11 checks passed
@henmedia

Copy link
Copy Markdown
Owner

@marcus040473 merged, thank you. Knurling round a cylinder now keeps its diamonds clean where a facet's points lie close to a groove's line, which fixes the crumpled diamonds on the planter from the Facebook group. The two new tests fail without the change, and the checks passed.

@henmedia

Copy link
Copy Markdown
Owner

@marcus040473 out in 1.173.0. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants