Skip to content

feat: add bezier_patch_join() for G1-continuous surface joining (#568)#1962

Open
junhinhow wants to merge 1 commit intoBelfrySCAD:masterfrom
junhinhow:feat/smooth-polygons-568
Open

feat: add bezier_patch_join() for G1-continuous surface joining (#568)#1962
junhinhow wants to merge 1 commit intoBelfrySCAD:masterfrom
junhinhow:feat/smooth-polygons-568

Conversation

@junhinhow
Copy link
Copy Markdown

Summary

  • Add bezier_patch_join(patch1, edge1, patch2, edge2, tangent_len) function in beziers.scad
  • Creates a cubic bezier patch that smoothly connects edges from two existing patches with G1 (tangential) continuity
  • Edge specification via strings: "u0", "u1", "v0", "v1"
  • Interior control points computed from surface tangent directions at boundaries
  • tangent_len parameter controls transition curvature (fraction of inter-edge distance)
  • Helper function _bpj_edge_data() extracts edge points and tangent vectors
  • Tests covering: u/v edge joining, G0 continuity verification, VNF generation, tangent_len variation

This is a building block for the broader smooth 3D polygon goal discussed in #568 — enables programmatic joining of bezier surfaces with guaranteed smoothness.

Test plan

  • Joining flat patches via u-edges produces valid bezier patch
  • Joining via v-edges produces valid patch
  • G0 continuity verified (shared boundary points match exactly)
  • Combined patches generate valid VNF via bezier_vnf()
  • Different tangent_len values produce different interior control points
  • No regressions in existing bezier tests

Addresses #568

🤖 Generated with Claude Code

…rySCAD#568)

Adds bezier_patch_join(patch1, edge1, patch2, edge2, tangent_len) to
beziers.scad for creating smooth transition patches between existing patches.

The function:
- Extracts points and tangent vectors from specified edges (u0/u1/v0/v1)
- Computes interior control points along tangent direction to ensure
  G1 (tangential) continuity at the junction
- tangent_len parameter controls transition curvature (fraction of
  inter-edge distance, default 1/3)
- Returns cubic patch (4 rows) compatible with bezier_vnf()

Helper function _bpj_edge_data() extracts edge/tangent data from any
side of a bezier patch.

Full documentation with Synopsis, SynTags, Topics, Examples.
Tests added covering: u/v edge joining, G0 continuity, valid VNF,
variable tangent_len.

Contributes to issue BelfrySCAD#568 (smooth 3D polygons) as a building block
for smooth surface joining.
@junhinhow junhinhow force-pushed the feat/smooth-polygons-568 branch from b7812fd to ff459e6 Compare April 6, 2026 13:48
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.

1 participant