Skip to content

Spike 3: spiral tooth trace + backing / handedness / bore #87

Description

@gsdali

Part of #84. Depends on #86 (builds on whichever route won).

Goal

Add the spiral tooth trace to the winning construction route, plus the remaining parameters
needed by the deliverable examples.

Time-box: half a day.

The spiral is a cutter simulation

BOSL2 places a circle of radius cutter_radius, offset from the mid-cone radius by the
spiral angle, and uses law-of-cosines to find where that circle crosses the outer and inner
cone radii (gears.scad:2528-2537):

cutter_radius = is_undef(cutter_radius) ? face_width * 2 / cos(spiral)
              : cutter_radius==0? face_width*100 : cutter_radius,
midpr  = (icone_rad + ocone_rad) / 2,
radcp  = [0, midpr] + polar_to_xy(cutter_radius, 180+spiral),
angC1  = law_of_cosines(a=cutter_radius, b=norm(radcp), c=ocone_rad),
angC2  = law_of_cosines(a=cutter_radius, b=norm(radcp), c=icone_rad),
sang   = v_theta(radcp) - (180-angC1),
eang   = v_theta(radcp) - (180-angC2),

The arc from sang to eang is the lengthwise tooth trace, a direct model of a Gleason
face-mill cutter head. Each slice station samples a point on that arc; the resulting
zrot(ang/sin(pitch_angle)) in the transform stack is the cone-unwrap correction.

Note the three tooth forms fall out of two parameters:

  • spiral > 0, cutter_radius > 0 gives spiral
  • spiral = 0, cutter_radius > 0 gives zerol (curved trace, zero spiral angle at midpoint)
  • cutter_radius = 0 gives straight (BOSL2 fakes this with face_width*100, and forces
    slices = 1)

Also in scope

The remaining parameters the three deliverable examples need:

  • backing, conical (cone_backing = true, the default) vs cylindrical. In OCCT this is a
    revolved profile unioned on, which is easier than BOSL2's manual vertex arithmetic at
    gears.scad:2602-2613.
  • right_handed, a mirror (gears.scad:2640).
  • shaft_diam, subtracting(cylinder), already done in recipes/04-spur-gear/main.swift:80-82.
  • slices, since the deliverable examples use slices=12.

Gotcha worth recording

BOSL2's own docs say slices defaults to 1 (gears.scad:2391) but the code default is 5
(gears.scad:2498). Trust the code. Mirror the code's behaviour, not the docs'.

Acceptance criteria

  • Spiral, zerol and straight tooth forms all build as valid solids
  • right_handed = true produces a correctly mirrored gear
  • Conical and cylindrical backing both build
  • shaft_diam bore cuts cleanly
  • slices = 12 (as used by the deliverable examples) builds in acceptable time
  • A rendered spiral gear image attached to the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:spikeInvestigation / research, not a fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions