@bitbybit-dev/base 1.5.0-rc.0 → 1.6.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/bearings/ansi-bearings.constants.d.ts +2 -0
- package/lib/api/bearings/ansi-bearings.constants.js +26 -0
- package/lib/api/bearings/ansi-bearings.d.ts +4 -0
- package/lib/api/bearings/ansi-bearings.js +14 -0
- package/lib/api/bearings/bearing-types.d.ts +25 -0
- package/lib/api/bearings/bearing-types.js +1 -0
- package/lib/api/bearings/bearings.constants.d.ts +1 -0
- package/lib/api/bearings/bearings.constants.js +1 -0
- package/lib/api/bearings/iso-bearings.constants.d.ts +2 -0
- package/lib/api/bearings/iso-bearings.constants.js +30 -0
- package/lib/api/bearings/iso-bearings.d.ts +4 -0
- package/lib/api/bearings/iso-bearings.js +14 -0
- package/lib/api/color-space.d.ts +2 -0
- package/lib/api/color-space.js +5 -8
- package/lib/api/fasteners/ansi-fasteners.constants.d.ts +16 -0
- package/lib/api/fasteners/ansi-fasteners.constants.js +118 -0
- package/lib/api/fasteners/ansi-fasteners.d.ts +8 -0
- package/lib/api/fasteners/ansi-fasteners.js +64 -0
- package/lib/api/fasteners/fastener-types.d.ts +161 -0
- package/lib/api/fasteners/fastener-types.js +1 -0
- package/lib/api/fasteners/fasteners.constants.d.ts +5 -0
- package/lib/api/fasteners/fasteners.constants.js +5 -0
- package/lib/api/fasteners/fasteners.d.ts +2 -0
- package/lib/api/fasteners/fasteners.js +9 -0
- package/lib/api/fasteners/iso-fasteners.constants.d.ts +23 -0
- package/lib/api/fasteners/iso-fasteners.constants.js +110 -0
- package/lib/api/fasteners/iso-fasteners.d.ts +9 -0
- package/lib/api/fasteners/iso-fasteners.js +61 -0
- package/lib/api/gears/bevel-gears.d.ts +6 -0
- package/lib/api/gears/bevel-gears.js +69 -0
- package/lib/api/gears/gear-checks.d.ts +8 -0
- package/lib/api/gears/gear-checks.js +69 -0
- package/lib/api/gears/gear-pairs.d.ts +4 -0
- package/lib/api/gears/gear-pairs.js +140 -0
- package/lib/api/gears/gear-types.d.ts +425 -0
- package/lib/api/gears/gear-types.js +1 -0
- package/lib/api/gears/gears.constants.d.ts +19 -0
- package/lib/api/gears/gears.constants.js +19 -0
- package/lib/api/gears/gears.d.ts +10 -0
- package/lib/api/gears/gears.js +156 -0
- package/lib/api/gears/helical-gears.d.ts +5 -0
- package/lib/api/gears/helical-gears.js +33 -0
- package/lib/api/gears/involute-flank.d.ts +26 -0
- package/lib/api/gears/involute-flank.js +158 -0
- package/lib/api/gears/racks.d.ts +3 -0
- package/lib/api/gears/racks.js +64 -0
- package/lib/api/index.d.ts +10 -1
- package/lib/api/index.js +0 -1
- package/lib/api/inputs/base-inputs.d.ts +450 -3
- package/lib/api/inputs/base-inputs.js +12 -0
- package/lib/api/inputs/color-inputs.d.ts +14 -0
- package/lib/api/inputs/color-inputs.js +19 -0
- package/lib/api/inputs/engineering-inputs.d.ts +1539 -0
- package/lib/api/inputs/engineering-inputs.js +2181 -0
- package/lib/api/inputs/index.d.ts +2 -0
- package/lib/api/inputs/index.js +2 -0
- package/lib/api/inputs/io-inputs.d.ts +8 -1
- package/lib/api/inputs/io-inputs.js +4 -1
- package/lib/api/inputs/math-inputs.d.ts +61 -0
- package/lib/api/inputs/math-inputs.js +85 -0
- package/lib/api/inputs/mesh-inputs.d.ts +170 -0
- package/lib/api/inputs/mesh-inputs.js +206 -0
- package/lib/api/inputs/point-inputs.d.ts +4 -4
- package/lib/api/inputs/polyline-inputs.d.ts +144 -0
- package/lib/api/inputs/polyline-inputs.js +151 -0
- package/lib/api/inputs/recipes-inputs.d.ts +76 -0
- package/lib/api/inputs/recipes-inputs.js +74 -0
- package/lib/api/inputs/transforms-inputs.d.ts +34 -0
- package/lib/api/inputs/transforms-inputs.js +35 -0
- package/lib/api/keys/ansi-keys.constants.d.ts +3 -0
- package/lib/api/keys/ansi-keys.constants.js +16 -0
- package/lib/api/keys/ansi-keys.d.ts +3 -0
- package/lib/api/keys/ansi-keys.js +14 -0
- package/lib/api/keys/din-keys.constants.d.ts +3 -0
- package/lib/api/keys/din-keys.constants.js +14 -0
- package/lib/api/keys/din-keys.d.ts +3 -0
- package/lib/api/keys/din-keys.js +13 -0
- package/lib/api/keys/key-types.d.ts +17 -0
- package/lib/api/keys/key-types.js +1 -0
- package/lib/api/keys/keys.constants.d.ts +1 -0
- package/lib/api/keys/keys.constants.js +1 -0
- package/lib/api/knurls/ansi-knurls.constants.d.ts +4 -0
- package/lib/api/knurls/ansi-knurls.constants.js +8 -0
- package/lib/api/knurls/ansi-knurls.d.ts +3 -0
- package/lib/api/knurls/ansi-knurls.js +20 -0
- package/lib/api/knurls/din-knurls.constants.d.ts +2 -0
- package/lib/api/knurls/din-knurls.constants.js +2 -0
- package/lib/api/knurls/din-knurls.d.ts +3 -0
- package/lib/api/knurls/din-knurls.js +19 -0
- package/lib/api/knurls/knurl-types.d.ts +24 -0
- package/lib/api/knurls/knurl-types.js +1 -0
- package/lib/api/knurls/knurls.constants.d.ts +1 -0
- package/lib/api/knurls/knurls.constants.js +1 -0
- package/lib/api/knurls/knurls.d.ts +2 -0
- package/lib/api/knurls/knurls.js +9 -0
- package/lib/api/recipes/checks.d.ts +15 -0
- package/lib/api/recipes/checks.js +85 -0
- package/lib/api/recipes/limits.constants.d.ts +4 -0
- package/lib/api/recipes/limits.constants.js +4 -0
- package/lib/api/recipes/sources.d.ts +0 -13
- package/lib/api/recipes/sources.js +3 -15
- package/lib/api/recipes/surface-mesh.d.ts +0 -14
- package/lib/api/recipes/surface-mesh.js +8 -21
- package/lib/api/recipes/validate-brep.d.ts +2 -0
- package/lib/api/recipes/validate-brep.js +330 -0
- package/lib/api/recipes/validate.d.ts +0 -31
- package/lib/api/recipes/validate.js +7 -115
- package/lib/api/resolved-inputs/index.d.ts +80 -0
- package/lib/api/retaining-rings/ansi-retaining-rings.constants.d.ts +4 -0
- package/lib/api/retaining-rings/ansi-retaining-rings.constants.js +93 -0
- package/lib/api/retaining-rings/ansi-retaining-rings.d.ts +4 -0
- package/lib/api/retaining-rings/ansi-retaining-rings.js +20 -0
- package/lib/api/retaining-rings/din-retaining-rings.constants.d.ts +3 -0
- package/lib/api/retaining-rings/din-retaining-rings.constants.js +115 -0
- package/lib/api/retaining-rings/din-retaining-rings.d.ts +4 -0
- package/lib/api/retaining-rings/din-retaining-rings.js +20 -0
- package/lib/api/retaining-rings/retaining-ring-types.d.ts +30 -0
- package/lib/api/retaining-rings/retaining-ring-types.js +1 -0
- package/lib/api/retaining-rings/retaining-rings.constants.d.ts +1 -0
- package/lib/api/retaining-rings/retaining-rings.constants.js +1 -0
- package/lib/api/retaining-rings/retaining-rings.d.ts +2 -0
- package/lib/api/retaining-rings/retaining-rings.js +9 -0
- package/lib/api/services/base-bitbybit.d.ts +42 -0
- package/lib/api/services/base-bitbybit.js +43 -0
- package/lib/api/services/color.d.ts +35 -2
- package/lib/api/services/color.js +48 -12
- package/lib/api/services/engineering/engineering.d.ts +12 -0
- package/lib/api/services/engineering/engineering.js +13 -0
- package/lib/api/services/engineering/index.d.ts +2 -0
- package/lib/api/services/engineering/index.js +2 -0
- package/lib/api/services/engineering/mechanical/bearings-ansi.d.ts +40 -0
- package/lib/api/services/engineering/mechanical/bearings-ansi.js +47 -0
- package/lib/api/services/engineering/mechanical/bearings-iso.d.ts +39 -0
- package/lib/api/services/engineering/mechanical/bearings-iso.js +46 -0
- package/lib/api/services/engineering/mechanical/bearings.d.ts +14 -0
- package/lib/api/services/engineering/mechanical/bearings.js +15 -0
- package/lib/api/services/engineering/mechanical/fasteners-ansi.d.ts +109 -0
- package/lib/api/services/engineering/mechanical/fasteners-ansi.js +133 -0
- package/lib/api/services/engineering/mechanical/fasteners-iso.d.ts +123 -0
- package/lib/api/services/engineering/mechanical/fasteners-iso.js +151 -0
- package/lib/api/services/engineering/mechanical/fasteners.d.ts +13 -0
- package/lib/api/services/engineering/mechanical/fasteners.js +14 -0
- package/lib/api/services/engineering/mechanical/gears.d.ts +267 -0
- package/lib/api/services/engineering/mechanical/gears.js +318 -0
- package/lib/api/services/engineering/mechanical/index.d.ts +24 -0
- package/lib/api/services/engineering/mechanical/index.js +24 -0
- package/lib/api/services/engineering/mechanical/keys-ansi.d.ts +27 -0
- package/lib/api/services/engineering/mechanical/keys-ansi.js +32 -0
- package/lib/api/services/engineering/mechanical/keys-din.d.ts +26 -0
- package/lib/api/services/engineering/mechanical/keys-din.js +31 -0
- package/lib/api/services/engineering/mechanical/keys.d.ts +14 -0
- package/lib/api/services/engineering/mechanical/keys.js +15 -0
- package/lib/api/services/engineering/mechanical/knurls-ansi.d.ts +26 -0
- package/lib/api/services/engineering/mechanical/knurls-ansi.js +31 -0
- package/lib/api/services/engineering/mechanical/knurls-din.d.ts +26 -0
- package/lib/api/services/engineering/mechanical/knurls-din.js +31 -0
- package/lib/api/services/engineering/mechanical/knurls.d.ts +14 -0
- package/lib/api/services/engineering/mechanical/knurls.js +15 -0
- package/lib/api/services/engineering/mechanical/mechanical.d.ts +29 -0
- package/lib/api/services/engineering/mechanical/mechanical.js +30 -0
- package/lib/api/services/engineering/mechanical/retaining-rings-ansi.d.ts +43 -0
- package/lib/api/services/engineering/mechanical/retaining-rings-ansi.js +51 -0
- package/lib/api/services/engineering/mechanical/retaining-rings-din.d.ts +43 -0
- package/lib/api/services/engineering/mechanical/retaining-rings-din.js +51 -0
- package/lib/api/services/engineering/mechanical/retaining-rings.d.ts +13 -0
- package/lib/api/services/engineering/mechanical/retaining-rings.js +14 -0
- package/lib/api/services/engineering/mechanical/splines-ansi.d.ts +27 -0
- package/lib/api/services/engineering/mechanical/splines-ansi.js +32 -0
- package/lib/api/services/engineering/mechanical/splines-din.d.ts +26 -0
- package/lib/api/services/engineering/mechanical/splines-din.js +31 -0
- package/lib/api/services/engineering/mechanical/splines.d.ts +13 -0
- package/lib/api/services/engineering/mechanical/splines.js +14 -0
- package/lib/api/services/engineering/mechanical/springs.d.ts +27 -0
- package/lib/api/services/engineering/mechanical/springs.js +31 -0
- package/lib/api/services/engineering/mechanical/threads-ansi.d.ts +40 -0
- package/lib/api/services/engineering/mechanical/threads-ansi.js +48 -0
- package/lib/api/services/engineering/mechanical/threads-iso.d.ts +40 -0
- package/lib/api/services/engineering/mechanical/threads-iso.js +48 -0
- package/lib/api/services/engineering/mechanical/threads.d.ts +13 -0
- package/lib/api/services/engineering/mechanical/threads.js +14 -0
- package/lib/api/services/frame.js +3 -3
- package/lib/api/services/geometry-helper.js +8 -111
- package/lib/api/services/helpers/color/color-space.d.ts +2 -0
- package/lib/api/services/helpers/color/color-space.js +12 -0
- package/lib/api/services/helpers/{nurbs.d.ts → curves/nurbs.d.ts} +1 -1
- package/lib/api/services/helpers/{surface-triangulation.d.ts → curves/surface-triangulation.d.ts} +2 -2
- package/lib/api/services/helpers/{surface-triangulation.js → curves/surface-triangulation.js} +14 -8
- package/lib/api/services/helpers/{dxf → files/dxf}/dxf-generator.d.ts +2 -1
- package/lib/api/services/helpers/{dxf → files/dxf}/dxf-generator.js +19 -5
- package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +4 -0
- package/lib/api/services/helpers/files/dxf/dxf.constants.js +4 -0
- package/lib/api/services/helpers/{dxf → files/dxf}/dxf.d.ts +1 -1
- package/lib/api/services/helpers/{dxf → files/dxf}/dxf.js +2 -2
- package/lib/api/services/helpers/files/glb.constants.d.ts +11 -0
- package/lib/api/services/helpers/files/glb.constants.js +11 -0
- package/lib/api/services/helpers/files/glb.d.ts +1 -0
- package/lib/api/services/helpers/files/glb.js +69 -0
- package/lib/api/services/helpers/files/gzip.constants.d.ts +11 -0
- package/lib/api/services/helpers/files/gzip.constants.js +11 -0
- package/lib/api/services/helpers/files/gzip.d.ts +2 -0
- package/lib/api/services/helpers/files/gzip.js +52 -0
- package/lib/api/services/helpers/{inflate.constants.d.ts → files/inflate.constants.d.ts} +1 -0
- package/lib/api/services/helpers/{inflate.constants.js → files/inflate.constants.js} +1 -0
- package/lib/api/services/helpers/{inflate.d.ts → files/inflate.d.ts} +1 -1
- package/lib/api/services/helpers/{inflate.js → files/inflate.js} +5 -4
- package/lib/api/services/helpers/{zip.d.ts → files/zip.d.ts} +1 -1
- package/lib/api/services/helpers/geometry/arcs.d.ts +9 -0
- package/lib/api/services/helpers/{arcs.js → geometry/arcs.js} +7 -0
- package/lib/api/services/helpers/{frame-axes.d.ts → geometry/frame-axes.d.ts} +8 -5
- package/lib/api/services/helpers/{frame-axes.js → geometry/frame-axes.js} +21 -9
- package/lib/api/services/helpers/geometry/lengths.constants.d.ts +4 -0
- package/lib/api/services/helpers/geometry/lengths.constants.js +3 -0
- package/lib/api/services/helpers/geometry/lengths.d.ts +7 -0
- package/lib/api/services/helpers/geometry/lengths.js +20 -0
- package/lib/api/services/helpers/geometry/matrices.constants.d.ts +8 -0
- package/lib/api/services/helpers/geometry/matrices.constants.js +7 -0
- package/lib/api/services/helpers/geometry/matrices.d.ts +17 -0
- package/lib/api/services/helpers/{matrices.js → geometry/matrices.js} +28 -17
- package/lib/api/services/helpers/{paths.d.ts → geometry/paths.d.ts} +2 -1
- package/lib/api/services/helpers/{paths.js → geometry/paths.js} +36 -30
- package/lib/api/services/helpers/{polygons.d.ts → geometry/polygons.d.ts} +1 -1
- package/lib/api/services/helpers/geometry/polygons.js +111 -0
- package/lib/api/services/helpers/geometry/scalars.d.ts +9 -0
- package/lib/api/services/helpers/geometry/scalars.js +34 -0
- package/lib/api/services/helpers/{triangulation.js → geometry/triangulation.js} +11 -6
- package/lib/api/services/helpers/geometry/vector-grid.d.ts +12 -0
- package/lib/api/services/helpers/geometry/vector-grid.js +149 -0
- package/lib/api/services/helpers/{vectors.d.ts → geometry/vectors.d.ts} +8 -1
- package/lib/api/services/helpers/geometry/vectors.js +43 -0
- package/lib/api/services/helpers/helper-types.d.ts +57 -0
- package/lib/api/services/helpers/mesh/mesh-normals.d.ts +21 -0
- package/lib/api/services/helpers/{mesh-normals.js → mesh/mesh-normals.js} +54 -65
- package/lib/api/services/helpers/mesh/mesh-orientation.d.ts +24 -0
- package/lib/api/services/helpers/mesh/mesh-orientation.js +104 -0
- package/lib/api/services/helpers/{mesh-primitives.d.ts → mesh/mesh-primitives.d.ts} +1 -1
- package/lib/api/services/helpers/{mesh-primitives.js → mesh/mesh-primitives.js} +6 -5
- package/lib/api/services/helpers/mesh/mesh-proximity.constants.d.ts +7 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.constants.js +11 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.d.ts +11 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.js +382 -0
- package/lib/api/services/index.d.ts +3 -0
- package/lib/api/services/index.js +3 -0
- package/lib/api/services/io.d.ts +1 -1
- package/lib/api/services/io.js +1 -1
- package/lib/api/services/line.js +2 -3
- package/lib/api/services/math.d.ts +47 -0
- package/lib/api/services/math.js +77 -10
- package/lib/api/services/mesh.d.ts +174 -2
- package/lib/api/services/mesh.js +305 -7
- package/lib/api/services/point.js +4 -10
- package/lib/api/services/polyline-types.d.ts +6 -0
- package/lib/api/services/polyline-types.js +1 -0
- package/lib/api/services/polyline.d.ts +163 -1
- package/lib/api/services/polyline.js +270 -13
- package/lib/api/services/recipes.d.ts +80 -0
- package/lib/api/services/recipes.js +107 -0
- package/lib/api/services/transforms.d.ts +74 -2
- package/lib/api/services/transforms.js +100 -3
- package/lib/api/services/vector.d.ts +4 -3
- package/lib/api/services/vector.js +14 -14
- package/lib/api/splines/ansi-splines.constants.d.ts +9 -0
- package/lib/api/splines/ansi-splines.constants.js +9 -0
- package/lib/api/splines/ansi-splines.d.ts +3 -0
- package/lib/api/splines/ansi-splines.js +28 -0
- package/lib/api/splines/din-splines.constants.d.ts +12 -0
- package/lib/api/splines/din-splines.constants.js +12 -0
- package/lib/api/splines/din-splines.d.ts +3 -0
- package/lib/api/splines/din-splines.js +38 -0
- package/lib/api/splines/spline-types.d.ts +32 -0
- package/lib/api/splines/spline-types.js +1 -0
- package/lib/api/splines/splines.constants.d.ts +1 -0
- package/lib/api/splines/splines.constants.js +1 -0
- package/lib/api/springs/spring-types.d.ts +26 -0
- package/lib/api/springs/spring-types.js +1 -0
- package/lib/api/springs/springs.constants.d.ts +9 -0
- package/lib/api/springs/springs.constants.js +9 -0
- package/lib/api/springs/springs.d.ts +2 -0
- package/lib/api/springs/springs.js +50 -0
- package/lib/api/threads/ansi-threads.constants.d.ts +6 -0
- package/lib/api/threads/ansi-threads.constants.js +27 -0
- package/lib/api/threads/ansi-threads.d.ts +4 -0
- package/lib/api/threads/ansi-threads.js +50 -0
- package/lib/api/threads/iso-threads.constants.d.ts +5 -0
- package/lib/api/threads/iso-threads.constants.js +20 -0
- package/lib/api/threads/iso-threads.d.ts +4 -0
- package/lib/api/threads/iso-threads.js +32 -0
- package/lib/api/threads/thread-profile.constants.d.ts +3 -0
- package/lib/api/threads/thread-profile.constants.js +3 -0
- package/lib/api/threads/thread-types.d.ts +66 -0
- package/lib/api/threads/thread-types.js +1 -0
- package/package.json +1 -1
- package/lib/api/recipes/index.d.ts +0 -4
- package/lib/api/recipes/index.js +0 -3
- package/lib/api/services/helpers/arcs.d.ts +0 -6
- package/lib/api/services/helpers/matrices.constants.d.ts +0 -2
- package/lib/api/services/helpers/matrices.constants.js +0 -2
- package/lib/api/services/helpers/matrices.d.ts +0 -25
- package/lib/api/services/helpers/mesh-normals.d.ts +0 -11
- package/lib/api/services/helpers/polygons.js +0 -59
- package/lib/api/services/helpers/vectors.js +0 -17
- /package/lib/api/services/helpers/{nurbs.js → curves/nurbs.js} +0 -0
- /package/lib/api/services/helpers/{crc32.d.ts → files/crc32.d.ts} +0 -0
- /package/lib/api/services/helpers/{crc32.js → files/crc32.js} +0 -0
- /package/lib/api/services/helpers/{zip.constants.d.ts → files/zip.constants.d.ts} +0 -0
- /package/lib/api/services/helpers/{zip.constants.js → files/zip.constants.js} +0 -0
- /package/lib/api/services/helpers/{zip.js → files/zip.js} +0 -0
- /package/lib/api/services/helpers/{triangulation.d.ts → geometry/triangulation.d.ts} +0 -0
- /package/lib/api/services/helpers/{mesh-measures.d.ts → mesh/mesh-measures.d.ts} +0 -0
- /package/lib/api/services/helpers/{mesh-measures.js → mesh/mesh-measures.js} +0 -0
- /package/lib/api/services/helpers/{mesh-primitives.constants.d.ts → mesh/mesh-primitives.constants.d.ts} +0 -0
- /package/lib/api/services/helpers/{mesh-primitives.constants.js → mesh/mesh-primitives.constants.js} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as Inputs from "../inputs";
|
|
2
|
+
import type { FilletPlace, FlankPiece, GearOutline, GearPart, ToothCircles } from "./gear-types";
|
|
3
|
+
type Point2 = Inputs.Base.Point2;
|
|
4
|
+
export declare const angleOf: (point: Point2) => number;
|
|
5
|
+
export declare const involute: (angle: number) => number;
|
|
6
|
+
export declare class UpperFlank {
|
|
7
|
+
private readonly baseRadius;
|
|
8
|
+
readonly baseAngle: number;
|
|
9
|
+
constructor(baseRadius: number, halfToothAngle: number, pressureAngle: number);
|
|
10
|
+
pointAt(roll: number): Point2;
|
|
11
|
+
towardGapAt(roll: number): Point2;
|
|
12
|
+
rollAt(radius: number): number;
|
|
13
|
+
fitted(fromRoll: number, toRoll: number, tolerance: number, depth?: number): FlankPiece[];
|
|
14
|
+
private tangentAt;
|
|
15
|
+
private lengthAt;
|
|
16
|
+
private rollOfLength;
|
|
17
|
+
private fitError;
|
|
18
|
+
}
|
|
19
|
+
export declare const rootFilletPlace: (flank: UpperFlank, baseRadius: number, rootRadius: number, radius: number) => FilletPlace;
|
|
20
|
+
export declare const topRoundPlace: (flank: UpperFlank, baseRadius: number, topRadius: number, radius: number) => FilletPlace;
|
|
21
|
+
export declare const largestFitting: (wanted: number, fits: (radius: number) => boolean) => number;
|
|
22
|
+
export declare const filletArc: (place: FilletPlace, radius: number, part: GearPart) => FlankPiece;
|
|
23
|
+
export declare const reversedPiece: (piece: FlankPiece) => FlankPiece;
|
|
24
|
+
export declare const mappedPiece: (piece: FlankPiece, map: (point: Point2) => Point2) => FlankPiece;
|
|
25
|
+
export declare const toothedOutline: (upper: readonly FlankPiece[], circles: ToothCircles, teeth: number, centre: Point2, turn: number) => GearOutline;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { BEZIER_HANDLE, FILLET_STEPS, FIT_SAMPLES, MAX_FIT_DEPTH } from "./gears.constants";
|
|
2
|
+
import { pointOnCubic2 } from "../services/helpers/geometry/arcs";
|
|
3
|
+
import { add2, length2, polar2, rotated2, scale2, subtract2, unit2Of } from "../services/helpers/geometry/vectors";
|
|
4
|
+
const mirrored = (point) => [point[0], -point[1]];
|
|
5
|
+
export const angleOf = (point) => Math.atan2(point[1], point[0]);
|
|
6
|
+
const cubicAt = (piece, share) => pointOnCubic2(piece.from, piece.control1, piece.control2, piece.to, share);
|
|
7
|
+
export const involute = (angle) => Math.tan(angle) - angle;
|
|
8
|
+
export class UpperFlank {
|
|
9
|
+
constructor(baseRadius, halfToothAngle, pressureAngle) {
|
|
10
|
+
this.baseRadius = baseRadius;
|
|
11
|
+
this.baseAngle = halfToothAngle + involute(pressureAngle);
|
|
12
|
+
}
|
|
13
|
+
pointAt(roll) {
|
|
14
|
+
const radius = this.baseRadius;
|
|
15
|
+
return rotated2([radius * (Math.cos(roll) + roll * Math.sin(roll)), -radius * (Math.sin(roll) - roll * Math.cos(roll))], this.baseAngle);
|
|
16
|
+
}
|
|
17
|
+
towardGapAt(roll) {
|
|
18
|
+
return rotated2([Math.sin(roll), Math.cos(roll)], this.baseAngle);
|
|
19
|
+
}
|
|
20
|
+
rollAt(radius) {
|
|
21
|
+
return radius <= this.baseRadius ? 0 : Math.sqrt(Math.pow((radius / this.baseRadius), 2) - 1);
|
|
22
|
+
}
|
|
23
|
+
fitted(fromRoll, toRoll, tolerance, depth = 0) {
|
|
24
|
+
const startLength = this.lengthAt(fromRoll);
|
|
25
|
+
const span = this.lengthAt(toRoll) - startLength;
|
|
26
|
+
const from = this.pointAt(fromRoll);
|
|
27
|
+
const to = this.pointAt(toRoll);
|
|
28
|
+
const startTangent = this.tangentAt(fromRoll);
|
|
29
|
+
const endTangent = this.tangentAt(toRoll);
|
|
30
|
+
const handle = span * BEZIER_HANDLE;
|
|
31
|
+
const piece = {
|
|
32
|
+
kind: "cubic",
|
|
33
|
+
from,
|
|
34
|
+
control1: add2(from, scale2(startTangent, handle)),
|
|
35
|
+
control2: subtract2(to, scale2(endTangent, handle)),
|
|
36
|
+
to,
|
|
37
|
+
part: "flank",
|
|
38
|
+
};
|
|
39
|
+
if (depth >= MAX_FIT_DEPTH || this.fitError(piece, startLength, span) <= tolerance) {
|
|
40
|
+
return [piece];
|
|
41
|
+
}
|
|
42
|
+
const middleRoll = this.rollOfLength(startLength + span / 2);
|
|
43
|
+
return [...this.fitted(fromRoll, middleRoll, tolerance, depth + 1), ...this.fitted(middleRoll, toRoll, tolerance, depth + 1)];
|
|
44
|
+
}
|
|
45
|
+
tangentAt(roll) {
|
|
46
|
+
return rotated2([Math.cos(roll), -Math.sin(roll)], this.baseAngle);
|
|
47
|
+
}
|
|
48
|
+
lengthAt(roll) {
|
|
49
|
+
return this.baseRadius * roll * roll / 2;
|
|
50
|
+
}
|
|
51
|
+
rollOfLength(length) {
|
|
52
|
+
return Math.sqrt(2 * length / this.baseRadius);
|
|
53
|
+
}
|
|
54
|
+
fitError(piece, startLength, span) {
|
|
55
|
+
let worst = 0;
|
|
56
|
+
for (let sample = 1; sample < FIT_SAMPLES; sample++) {
|
|
57
|
+
const share = sample / FIT_SAMPLES;
|
|
58
|
+
const fitted = cubicAt(piece, share);
|
|
59
|
+
const exact = this.pointAt(this.rollOfLength(startLength + share * span));
|
|
60
|
+
worst = Math.max(worst, length2(subtract2(fitted, exact)));
|
|
61
|
+
}
|
|
62
|
+
return worst;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export const rootFilletPlace = (flank, baseRadius, rootRadius, radius) => {
|
|
66
|
+
const lineTouch = Math.sqrt(rootRadius * rootRadius + 2 * rootRadius * radius);
|
|
67
|
+
if (baseRadius > rootRadius && lineTouch <= baseRadius) {
|
|
68
|
+
const centre = polar2(rootRadius + radius, flank.baseAngle + Math.asin(radius / (rootRadius + radius)));
|
|
69
|
+
return { flankPoint: polar2(lineTouch, flank.baseAngle), circlePoint: polar2(rootRadius, angleOf(centre)), centre, onLine: true, roll: 0 };
|
|
70
|
+
}
|
|
71
|
+
const roll = (Math.sqrt(Math.pow((rootRadius + radius), 2) - baseRadius * baseRadius) - radius) / baseRadius;
|
|
72
|
+
const flankPoint = flank.pointAt(roll);
|
|
73
|
+
const toward = flank.towardGapAt(roll);
|
|
74
|
+
const centre = add2(flankPoint, scale2(toward, radius));
|
|
75
|
+
return { flankPoint, circlePoint: polar2(rootRadius, angleOf(centre)), centre, onLine: false, roll };
|
|
76
|
+
};
|
|
77
|
+
export const topRoundPlace = (flank, baseRadius, topRadius, radius) => {
|
|
78
|
+
const roll = (Math.sqrt(Math.pow((topRadius - radius), 2) - baseRadius * baseRadius) + radius) / baseRadius;
|
|
79
|
+
const flankPoint = flank.pointAt(roll);
|
|
80
|
+
const toward = flank.towardGapAt(roll);
|
|
81
|
+
const centre = subtract2(flankPoint, scale2(toward, radius));
|
|
82
|
+
return { flankPoint, circlePoint: polar2(topRadius, angleOf(centre)), centre, onLine: false, roll };
|
|
83
|
+
};
|
|
84
|
+
export const largestFitting = (wanted, fits) => {
|
|
85
|
+
if (fits(wanted)) {
|
|
86
|
+
return wanted;
|
|
87
|
+
}
|
|
88
|
+
let low = 0;
|
|
89
|
+
let high = wanted;
|
|
90
|
+
for (let step = 0; step < FILLET_STEPS; step++) {
|
|
91
|
+
const middle = (low + high) / 2;
|
|
92
|
+
if (fits(middle)) {
|
|
93
|
+
low = middle;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
high = middle;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return low;
|
|
100
|
+
};
|
|
101
|
+
export const filletArc = (place, radius, part) => {
|
|
102
|
+
const halfway = add2(subtract2(place.flankPoint, place.centre), subtract2(place.circlePoint, place.centre));
|
|
103
|
+
const through = add2(place.centre, scale2(unit2Of(halfway), radius));
|
|
104
|
+
return { kind: "arc", from: place.circlePoint, through, to: place.flankPoint, part };
|
|
105
|
+
};
|
|
106
|
+
export const reversedPiece = (piece) => {
|
|
107
|
+
switch (piece.kind) {
|
|
108
|
+
case "line":
|
|
109
|
+
return { kind: "line", from: piece.to, to: piece.from, part: piece.part };
|
|
110
|
+
case "arc":
|
|
111
|
+
return { kind: "arc", from: piece.to, through: piece.through, to: piece.from, part: piece.part };
|
|
112
|
+
default:
|
|
113
|
+
return { kind: "cubic", from: piece.to, control1: piece.control2, control2: piece.control1, to: piece.from, part: piece.part };
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
export const mappedPiece = (piece, map) => {
|
|
117
|
+
switch (piece.kind) {
|
|
118
|
+
case "line":
|
|
119
|
+
return { kind: "line", from: map(piece.from), to: map(piece.to), part: piece.part };
|
|
120
|
+
case "arc":
|
|
121
|
+
return { kind: "arc", from: map(piece.from), through: map(piece.through), to: map(piece.to), part: piece.part };
|
|
122
|
+
default:
|
|
123
|
+
return { kind: "cubic", from: map(piece.from), control1: map(piece.control1), control2: map(piece.control2), to: map(piece.to), part: piece.part };
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const moveOf = (piece) => {
|
|
127
|
+
switch (piece.kind) {
|
|
128
|
+
case "line":
|
|
129
|
+
return { kind: "line", to: piece.to, part: piece.part };
|
|
130
|
+
case "arc":
|
|
131
|
+
return { kind: "arc", through: piece.through, to: piece.to, part: piece.part };
|
|
132
|
+
default:
|
|
133
|
+
return { kind: "cubic", control1: piece.control1, control2: piece.control2, to: piece.to, part: piece.part };
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export const toothedOutline = (upper, circles, teeth, centre, turn) => {
|
|
137
|
+
const lowerOutward = upper.map(piece => mappedPiece(piece, mirrored));
|
|
138
|
+
const upperInward = [...upper].reverse().map(reversedPiece);
|
|
139
|
+
const tooth = [
|
|
140
|
+
...lowerOutward,
|
|
141
|
+
{ kind: "arc", from: lowerOutward[lowerOutward.length - 1].to, through: [circles.top, 0], to: upperInward[0].from, part: circles.topPart },
|
|
142
|
+
...upperInward,
|
|
143
|
+
];
|
|
144
|
+
const pitch = 2 * Math.PI / teeth;
|
|
145
|
+
const placed = (point, toothIndex) => {
|
|
146
|
+
return add2(rotated2(point, turn + toothIndex * pitch), centre);
|
|
147
|
+
};
|
|
148
|
+
const firstPoint = tooth[0].from;
|
|
149
|
+
const gapMiddle = polar2(circles.gap, pitch / 2);
|
|
150
|
+
const start = placed(firstPoint, 0);
|
|
151
|
+
const moves = [];
|
|
152
|
+
for (let index = 0; index < teeth; index++) {
|
|
153
|
+
tooth.forEach(piece => moves.push(moveOf(mappedPiece(piece, point => placed(point, index)))));
|
|
154
|
+
const isLast = index === teeth - 1;
|
|
155
|
+
moves.push({ kind: "arc", through: placed(gapMiddle, index), to: isLast ? start : placed(firstPoint, index + 1), part: circles.gapPart });
|
|
156
|
+
}
|
|
157
|
+
return { start, moves };
|
|
158
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { InputError } from "../kernel-calls/errors";
|
|
2
|
+
import { FILLET_GAP_SHARE, SHARP_FILLET } from "./gears.constants";
|
|
3
|
+
import { add2, scale2, subtract2, unit2Of } from "../services/helpers/geometry/vectors";
|
|
4
|
+
import { checkedRack, checkedThickness } from "./gear-checks";
|
|
5
|
+
import { radiansOf } from "../services/helpers/geometry/scalars";
|
|
6
|
+
export function rackSizes(spec) {
|
|
7
|
+
checkedRack(spec);
|
|
8
|
+
const pitch = Math.PI * spec.module;
|
|
9
|
+
checkedThickness(pitch / 2, spec.backlash);
|
|
10
|
+
return { pitch, length: pitch * spec.teeth, tipHeight: spec.module * spec.addendum, rootDepth: spec.module * spec.dedendum, toothThickness: pitch / 2 - spec.backlash };
|
|
11
|
+
}
|
|
12
|
+
export function rackOutline(spec) {
|
|
13
|
+
const sizes = rackSizes(spec);
|
|
14
|
+
const alpha = radiansOf(spec.pressureAngle);
|
|
15
|
+
const half = sizes.toothThickness / 2;
|
|
16
|
+
const tipHalf = half - sizes.tipHeight * Math.tan(alpha);
|
|
17
|
+
const footHalf = half + sizes.rootDepth * Math.tan(alpha);
|
|
18
|
+
if (!(tipHalf > 0)) {
|
|
19
|
+
throw new InputError("The teeth come to a point below their tips: give a smaller `addendum` or `pressureAngle`, or less `backlash`.", "addendum");
|
|
20
|
+
}
|
|
21
|
+
const gapBottom = sizes.pitch - 2 * footHalf;
|
|
22
|
+
if (!(gapBottom > 0)) {
|
|
23
|
+
throw new InputError("The gaps close before their bottoms: give a smaller `dedendum` or `pressureAngle`.", "dedendum");
|
|
24
|
+
}
|
|
25
|
+
const corner = Math.PI / 2 + alpha;
|
|
26
|
+
const wanted = spec.rootFillet * spec.module / Math.tan(corner / 2);
|
|
27
|
+
const tangent = Math.min(wanted, gapBottom / 2 * (1 - FILLET_GAP_SHARE));
|
|
28
|
+
const radius = tangent * Math.tan(corner / 2);
|
|
29
|
+
const up = [-Math.sin(alpha), Math.cos(alpha)];
|
|
30
|
+
const fillet = (foot, along, flank) => {
|
|
31
|
+
const bisector = unit2Of(add2(along, flank));
|
|
32
|
+
const centre = add2(foot, scale2(bisector, radius / Math.sin(corner / 2)));
|
|
33
|
+
return { from: add2(foot, scale2(along, tangent)), through: subtract2(centre, scale2(bisector, radius)), to: add2(foot, scale2(flank, tangent)) };
|
|
34
|
+
};
|
|
35
|
+
const bottom = -sizes.rootDepth;
|
|
36
|
+
const back = -spec.height;
|
|
37
|
+
const left = -sizes.pitch / 2;
|
|
38
|
+
const right = left + sizes.length;
|
|
39
|
+
const moves = [
|
|
40
|
+
{ kind: "line", to: [right, back], part: "back" },
|
|
41
|
+
{ kind: "line", to: [right, bottom], part: "side" },
|
|
42
|
+
];
|
|
43
|
+
const rounded = radius >= SHARP_FILLET * spec.module;
|
|
44
|
+
for (let tooth = spec.teeth - 1; tooth >= 0; tooth--) {
|
|
45
|
+
const centre = tooth * sizes.pitch;
|
|
46
|
+
const rightFoot = [centre + footHalf, bottom];
|
|
47
|
+
const leftFoot = [centre - footHalf, bottom];
|
|
48
|
+
const rightRound = fillet(rightFoot, [1, 0], up);
|
|
49
|
+
const leftRound = fillet(leftFoot, [-1, 0], [-up[0], up[1]]);
|
|
50
|
+
moves.push({ kind: "line", to: rounded ? rightRound.from : rightFoot, part: "root" });
|
|
51
|
+
if (rounded) {
|
|
52
|
+
moves.push({ kind: "arc", through: rightRound.through, to: rightRound.to, part: "root" });
|
|
53
|
+
}
|
|
54
|
+
moves.push({ kind: "line", to: [centre + tipHalf, sizes.tipHeight], part: "flank" });
|
|
55
|
+
moves.push({ kind: "line", to: [centre - tipHalf, sizes.tipHeight], part: "tip" });
|
|
56
|
+
moves.push({ kind: "line", to: rounded ? leftRound.to : leftFoot, part: "flank" });
|
|
57
|
+
if (rounded) {
|
|
58
|
+
moves.push({ kind: "arc", through: leftRound.through, to: leftRound.from, part: "root" });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
moves.push({ kind: "line", to: [left, bottom], part: "root" });
|
|
62
|
+
moves.push({ kind: "line", to: [left, back], part: "side" });
|
|
63
|
+
return { start: [left, back], moves };
|
|
64
|
+
}
|
package/lib/api/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export * from "./services";
|
|
2
2
|
export * from "./kernel-calls";
|
|
3
|
-
export
|
|
3
|
+
export type { RecipeIssue, RecipeSource, RecipeSurfaceMesh } from "./recipes/recipe-types";
|
|
4
4
|
export * from "./color-space";
|
|
5
|
+
export type { AnsiSplinePitch, InvoluteSplineSizes } from "./splines/spline-types";
|
|
6
|
+
export type { KnurlPattern, KnurlSizes } from "./knurls/knurl-types";
|
|
7
|
+
export type { BevelGearSizes, GearMove, GearPairSizes, GearPart, GearSizes, HelicalGearSizes, InternalGearPairSizes, PlanetarySet, RackMove, RackPart, RackSizes, SpurGearSpec } from "./gears/gear-types";
|
|
8
|
+
export type { AnsiThreadSeries, AnsiThreadSize, AnsiThreadSizes, IsoThreadSize, IsoThreadSizes, ThreadSizes } from "./threads/thread-types";
|
|
9
|
+
export type { AnsiSetScrewPoint, AnsiWasherSeries, ChamferedWasherSizes, ClearanceFit, HexBoltSizes, HexNutSizes, IsoSetScrewPoint, SetScrewSizes, SocketHeadCapScrewSizes, WasherSizes } from "./fasteners/fastener-types";
|
|
10
|
+
export type { AnsiBallBearingDesignation, BallBearingSizes, IsoBallBearingDesignation } from "./bearings/bearing-types";
|
|
11
|
+
export type { ParallelKeySizes } from "./keys/key-types";
|
|
12
|
+
export type { RetainingRingKind, RetainingRingSizes } from "./retaining-rings/retaining-ring-types";
|
|
13
|
+
export type { CompressionSpringPath } from "./springs/spring-types";
|
|
5
14
|
export * from "./GlobalCDNProvider";
|
|
6
15
|
export * as Inputs from "./inputs";
|
|
7
16
|
export * as Resolved from "./resolved-inputs";
|