Skip to content

Docs page: reproduce BOSL2 bevel_gear() Examples 1-3 side by side #89

Description

@gsdali

Part of #84. This is the deliverable artefact for the epic.

Depends on #85, #86, #87 and #88.

Goal

A docs page that reproduces Examples 1, 2 and 3 from the BOSL2
bevel_gear() documentation,
showing the OpenSCAD original and the OCCTSwift reproduction side by side, along with the
Swift script that generated each.

The three examples

Verbatim from gears.scad:

Example 1: bevel gear with zerol teeth (gears.scad:2400-2404)

bevel_gear(
    circ_pitch=5, teeth=36, mate_teeth=36,
    shaft_diam=5, spiral=0
);

Single gear. spiral=0 with a defaulted cutter_radius gives zerol teeth (curved
lengthwise trace, zero spiral angle at the midpoint), not straight teeth. Exercises core
construction plus the bore.

Example 2: spiral bevel gear and pinion (gears.scad:2405-2414)

t1 = 16; t2 = 28;
color("lightblue")bevel_gear(
    circ_pitch=5, teeth=t1, mate_teeth=t2,
    slices=12, anchor="apex", orient=FWD
);
bevel_gear(
    circ_pitch=5, teeth=t2, mate_teeth=t1, right_handed=true,
    slices=12, anchor="apex", backing=3, spin=180/t2
);

A meshing pair at 90 degrees. Default spiral=35. Exercises spiral teeth, right_handed
mirroring, conical backing, and apex-coincident placement. The BOSL2 caption notes the conical
backing on the yellow gear is what stops it being too thin.

Example 3: manual spacing of pinion and gear (gears.scad:2415-2430)

t1 = 14; t2 = 28; circ_pitch=5;
color("lightblue")back(pitch_radius(circ_pitch, t2)) {
  yrot($t*360/t1)
  bevel_gear(
    circ_pitch=circ_pitch, teeth=t1, mate_teeth=t2, shaft_diam=5,
    slices=12, orient=FWD
  );
}
down(pitch_radius(circ_pitch, t1)) {
  zrot($t*360/t2)
  bevel_gear(
    circ_pitch=circ_pitch, teeth=t2, mate_teeth=t1, right_handed=true,
    shaft_diam=5, slices=12, backing=3, spin=180/t2, cone_backing=false
  );
}

Explicit placement rather than anchors, and cone_backing=false (cylindrical backing).
This is an Example(Anim, Frames=4) in BOSL2. Reproduce the static $t=0 frame; an animation
is not a goal.

Page structure

Proposed layout, one section per example, each with:

  1. The BOSL2 OpenSCAD source (verbatim, as above)
  2. The OCCTSwift equivalent
  3. The two renders side by side, captioned so it is obvious which is which
  4. A short note on any deliberate divergence

Plus a preamble covering what was ported vs reimplemented, and a closing section on the known
limitations (no undercut simulation, no profile shift; see the out-of-scope list in #84).

Proposed file layout

docs/guides/bosl2-bevel-gears.md          # the page
docs/guides/bosl2-bevel-gears/
    example1.swift  example1.png
    example2.swift  example2.png
    example3.swift  example3.png

Note on the recipes/ convention: each recipe emits exactly one body as body-0
(recipes/README.md), but Examples 2 and 3 are gear pairs. So these live as docs examples
rather than recipes. If a conforming single-body recipe is wanted, split Example 1 out into
recipes/08-bevel-gear/, which already fits the one-body rule.

Accuracy requirement

The renders will not be pixel-identical to BOSL2's, and should not pretend to be. Where the
geometry genuinely differs (tooth profile detail from the deferred undercut simulation, B-Rep
vs mesh faceting), say so in the caption. A side-by-side that quietly glosses over a real
divergence is worse than no page. If an example cannot be reproduced faithfully, ship the page
with that example marked as such and the reason stated.

Acceptance criteria

  • All three examples reproduced and rendered
  • Renders shown side by side with the BOSL2 originals
  • The generating Swift source shown for each, and committed as runnable scripts
  • Each script actually runs via occtkit run (wire into make recipes-test if it fits)
  • Divergences from BOSL2 stated explicitly, per example
  • Attribution to BOSL2 (BSD-2-Clause, Copyright Revar Desmera) in each ported source file
  • Page linked from docs/ index and from recipes/README.md
  • Page prose conforms to okf/policies/writing-style.md (no em-dashes, no banned words)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:docsDocumentation only

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions