@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.
Files changed (312) hide show
  1. package/lib/api/GlobalCDNProvider.js +1 -1
  2. package/lib/api/bearings/ansi-bearings.constants.d.ts +2 -0
  3. package/lib/api/bearings/ansi-bearings.constants.js +26 -0
  4. package/lib/api/bearings/ansi-bearings.d.ts +4 -0
  5. package/lib/api/bearings/ansi-bearings.js +14 -0
  6. package/lib/api/bearings/bearing-types.d.ts +25 -0
  7. package/lib/api/bearings/bearing-types.js +1 -0
  8. package/lib/api/bearings/bearings.constants.d.ts +1 -0
  9. package/lib/api/bearings/bearings.constants.js +1 -0
  10. package/lib/api/bearings/iso-bearings.constants.d.ts +2 -0
  11. package/lib/api/bearings/iso-bearings.constants.js +30 -0
  12. package/lib/api/bearings/iso-bearings.d.ts +4 -0
  13. package/lib/api/bearings/iso-bearings.js +14 -0
  14. package/lib/api/color-space.d.ts +2 -0
  15. package/lib/api/color-space.js +5 -8
  16. package/lib/api/fasteners/ansi-fasteners.constants.d.ts +16 -0
  17. package/lib/api/fasteners/ansi-fasteners.constants.js +118 -0
  18. package/lib/api/fasteners/ansi-fasteners.d.ts +8 -0
  19. package/lib/api/fasteners/ansi-fasteners.js +64 -0
  20. package/lib/api/fasteners/fastener-types.d.ts +161 -0
  21. package/lib/api/fasteners/fastener-types.js +1 -0
  22. package/lib/api/fasteners/fasteners.constants.d.ts +5 -0
  23. package/lib/api/fasteners/fasteners.constants.js +5 -0
  24. package/lib/api/fasteners/fasteners.d.ts +2 -0
  25. package/lib/api/fasteners/fasteners.js +9 -0
  26. package/lib/api/fasteners/iso-fasteners.constants.d.ts +23 -0
  27. package/lib/api/fasteners/iso-fasteners.constants.js +110 -0
  28. package/lib/api/fasteners/iso-fasteners.d.ts +9 -0
  29. package/lib/api/fasteners/iso-fasteners.js +61 -0
  30. package/lib/api/gears/bevel-gears.d.ts +6 -0
  31. package/lib/api/gears/bevel-gears.js +69 -0
  32. package/lib/api/gears/gear-checks.d.ts +8 -0
  33. package/lib/api/gears/gear-checks.js +69 -0
  34. package/lib/api/gears/gear-pairs.d.ts +4 -0
  35. package/lib/api/gears/gear-pairs.js +140 -0
  36. package/lib/api/gears/gear-types.d.ts +425 -0
  37. package/lib/api/gears/gear-types.js +1 -0
  38. package/lib/api/gears/gears.constants.d.ts +19 -0
  39. package/lib/api/gears/gears.constants.js +19 -0
  40. package/lib/api/gears/gears.d.ts +10 -0
  41. package/lib/api/gears/gears.js +156 -0
  42. package/lib/api/gears/helical-gears.d.ts +5 -0
  43. package/lib/api/gears/helical-gears.js +33 -0
  44. package/lib/api/gears/involute-flank.d.ts +26 -0
  45. package/lib/api/gears/involute-flank.js +158 -0
  46. package/lib/api/gears/racks.d.ts +3 -0
  47. package/lib/api/gears/racks.js +64 -0
  48. package/lib/api/index.d.ts +10 -1
  49. package/lib/api/index.js +0 -1
  50. package/lib/api/inputs/base-inputs.d.ts +450 -3
  51. package/lib/api/inputs/base-inputs.js +12 -0
  52. package/lib/api/inputs/color-inputs.d.ts +14 -0
  53. package/lib/api/inputs/color-inputs.js +19 -0
  54. package/lib/api/inputs/engineering-inputs.d.ts +1539 -0
  55. package/lib/api/inputs/engineering-inputs.js +2181 -0
  56. package/lib/api/inputs/index.d.ts +2 -0
  57. package/lib/api/inputs/index.js +2 -0
  58. package/lib/api/inputs/io-inputs.d.ts +8 -1
  59. package/lib/api/inputs/io-inputs.js +4 -1
  60. package/lib/api/inputs/math-inputs.d.ts +61 -0
  61. package/lib/api/inputs/math-inputs.js +85 -0
  62. package/lib/api/inputs/mesh-inputs.d.ts +170 -0
  63. package/lib/api/inputs/mesh-inputs.js +206 -0
  64. package/lib/api/inputs/point-inputs.d.ts +4 -4
  65. package/lib/api/inputs/polyline-inputs.d.ts +144 -0
  66. package/lib/api/inputs/polyline-inputs.js +151 -0
  67. package/lib/api/inputs/recipes-inputs.d.ts +76 -0
  68. package/lib/api/inputs/recipes-inputs.js +74 -0
  69. package/lib/api/inputs/transforms-inputs.d.ts +34 -0
  70. package/lib/api/inputs/transforms-inputs.js +35 -0
  71. package/lib/api/keys/ansi-keys.constants.d.ts +3 -0
  72. package/lib/api/keys/ansi-keys.constants.js +16 -0
  73. package/lib/api/keys/ansi-keys.d.ts +3 -0
  74. package/lib/api/keys/ansi-keys.js +14 -0
  75. package/lib/api/keys/din-keys.constants.d.ts +3 -0
  76. package/lib/api/keys/din-keys.constants.js +14 -0
  77. package/lib/api/keys/din-keys.d.ts +3 -0
  78. package/lib/api/keys/din-keys.js +13 -0
  79. package/lib/api/keys/key-types.d.ts +17 -0
  80. package/lib/api/keys/key-types.js +1 -0
  81. package/lib/api/keys/keys.constants.d.ts +1 -0
  82. package/lib/api/keys/keys.constants.js +1 -0
  83. package/lib/api/knurls/ansi-knurls.constants.d.ts +4 -0
  84. package/lib/api/knurls/ansi-knurls.constants.js +8 -0
  85. package/lib/api/knurls/ansi-knurls.d.ts +3 -0
  86. package/lib/api/knurls/ansi-knurls.js +20 -0
  87. package/lib/api/knurls/din-knurls.constants.d.ts +2 -0
  88. package/lib/api/knurls/din-knurls.constants.js +2 -0
  89. package/lib/api/knurls/din-knurls.d.ts +3 -0
  90. package/lib/api/knurls/din-knurls.js +19 -0
  91. package/lib/api/knurls/knurl-types.d.ts +24 -0
  92. package/lib/api/knurls/knurl-types.js +1 -0
  93. package/lib/api/knurls/knurls.constants.d.ts +1 -0
  94. package/lib/api/knurls/knurls.constants.js +1 -0
  95. package/lib/api/knurls/knurls.d.ts +2 -0
  96. package/lib/api/knurls/knurls.js +9 -0
  97. package/lib/api/recipes/checks.d.ts +15 -0
  98. package/lib/api/recipes/checks.js +85 -0
  99. package/lib/api/recipes/limits.constants.d.ts +4 -0
  100. package/lib/api/recipes/limits.constants.js +4 -0
  101. package/lib/api/recipes/sources.d.ts +0 -13
  102. package/lib/api/recipes/sources.js +3 -15
  103. package/lib/api/recipes/surface-mesh.d.ts +0 -14
  104. package/lib/api/recipes/surface-mesh.js +8 -21
  105. package/lib/api/recipes/validate-brep.d.ts +2 -0
  106. package/lib/api/recipes/validate-brep.js +330 -0
  107. package/lib/api/recipes/validate.d.ts +0 -31
  108. package/lib/api/recipes/validate.js +7 -115
  109. package/lib/api/resolved-inputs/index.d.ts +80 -0
  110. package/lib/api/retaining-rings/ansi-retaining-rings.constants.d.ts +4 -0
  111. package/lib/api/retaining-rings/ansi-retaining-rings.constants.js +93 -0
  112. package/lib/api/retaining-rings/ansi-retaining-rings.d.ts +4 -0
  113. package/lib/api/retaining-rings/ansi-retaining-rings.js +20 -0
  114. package/lib/api/retaining-rings/din-retaining-rings.constants.d.ts +3 -0
  115. package/lib/api/retaining-rings/din-retaining-rings.constants.js +115 -0
  116. package/lib/api/retaining-rings/din-retaining-rings.d.ts +4 -0
  117. package/lib/api/retaining-rings/din-retaining-rings.js +20 -0
  118. package/lib/api/retaining-rings/retaining-ring-types.d.ts +30 -0
  119. package/lib/api/retaining-rings/retaining-ring-types.js +1 -0
  120. package/lib/api/retaining-rings/retaining-rings.constants.d.ts +1 -0
  121. package/lib/api/retaining-rings/retaining-rings.constants.js +1 -0
  122. package/lib/api/retaining-rings/retaining-rings.d.ts +2 -0
  123. package/lib/api/retaining-rings/retaining-rings.js +9 -0
  124. package/lib/api/services/base-bitbybit.d.ts +42 -0
  125. package/lib/api/services/base-bitbybit.js +43 -0
  126. package/lib/api/services/color.d.ts +35 -2
  127. package/lib/api/services/color.js +48 -12
  128. package/lib/api/services/engineering/engineering.d.ts +12 -0
  129. package/lib/api/services/engineering/engineering.js +13 -0
  130. package/lib/api/services/engineering/index.d.ts +2 -0
  131. package/lib/api/services/engineering/index.js +2 -0
  132. package/lib/api/services/engineering/mechanical/bearings-ansi.d.ts +40 -0
  133. package/lib/api/services/engineering/mechanical/bearings-ansi.js +47 -0
  134. package/lib/api/services/engineering/mechanical/bearings-iso.d.ts +39 -0
  135. package/lib/api/services/engineering/mechanical/bearings-iso.js +46 -0
  136. package/lib/api/services/engineering/mechanical/bearings.d.ts +14 -0
  137. package/lib/api/services/engineering/mechanical/bearings.js +15 -0
  138. package/lib/api/services/engineering/mechanical/fasteners-ansi.d.ts +109 -0
  139. package/lib/api/services/engineering/mechanical/fasteners-ansi.js +133 -0
  140. package/lib/api/services/engineering/mechanical/fasteners-iso.d.ts +123 -0
  141. package/lib/api/services/engineering/mechanical/fasteners-iso.js +151 -0
  142. package/lib/api/services/engineering/mechanical/fasteners.d.ts +13 -0
  143. package/lib/api/services/engineering/mechanical/fasteners.js +14 -0
  144. package/lib/api/services/engineering/mechanical/gears.d.ts +267 -0
  145. package/lib/api/services/engineering/mechanical/gears.js +318 -0
  146. package/lib/api/services/engineering/mechanical/index.d.ts +24 -0
  147. package/lib/api/services/engineering/mechanical/index.js +24 -0
  148. package/lib/api/services/engineering/mechanical/keys-ansi.d.ts +27 -0
  149. package/lib/api/services/engineering/mechanical/keys-ansi.js +32 -0
  150. package/lib/api/services/engineering/mechanical/keys-din.d.ts +26 -0
  151. package/lib/api/services/engineering/mechanical/keys-din.js +31 -0
  152. package/lib/api/services/engineering/mechanical/keys.d.ts +14 -0
  153. package/lib/api/services/engineering/mechanical/keys.js +15 -0
  154. package/lib/api/services/engineering/mechanical/knurls-ansi.d.ts +26 -0
  155. package/lib/api/services/engineering/mechanical/knurls-ansi.js +31 -0
  156. package/lib/api/services/engineering/mechanical/knurls-din.d.ts +26 -0
  157. package/lib/api/services/engineering/mechanical/knurls-din.js +31 -0
  158. package/lib/api/services/engineering/mechanical/knurls.d.ts +14 -0
  159. package/lib/api/services/engineering/mechanical/knurls.js +15 -0
  160. package/lib/api/services/engineering/mechanical/mechanical.d.ts +29 -0
  161. package/lib/api/services/engineering/mechanical/mechanical.js +30 -0
  162. package/lib/api/services/engineering/mechanical/retaining-rings-ansi.d.ts +43 -0
  163. package/lib/api/services/engineering/mechanical/retaining-rings-ansi.js +51 -0
  164. package/lib/api/services/engineering/mechanical/retaining-rings-din.d.ts +43 -0
  165. package/lib/api/services/engineering/mechanical/retaining-rings-din.js +51 -0
  166. package/lib/api/services/engineering/mechanical/retaining-rings.d.ts +13 -0
  167. package/lib/api/services/engineering/mechanical/retaining-rings.js +14 -0
  168. package/lib/api/services/engineering/mechanical/splines-ansi.d.ts +27 -0
  169. package/lib/api/services/engineering/mechanical/splines-ansi.js +32 -0
  170. package/lib/api/services/engineering/mechanical/splines-din.d.ts +26 -0
  171. package/lib/api/services/engineering/mechanical/splines-din.js +31 -0
  172. package/lib/api/services/engineering/mechanical/splines.d.ts +13 -0
  173. package/lib/api/services/engineering/mechanical/splines.js +14 -0
  174. package/lib/api/services/engineering/mechanical/springs.d.ts +27 -0
  175. package/lib/api/services/engineering/mechanical/springs.js +31 -0
  176. package/lib/api/services/engineering/mechanical/threads-ansi.d.ts +40 -0
  177. package/lib/api/services/engineering/mechanical/threads-ansi.js +48 -0
  178. package/lib/api/services/engineering/mechanical/threads-iso.d.ts +40 -0
  179. package/lib/api/services/engineering/mechanical/threads-iso.js +48 -0
  180. package/lib/api/services/engineering/mechanical/threads.d.ts +13 -0
  181. package/lib/api/services/engineering/mechanical/threads.js +14 -0
  182. package/lib/api/services/frame.js +3 -3
  183. package/lib/api/services/geometry-helper.js +8 -111
  184. package/lib/api/services/helpers/color/color-space.d.ts +2 -0
  185. package/lib/api/services/helpers/color/color-space.js +12 -0
  186. package/lib/api/services/helpers/{nurbs.d.ts → curves/nurbs.d.ts} +1 -1
  187. package/lib/api/services/helpers/{surface-triangulation.d.ts → curves/surface-triangulation.d.ts} +2 -2
  188. package/lib/api/services/helpers/{surface-triangulation.js → curves/surface-triangulation.js} +14 -8
  189. package/lib/api/services/helpers/{dxf → files/dxf}/dxf-generator.d.ts +2 -1
  190. package/lib/api/services/helpers/{dxf → files/dxf}/dxf-generator.js +19 -5
  191. package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +4 -0
  192. package/lib/api/services/helpers/files/dxf/dxf.constants.js +4 -0
  193. package/lib/api/services/helpers/{dxf → files/dxf}/dxf.d.ts +1 -1
  194. package/lib/api/services/helpers/{dxf → files/dxf}/dxf.js +2 -2
  195. package/lib/api/services/helpers/files/glb.constants.d.ts +11 -0
  196. package/lib/api/services/helpers/files/glb.constants.js +11 -0
  197. package/lib/api/services/helpers/files/glb.d.ts +1 -0
  198. package/lib/api/services/helpers/files/glb.js +69 -0
  199. package/lib/api/services/helpers/files/gzip.constants.d.ts +11 -0
  200. package/lib/api/services/helpers/files/gzip.constants.js +11 -0
  201. package/lib/api/services/helpers/files/gzip.d.ts +2 -0
  202. package/lib/api/services/helpers/files/gzip.js +52 -0
  203. package/lib/api/services/helpers/{inflate.constants.d.ts → files/inflate.constants.d.ts} +1 -0
  204. package/lib/api/services/helpers/{inflate.constants.js → files/inflate.constants.js} +1 -0
  205. package/lib/api/services/helpers/{inflate.d.ts → files/inflate.d.ts} +1 -1
  206. package/lib/api/services/helpers/{inflate.js → files/inflate.js} +5 -4
  207. package/lib/api/services/helpers/{zip.d.ts → files/zip.d.ts} +1 -1
  208. package/lib/api/services/helpers/geometry/arcs.d.ts +9 -0
  209. package/lib/api/services/helpers/{arcs.js → geometry/arcs.js} +7 -0
  210. package/lib/api/services/helpers/{frame-axes.d.ts → geometry/frame-axes.d.ts} +8 -5
  211. package/lib/api/services/helpers/{frame-axes.js → geometry/frame-axes.js} +21 -9
  212. package/lib/api/services/helpers/geometry/lengths.constants.d.ts +4 -0
  213. package/lib/api/services/helpers/geometry/lengths.constants.js +3 -0
  214. package/lib/api/services/helpers/geometry/lengths.d.ts +7 -0
  215. package/lib/api/services/helpers/geometry/lengths.js +20 -0
  216. package/lib/api/services/helpers/geometry/matrices.constants.d.ts +8 -0
  217. package/lib/api/services/helpers/geometry/matrices.constants.js +7 -0
  218. package/lib/api/services/helpers/geometry/matrices.d.ts +17 -0
  219. package/lib/api/services/helpers/{matrices.js → geometry/matrices.js} +28 -17
  220. package/lib/api/services/helpers/{paths.d.ts → geometry/paths.d.ts} +2 -1
  221. package/lib/api/services/helpers/{paths.js → geometry/paths.js} +36 -30
  222. package/lib/api/services/helpers/{polygons.d.ts → geometry/polygons.d.ts} +1 -1
  223. package/lib/api/services/helpers/geometry/polygons.js +111 -0
  224. package/lib/api/services/helpers/geometry/scalars.d.ts +9 -0
  225. package/lib/api/services/helpers/geometry/scalars.js +34 -0
  226. package/lib/api/services/helpers/{triangulation.js → geometry/triangulation.js} +11 -6
  227. package/lib/api/services/helpers/geometry/vector-grid.d.ts +12 -0
  228. package/lib/api/services/helpers/geometry/vector-grid.js +149 -0
  229. package/lib/api/services/helpers/{vectors.d.ts → geometry/vectors.d.ts} +8 -1
  230. package/lib/api/services/helpers/geometry/vectors.js +43 -0
  231. package/lib/api/services/helpers/helper-types.d.ts +57 -0
  232. package/lib/api/services/helpers/mesh/mesh-normals.d.ts +21 -0
  233. package/lib/api/services/helpers/{mesh-normals.js → mesh/mesh-normals.js} +54 -65
  234. package/lib/api/services/helpers/mesh/mesh-orientation.d.ts +24 -0
  235. package/lib/api/services/helpers/mesh/mesh-orientation.js +104 -0
  236. package/lib/api/services/helpers/{mesh-primitives.d.ts → mesh/mesh-primitives.d.ts} +1 -1
  237. package/lib/api/services/helpers/{mesh-primitives.js → mesh/mesh-primitives.js} +6 -5
  238. package/lib/api/services/helpers/mesh/mesh-proximity.constants.d.ts +7 -0
  239. package/lib/api/services/helpers/mesh/mesh-proximity.constants.js +11 -0
  240. package/lib/api/services/helpers/mesh/mesh-proximity.d.ts +11 -0
  241. package/lib/api/services/helpers/mesh/mesh-proximity.js +382 -0
  242. package/lib/api/services/index.d.ts +3 -0
  243. package/lib/api/services/index.js +3 -0
  244. package/lib/api/services/io.d.ts +1 -1
  245. package/lib/api/services/io.js +1 -1
  246. package/lib/api/services/line.js +2 -3
  247. package/lib/api/services/math.d.ts +47 -0
  248. package/lib/api/services/math.js +77 -10
  249. package/lib/api/services/mesh.d.ts +174 -2
  250. package/lib/api/services/mesh.js +305 -7
  251. package/lib/api/services/point.js +4 -10
  252. package/lib/api/services/polyline-types.d.ts +6 -0
  253. package/lib/api/services/polyline-types.js +1 -0
  254. package/lib/api/services/polyline.d.ts +163 -1
  255. package/lib/api/services/polyline.js +270 -13
  256. package/lib/api/services/recipes.d.ts +80 -0
  257. package/lib/api/services/recipes.js +107 -0
  258. package/lib/api/services/transforms.d.ts +74 -2
  259. package/lib/api/services/transforms.js +100 -3
  260. package/lib/api/services/vector.d.ts +4 -3
  261. package/lib/api/services/vector.js +14 -14
  262. package/lib/api/splines/ansi-splines.constants.d.ts +9 -0
  263. package/lib/api/splines/ansi-splines.constants.js +9 -0
  264. package/lib/api/splines/ansi-splines.d.ts +3 -0
  265. package/lib/api/splines/ansi-splines.js +28 -0
  266. package/lib/api/splines/din-splines.constants.d.ts +12 -0
  267. package/lib/api/splines/din-splines.constants.js +12 -0
  268. package/lib/api/splines/din-splines.d.ts +3 -0
  269. package/lib/api/splines/din-splines.js +38 -0
  270. package/lib/api/splines/spline-types.d.ts +32 -0
  271. package/lib/api/splines/spline-types.js +1 -0
  272. package/lib/api/splines/splines.constants.d.ts +1 -0
  273. package/lib/api/splines/splines.constants.js +1 -0
  274. package/lib/api/springs/spring-types.d.ts +26 -0
  275. package/lib/api/springs/spring-types.js +1 -0
  276. package/lib/api/springs/springs.constants.d.ts +9 -0
  277. package/lib/api/springs/springs.constants.js +9 -0
  278. package/lib/api/springs/springs.d.ts +2 -0
  279. package/lib/api/springs/springs.js +50 -0
  280. package/lib/api/threads/ansi-threads.constants.d.ts +6 -0
  281. package/lib/api/threads/ansi-threads.constants.js +27 -0
  282. package/lib/api/threads/ansi-threads.d.ts +4 -0
  283. package/lib/api/threads/ansi-threads.js +50 -0
  284. package/lib/api/threads/iso-threads.constants.d.ts +5 -0
  285. package/lib/api/threads/iso-threads.constants.js +20 -0
  286. package/lib/api/threads/iso-threads.d.ts +4 -0
  287. package/lib/api/threads/iso-threads.js +32 -0
  288. package/lib/api/threads/thread-profile.constants.d.ts +3 -0
  289. package/lib/api/threads/thread-profile.constants.js +3 -0
  290. package/lib/api/threads/thread-types.d.ts +66 -0
  291. package/lib/api/threads/thread-types.js +1 -0
  292. package/package.json +1 -1
  293. package/lib/api/recipes/index.d.ts +0 -4
  294. package/lib/api/recipes/index.js +0 -3
  295. package/lib/api/services/helpers/arcs.d.ts +0 -6
  296. package/lib/api/services/helpers/matrices.constants.d.ts +0 -2
  297. package/lib/api/services/helpers/matrices.constants.js +0 -2
  298. package/lib/api/services/helpers/matrices.d.ts +0 -25
  299. package/lib/api/services/helpers/mesh-normals.d.ts +0 -11
  300. package/lib/api/services/helpers/polygons.js +0 -59
  301. package/lib/api/services/helpers/vectors.js +0 -17
  302. /package/lib/api/services/helpers/{nurbs.js → curves/nurbs.js} +0 -0
  303. /package/lib/api/services/helpers/{crc32.d.ts → files/crc32.d.ts} +0 -0
  304. /package/lib/api/services/helpers/{crc32.js → files/crc32.js} +0 -0
  305. /package/lib/api/services/helpers/{zip.constants.d.ts → files/zip.constants.d.ts} +0 -0
  306. /package/lib/api/services/helpers/{zip.constants.js → files/zip.constants.js} +0 -0
  307. /package/lib/api/services/helpers/{zip.js → files/zip.js} +0 -0
  308. /package/lib/api/services/helpers/{triangulation.d.ts → geometry/triangulation.d.ts} +0 -0
  309. /package/lib/api/services/helpers/{mesh-measures.d.ts → mesh/mesh-measures.d.ts} +0 -0
  310. /package/lib/api/services/helpers/{mesh-measures.js → mesh/mesh-measures.js} +0 -0
  311. /package/lib/api/services/helpers/{mesh-primitives.constants.d.ts → mesh/mesh-primitives.constants.d.ts} +0 -0
  312. /package/lib/api/services/helpers/{mesh-primitives.constants.js → mesh/mesh-primitives.constants.js} +0 -0
@@ -0,0 +1,425 @@
1
+ import type * as Inputs from "../inputs";
2
+ type Point2 = Inputs.Base.Point2;
3
+ /**
4
+ * The teeth of an involute spur gear, every value given: the shape `spurGearSizes` and
5
+ * `spurGearOutline` read.
6
+ */
7
+ export interface SpurGearSpec {
8
+ /** The pitch circle's diameter divided by the number of teeth, in model units. */
9
+ readonly module: number;
10
+ /** How many teeth the gear has, a whole number of at least 3. */
11
+ readonly teeth: number;
12
+ /** The angle at which meshing teeth push on each other, in degrees, between 0 and 45. */
13
+ readonly pressureAngle: number;
14
+ /** How far the teeth are moved out from the pitch circle, as a share of the module. */
15
+ readonly profileShift: number;
16
+ /** How much thinner each tooth is at the pitch circle than a tight fit, in model units. */
17
+ readonly backlash: number;
18
+ /** How far the teeth reach above the pitch circle, as a share of the module. */
19
+ readonly addendum: number;
20
+ /** How deep the gaps reach below the pitch circle, as a share of the module. */
21
+ readonly dedendum: number;
22
+ /** The radius that rounds the bottom of each gap, as a share of the module; it shrinks to fit. */
23
+ readonly rootFillet: number;
24
+ }
25
+ /**
26
+ * The teeth of an involute ring gear, cut on the inside of a ring, every value given: the shape
27
+ * `ringGearSizes` and `ringGearOutline` read.
28
+ */
29
+ export interface RingGearSpec {
30
+ /** The pitch circle's diameter divided by the number of teeth, in model units. */
31
+ readonly module: number;
32
+ /** How many teeth the ring has; their tips must stay outside the base circle. */
33
+ readonly teeth: number;
34
+ /** The angle at which meshing teeth push on each other, in degrees, between 0 and 45. */
35
+ readonly pressureAngle: number;
36
+ /** How much thinner each tooth is at the pitch circle than a tight fit, in model units. */
37
+ readonly backlash: number;
38
+ /** How far the teeth reach in from the pitch circle toward the centre, as a share of the module. */
39
+ readonly addendum: number;
40
+ /** How deep the gaps reach out beyond the pitch circle, as a share of the module. */
41
+ readonly dedendum: number;
42
+ /** The radius that rounds the bottom of each gap, as a share of the module; it shrinks to fit. */
43
+ readonly rootFillet: number;
44
+ }
45
+ /**
46
+ * The circles of a gear, from `spurGearSizes` or `ringGearSizes`.
47
+ */
48
+ export interface GearSizes {
49
+ /** The radius of the circle meshing gears roll on. */
50
+ readonly pitchRadius: number;
51
+ /** The radius of the circle the flanks unwind from. */
52
+ readonly baseRadius: number;
53
+ /**
54
+ * The radius the tips of the teeth reach: beyond the pitch circle on a spur gear, inside it on
55
+ * a ring gear.
56
+ */
57
+ readonly tipRadius: number;
58
+ /**
59
+ * The radius the bottoms of the gaps reach: inside the pitch circle on a spur gear, beyond it
60
+ * on a ring gear.
61
+ */
62
+ readonly rootRadius: number;
63
+ /** Half the angle a tooth spans at the pitch circle, in radians. */
64
+ readonly halfToothAngle: number;
65
+ }
66
+ /**
67
+ * The part of a tooth a move of a gear outline draws: the arc across its tip, a flank, or the
68
+ * rounded gap at its root.
69
+ */
70
+ export type GearPart = "tip" | "flank" | "root";
71
+ /**
72
+ * One move of a gear outline from where the previous one ended: a straight line, an arc through a
73
+ * point, or a cubic Bezier curve by its two control points.
74
+ */
75
+ export type GearMove = {
76
+ readonly kind: "line";
77
+ readonly to: Inputs.Base.Point2;
78
+ readonly part: GearPart;
79
+ } | {
80
+ readonly kind: "arc";
81
+ readonly through: Inputs.Base.Point2;
82
+ readonly to: Inputs.Base.Point2;
83
+ readonly part: GearPart;
84
+ } | {
85
+ readonly kind: "cubic";
86
+ readonly control1: Inputs.Base.Point2;
87
+ readonly control2: Inputs.Base.Point2;
88
+ readonly to: Inputs.Base.Point2;
89
+ readonly part: GearPart;
90
+ };
91
+ /**
92
+ * A closed gear outline from `spurGearOutline` or `ringGearOutline`: the point it starts at and the
93
+ * moves that lead back to it.
94
+ */
95
+ export interface GearOutline {
96
+ /**
97
+ * Where the outline starts: at the foot of the first flank, on the root circle of a spur gear
98
+ * and the tip circle of a ring gear.
99
+ */
100
+ readonly start: Inputs.Base.Point2;
101
+ /** The moves, counterclockwise, the last one ending at the start. */
102
+ readonly moves: readonly GearMove[];
103
+ }
104
+ export interface LineFlankPiece {
105
+ readonly kind: "line";
106
+ readonly from: Point2;
107
+ readonly to: Point2;
108
+ readonly part: GearPart;
109
+ }
110
+ export interface ArcFlankPiece {
111
+ readonly kind: "arc";
112
+ readonly from: Point2;
113
+ readonly through: Point2;
114
+ readonly to: Point2;
115
+ readonly part: GearPart;
116
+ }
117
+ export interface CubicFlankPiece {
118
+ readonly kind: "cubic";
119
+ readonly from: Point2;
120
+ readonly control1: Point2;
121
+ readonly control2: Point2;
122
+ readonly to: Point2;
123
+ readonly part: GearPart;
124
+ }
125
+ export type FlankPiece = LineFlankPiece | ArcFlankPiece | CubicFlankPiece;
126
+ export interface GearSharedSpec {
127
+ readonly module: number;
128
+ readonly pressureAngle: number;
129
+ readonly addendum: number;
130
+ }
131
+ export interface ArcThrough {
132
+ readonly from: Point2;
133
+ readonly through: Point2;
134
+ readonly to: Point2;
135
+ }
136
+ export interface FilletPlace {
137
+ readonly flankPoint: Point2;
138
+ readonly circlePoint: Point2;
139
+ readonly centre: Point2;
140
+ readonly onLine: boolean;
141
+ readonly roll: number;
142
+ }
143
+ export interface ToothCircles {
144
+ readonly top: number;
145
+ readonly topPart: GearPart;
146
+ readonly gap: number;
147
+ readonly gapPart: GearPart;
148
+ }
149
+ export interface GearTeeth extends GearSharedSpec {
150
+ readonly teeth: number;
151
+ readonly backlash: number;
152
+ readonly dedendum: number;
153
+ readonly rootFillet: number;
154
+ }
155
+ /**
156
+ * Two external spur gears in mesh, every value given: the shape `gearPair` reads.
157
+ */
158
+ export interface GearPairSpec {
159
+ /** The module both gears share, in model units. */
160
+ readonly module: number;
161
+ /** How many teeth the first gear has. */
162
+ readonly teethA: number;
163
+ /** How many teeth the second gear has. */
164
+ readonly teethB: number;
165
+ /** The pressure angle both gears share, in degrees. */
166
+ readonly pressureAngle: number;
167
+ /** The first gear's profile shift, as a share of the module. */
168
+ readonly profileShiftA: number;
169
+ /** The second gear's profile shift, as a share of the module. */
170
+ readonly profileShiftB: number;
171
+ /** How far the teeth reach above the pitch circle, as a share of the module. */
172
+ readonly addendum: number;
173
+ /** How deep the gaps reach below the pitch circle, as a share of the module. */
174
+ readonly dedendum: number;
175
+ }
176
+ /**
177
+ * Two external spur gears in mesh, from `gearPair`.
178
+ */
179
+ export interface GearPairSizes {
180
+ /** How far apart their centres sit, in model units, profile shifts included. */
181
+ readonly centreDistance: number;
182
+ /** The pressure angle at which they work at that distance, in degrees. */
183
+ readonly workingPressureAngle: number;
184
+ /**
185
+ * How many pairs of teeth are in contact on average, counted only along the line of action
186
+ * between the two base circles, where both flanks are involutes; above 1.2 runs smoothly.
187
+ */
188
+ readonly contactRatio: number;
189
+ /** How many turns the first gear makes for one turn of the second. */
190
+ readonly ratio: number;
191
+ /**
192
+ * Whether a gear's tips reach past where the line of action touches the other's base circle,
193
+ * so they would cut into that gear's flank below its involute; the contact ratio leaves that part out.
194
+ */
195
+ readonly interferes: boolean;
196
+ /**
197
+ * How much the profile shifts call for each gear's tips to be shortened, in model units: the
198
+ * shifts times the module less how far the centres moved apart, 0 when that is not more.
199
+ * Taking it off both tips restores the clearance of the same gears unshifted.
200
+ */
201
+ readonly tipShortening: number;
202
+ /**
203
+ * The gap between each gear's tips and the other's roots, in model units, with the tips as
204
+ * `addendum` and the shifts make them; below 0 the tips run into the roots.
205
+ */
206
+ readonly clearance: number;
207
+ }
208
+ export interface GearMesh {
209
+ readonly centreDistance: number;
210
+ readonly contactRatio: number;
211
+ readonly interferes: boolean;
212
+ }
213
+ /**
214
+ * A spur gear meshing inside a ring gear, every value given: the shape `internalGearPair` reads.
215
+ */
216
+ export interface InternalGearPairSpec {
217
+ /** The module both gears share, in model units. */
218
+ readonly module: number;
219
+ /** How many teeth the spur gear has. */
220
+ readonly pinionTeeth: number;
221
+ /** How many teeth the ring has. */
222
+ readonly ringTeeth: number;
223
+ /** The pressure angle both gears share, in degrees. */
224
+ readonly pressureAngle: number;
225
+ /** How far the teeth reach beyond the pitch circles, as a share of the module. */
226
+ readonly addendum: number;
227
+ }
228
+ /**
229
+ * A spur gear meshing inside a ring gear, from `internalGearPair`.
230
+ */
231
+ export interface InternalGearPairSizes {
232
+ /** How far the spur gear's centre sits from the ring's, in model units. */
233
+ readonly centreDistance: number;
234
+ /**
235
+ * How many pairs of teeth are in contact on average, counted only along the line of action
236
+ * beyond where it touches the spur gear's base circle, where both flanks are involutes.
237
+ */
238
+ readonly contactRatio: number;
239
+ /** How many turns the spur gear makes for one turn of the ring. */
240
+ readonly ratio: number;
241
+ /**
242
+ * Whether the teeth interfere: the ring's tips reach below the spur gear's base circle, or the
243
+ * spur gear's tips catch the ring's on the way out of mesh, as they do when the two have
244
+ * nearly as many teeth.
245
+ */
246
+ readonly interferes: boolean;
247
+ }
248
+ /**
249
+ * A planetary gear set by its sun and planets, every value given: the shape `planetarySet` reads.
250
+ */
251
+ export interface PlanetarySetSpec {
252
+ /** The module all its gears share, in model units. */
253
+ readonly module: number;
254
+ /** How many teeth the sun has. */
255
+ readonly sunTeeth: number;
256
+ /** How many teeth each planet has. */
257
+ readonly planetTeeth: number;
258
+ /** How many planets run round the sun, evenly spaced. */
259
+ readonly planets: number;
260
+ /** The pressure angle all its gears share, in degrees. */
261
+ readonly pressureAngle: number;
262
+ /** How far the teeth reach beyond the pitch circles, as a share of the module. */
263
+ readonly addendum: number;
264
+ }
265
+ /**
266
+ * A planetary gear set, from `planetarySet`: the ring that fits it, where the planets sit and how
267
+ * every gear is turned to mesh, the sun at rotation 0.
268
+ */
269
+ export interface PlanetarySet {
270
+ /** How many teeth the ring has: the sun's and twice a planet's. */
271
+ readonly ringTeeth: number;
272
+ /** How far each planet's centre sits from the sun's, in model units. */
273
+ readonly centreDistance: number;
274
+ /** How many turns the sun makes for one turn of the carrier while the ring holds still. */
275
+ readonly ratio: number;
276
+ /** Whether evenly spaced planets mesh with both the sun and the ring. */
277
+ readonly assemblable: boolean;
278
+ /** Whether neighbouring planets keep clear of each other's tips. */
279
+ readonly planetsClear: boolean;
280
+ /**
281
+ * Whether a mesh interferes, as `gearPair` judges the sun with a planet and `internalGearPair`
282
+ * a planet in the ring.
283
+ */
284
+ readonly interferes: boolean;
285
+ /** Where each planet's centre sits, on the XY plane around the sun. */
286
+ readonly planetCentres: Inputs.Base.Point3[];
287
+ /** How far each planet is turned about its own centre to mesh, in degrees. */
288
+ readonly planetRotations: number[];
289
+ /** How far the ring is turned about the sun's centre to mesh with the planets, in degrees. */
290
+ readonly ringRotation: number;
291
+ }
292
+ /**
293
+ * The teeth of an involute rack, every value given: the shape `rackSizes` and `rackOutline` read.
294
+ */
295
+ export interface RackSpec {
296
+ /** The module of the gears it meshes with, in model units. */
297
+ readonly module: number;
298
+ /** How many teeth the rack has. */
299
+ readonly teeth: number;
300
+ /** The pressure angle, in degrees: the angle of each flank from square to the pitch line. */
301
+ readonly pressureAngle: number;
302
+ /** How much thinner each tooth is at the pitch line than a tight fit, in model units. */
303
+ readonly backlash: number;
304
+ /** How far the teeth reach above the pitch line, as a share of the module. */
305
+ readonly addendum: number;
306
+ /** How deep the gaps reach below the pitch line, as a share of the module. */
307
+ readonly dedendum: number;
308
+ /** The radius that rounds the bottom of each gap, as a share of the module; it shrinks to fit. */
309
+ readonly rootFillet: number;
310
+ /** How far the back of the rack lies below the pitch line, in model units. */
311
+ readonly height: number;
312
+ }
313
+ /**
314
+ * The lines of a rack, from `rackSizes`.
315
+ */
316
+ export interface RackSizes {
317
+ /** The distance from one tooth to the next along the pitch line. */
318
+ readonly pitch: number;
319
+ /** The rack's length: its teeth times the pitch. */
320
+ readonly length: number;
321
+ /** How far the tips stand above the pitch line. */
322
+ readonly tipHeight: number;
323
+ /** How deep the gaps reach below the pitch line. */
324
+ readonly rootDepth: number;
325
+ /** How thick each tooth is at the pitch line. */
326
+ readonly toothThickness: number;
327
+ }
328
+ /**
329
+ * The part of a rack a move of its outline draws: a tooth's tip, flank or rounded root, the back,
330
+ * or one of its two ends.
331
+ */
332
+ export type RackPart = GearPart | "back" | "side";
333
+ /**
334
+ * One move of a rack outline: a straight line or an arc through a point.
335
+ */
336
+ export type RackMove = {
337
+ readonly kind: "line";
338
+ readonly to: Inputs.Base.Point2;
339
+ readonly part: RackPart;
340
+ } | {
341
+ readonly kind: "arc";
342
+ readonly through: Inputs.Base.Point2;
343
+ readonly to: Inputs.Base.Point2;
344
+ readonly part: RackPart;
345
+ };
346
+ /**
347
+ * A closed rack outline from `rackOutline`: the point it starts at and the moves that lead back to it.
348
+ */
349
+ export interface RackOutline {
350
+ /** Where the outline starts: the back's corner at the rack's start. */
351
+ readonly start: Inputs.Base.Point2;
352
+ /** The moves, counterclockwise, the last one ending at the start. */
353
+ readonly moves: readonly RackMove[];
354
+ }
355
+ /**
356
+ * The teeth of an involute helical gear, every value given: the shape `helicalGearSizes` and
357
+ * `helicalGearOutline` read. Its module, pressure angle, profile shift, heights and root fillet are
358
+ * measured square to the teeth, as the cutter that makes them is.
359
+ */
360
+ export interface HelicalGearSpec extends SpurGearSpec {
361
+ /** The angle the teeth lean from the axis, in degrees: positive for a right hand, negative for a left. */
362
+ readonly helixAngle: number;
363
+ }
364
+ /**
365
+ * The circles of a helical gear's section square to its axis, from `helicalGearSizes`.
366
+ */
367
+ export interface HelicalGearSizes extends GearSizes {
368
+ /** The module of that section: the pitch circle's diameter divided by the number of teeth. */
369
+ readonly transverseModule: number;
370
+ /** The pressure angle in that section, in degrees. */
371
+ readonly transversePressureAngle: number;
372
+ /**
373
+ * How far the teeth turn about the axis for each model unit along it, in degrees: counterclockwise
374
+ * looking back along the axis for a right hand.
375
+ */
376
+ readonly twist: number;
377
+ }
378
+ /**
379
+ * The teeth of a straight bevel gear, every value given: the shape `bevelGearSizes` and
380
+ * `bevelGearOutline` read. Its module and heights are measured at the back, the gear's outer end.
381
+ */
382
+ export interface BevelGearSpec {
383
+ /** The outer pitch circle's diameter divided by the number of teeth, in model units. */
384
+ readonly module: number;
385
+ /** How many teeth the gear has, a whole number of at least 3. */
386
+ readonly teeth: number;
387
+ /** How many teeth the gear it meshes with has, which sets the cone it rolls on. */
388
+ readonly mateTeeth: number;
389
+ /** The angle between the two gears' axes, in degrees, between 0 and 180. */
390
+ readonly shaftAngle: number;
391
+ /** The angle at which meshing teeth push on each other, in degrees, between 0 and 45. */
392
+ readonly pressureAngle: number;
393
+ /** How much thinner each tooth is at the outer pitch circle than a tight fit, in model units. */
394
+ readonly backlash: number;
395
+ /** How far the teeth reach above the pitch cone at the back, as a share of the module. */
396
+ readonly addendum: number;
397
+ /** How deep the gaps reach below the pitch cone at the back, as a share of the module. */
398
+ readonly dedendum: number;
399
+ /** The radius that rounds the bottom of each gap at the back, as a share of the module. */
400
+ readonly rootFillet: number;
401
+ }
402
+ /**
403
+ * The cones and the outer circles of a straight bevel gear, from `bevelGearSizes`.
404
+ */
405
+ export interface BevelGearSizes {
406
+ /** The radius of the outer pitch circle, where the pitch cone meets the back. */
407
+ readonly pitchRadius: number;
408
+ /** The radius the tips reach at the back. */
409
+ readonly tipRadius: number;
410
+ /** The radius the bottoms of the gaps reach at the back. */
411
+ readonly rootRadius: number;
412
+ /** The half angle of the cone the gear rolls on, in degrees. */
413
+ readonly pitchConeAngle: number;
414
+ /** The half angle of the cone through the tips, in degrees. */
415
+ readonly tipConeAngle: number;
416
+ /** The half angle of the cone through the bottoms of the gaps, in degrees. */
417
+ readonly rootConeAngle: number;
418
+ /** The distance from the apex, where the two axes meet, to the outer pitch circle. */
419
+ readonly coneDistance: number;
420
+ /** How far the outer pitch circle's plane lies from the apex along the axis. */
421
+ readonly apexDistance: number;
422
+ /** The teeth of the spur gear whose outline the back shows, the number of teeth over the cosine of the pitch cone angle. */
423
+ readonly virtualTeeth: number;
424
+ }
425
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ export declare const FIT_TOLERANCE = 0.0001;
2
+ export declare const MAX_FIT_DEPTH = 8;
3
+ export declare const FIT_SAMPLES = 8;
4
+ export declare const GAP_MARGIN = 0.000001;
5
+ export declare const FILLET_GAP_SHARE = 0.02;
6
+ export declare const FILLET_STEPS = 60;
7
+ export declare const BEZIER_HANDLE: number;
8
+ export declare const MIN_TEETH = 3;
9
+ export declare const MAX_PRESSURE_ANGLE = 45;
10
+ export declare const FULL_TURN_DEGREES = 360;
11
+ export declare const HALF_TURN_DEGREES = 180;
12
+ export declare const NEWTON_STEPS = 60;
13
+ export declare const INVOLUTE_SERIES_DIVISOR = 3;
14
+ export declare const PHASE_TOLERANCE = 0.000001;
15
+ export declare const MAX_HELIX_ANGLE = 45;
16
+ export declare const HERMITE_STEP = 0.00001;
17
+ export declare const SHOWN_DIGITS = 3;
18
+ export declare const TIP_CONE_SLACK = 1e-9;
19
+ export declare const SHARP_FILLET = 1e-9;
@@ -0,0 +1,19 @@
1
+ export const FIT_TOLERANCE = 1e-4;
2
+ export const MAX_FIT_DEPTH = 8;
3
+ export const FIT_SAMPLES = 8;
4
+ export const GAP_MARGIN = 1e-6;
5
+ export const FILLET_GAP_SHARE = 0.02;
6
+ export const FILLET_STEPS = 60;
7
+ export const BEZIER_HANDLE = 1 / 3;
8
+ export const MIN_TEETH = 3;
9
+ export const MAX_PRESSURE_ANGLE = 45;
10
+ export const FULL_TURN_DEGREES = 360;
11
+ export const HALF_TURN_DEGREES = 180;
12
+ export const NEWTON_STEPS = 60;
13
+ export const INVOLUTE_SERIES_DIVISOR = 3;
14
+ export const PHASE_TOLERANCE = 1e-6;
15
+ export const MAX_HELIX_ANGLE = 45;
16
+ export const HERMITE_STEP = 1e-5;
17
+ export const SHOWN_DIGITS = 3;
18
+ export const TIP_CONE_SLACK = 1e-9;
19
+ export const SHARP_FILLET = 1e-9;
@@ -0,0 +1,10 @@
1
+ import type * as Inputs from "../inputs";
2
+ import type { FlankPiece, GearMove, GearOutline, GearSizes, RackMove, RackOutline, RingGearSpec, SpurGearSpec } from "./gear-types";
3
+ export declare function spurGearSizes(spec: SpurGearSpec): GearSizes;
4
+ export declare function spurSizesOf(spec: SpurGearSpec): GearSizes;
5
+ export declare const spurFlankPieces: (spec: SpurGearSpec, sizes: GearSizes) => FlankPiece[];
6
+ export declare function spurGearOutline(spec: SpurGearSpec, centre?: Inputs.Base.Point2, rotation?: number): GearOutline;
7
+ export declare function ringGearSizes(spec: RingGearSpec): GearSizes;
8
+ export declare function ringGearOutline(spec: RingGearSpec, centre?: Inputs.Base.Point2, rotation?: number): GearOutline;
9
+ export declare function gearMovePoints(from: Inputs.Base.Point3, move: GearMove | RackMove, segments: number): Inputs.Base.Point3[];
10
+ export declare function gearOutlinePoints(outline: GearOutline | RackOutline, segments: number): Inputs.Base.Point3[];
@@ -0,0 +1,156 @@
1
+ import { InputError } from "../kernel-calls/errors";
2
+ import { FILLET_GAP_SHARE, FIT_TOLERANCE, GAP_MARGIN, SHARP_FILLET } from "./gears.constants";
3
+ import { radiansOf } from "../services/helpers/geometry/scalars";
4
+ import { arcThroughThreePoints, pointOnCubic3, pointsOnArc } from "../services/helpers/geometry/arcs";
5
+ import { checkedTeeth, checkedThickness } from "./gear-checks";
6
+ import { angleOf, filletArc, largestFitting, reversedPiece, rootFilletPlace, toothedOutline, topRoundPlace, UpperFlank } from "./involute-flank";
7
+ import { polar2 } from "../services/helpers/geometry/vectors";
8
+ export function spurGearSizes(spec) {
9
+ checkedTeeth(spec);
10
+ if (!Number.isFinite(spec.profileShift)) {
11
+ throw new InputError("`profileShift` is not a number.", "profileShift");
12
+ }
13
+ checkedThickness(spec.module * (Math.PI / 2 + 2 * spec.profileShift * Math.tan(radiansOf(spec.pressureAngle))), spec.backlash);
14
+ return spurSizesOf(spec);
15
+ }
16
+ export function spurSizesOf(spec) {
17
+ const alpha = radiansOf(spec.pressureAngle);
18
+ const pitchRadius = spec.module * spec.teeth / 2;
19
+ const thickness = spec.module * (Math.PI / 2 + 2 * spec.profileShift * Math.tan(alpha)) - spec.backlash;
20
+ return {
21
+ pitchRadius,
22
+ baseRadius: pitchRadius * Math.cos(alpha),
23
+ tipRadius: pitchRadius + spec.module * (spec.addendum + spec.profileShift),
24
+ rootRadius: pitchRadius - spec.module * (spec.dedendum - spec.profileShift),
25
+ halfToothAngle: thickness / (2 * pitchRadius),
26
+ };
27
+ }
28
+ export const spurFlankPieces = (spec, sizes) => {
29
+ const { baseRadius, tipRadius, rootRadius } = sizes;
30
+ if (!(rootRadius > 0)) {
31
+ throw new InputError("The root circle has no size: give more `teeth`, a smaller `dedendum` or a larger `profileShift`.", "teeth");
32
+ }
33
+ if (!(sizes.halfToothAngle > 0)) {
34
+ throw new InputError("`backlash` takes the whole tooth away.", "backlash");
35
+ }
36
+ const flank = new UpperFlank(baseRadius, sizes.halfToothAngle, radiansOf(spec.pressureAngle));
37
+ const tipRoll = flank.rollAt(tipRadius);
38
+ if (!(angleOf(flank.pointAt(tipRoll)) > GAP_MARGIN)) {
39
+ throw new InputError("The teeth come to a point below the tip circle: lower the `profileShift` or the `addendum`.", "profileShift");
40
+ }
41
+ const gapAngle = Math.PI / spec.teeth;
42
+ const sharpRoot = baseRadius > rootRadius ? polar2(rootRadius, flank.baseAngle) : flank.pointAt(flank.rollAt(rootRadius));
43
+ if (!(angleOf(sharpRoot) <= gapAngle - GAP_MARGIN)) {
44
+ throw new InputError("The teeth are too thick to leave a gap at the root: lower the `profileShift` or add `backlash`.", "profileShift");
45
+ }
46
+ const fitted = largestFitting(spec.rootFillet * spec.module, candidate => angleOf(rootFilletPlace(flank, baseRadius, rootRadius, candidate).circlePoint) <= gapAngle * (1 - FILLET_GAP_SHARE));
47
+ const radius = fitted < SHARP_FILLET * spec.module ? 0 : fitted;
48
+ const pieces = [];
49
+ let involuteStart = flank.rollAt(rootRadius);
50
+ if (radius > 0) {
51
+ const place = rootFilletPlace(flank, baseRadius, rootRadius, radius);
52
+ if (!(place.roll < tipRoll)) {
53
+ throw new InputError("`rootFillet` reaches above the tip of the teeth.", "rootFillet");
54
+ }
55
+ pieces.push(filletArc(place, radius, "root"));
56
+ if (place.onLine) {
57
+ pieces.push({ kind: "line", from: place.flankPoint, to: polar2(baseRadius, flank.baseAngle), part: "flank" });
58
+ }
59
+ involuteStart = place.roll;
60
+ }
61
+ else if (baseRadius > rootRadius) {
62
+ pieces.push({ kind: "line", from: sharpRoot, to: polar2(baseRadius, flank.baseAngle), part: "flank" });
63
+ }
64
+ if (!(tipRadius >= baseRadius)) {
65
+ throw new InputError("The tips of the teeth reach only inside the base circle, where no involute runs: give the gear more `teeth`, a larger `profileShift` or a larger `addendum`.", "profileShift");
66
+ }
67
+ pieces.push(...flank.fitted(involuteStart, tipRoll, FIT_TOLERANCE * spec.module));
68
+ return pieces;
69
+ };
70
+ export function spurGearOutline(spec, centre = [0, 0], rotation = 0) {
71
+ const sizes = spurGearSizes(spec);
72
+ const upper = spurFlankPieces(spec, sizes);
73
+ return toothedOutline(upper, { top: sizes.tipRadius, topPart: "tip", gap: sizes.rootRadius, gapPart: "root" }, spec.teeth, centre, radiansOf(rotation));
74
+ }
75
+ export function ringGearSizes(spec) {
76
+ checkedTeeth(spec);
77
+ checkedThickness(spec.module * Math.PI / 2, spec.backlash);
78
+ const pitchRadius = spec.module * spec.teeth / 2;
79
+ return {
80
+ pitchRadius,
81
+ baseRadius: pitchRadius * Math.cos(radiansOf(spec.pressureAngle)),
82
+ tipRadius: pitchRadius - spec.module * spec.addendum,
83
+ rootRadius: pitchRadius + spec.module * spec.dedendum,
84
+ halfToothAngle: (spec.module * Math.PI / 2 - spec.backlash) / (2 * pitchRadius),
85
+ };
86
+ }
87
+ const ringGapFlankPieces = (spec, sizes) => {
88
+ const { baseRadius, tipRadius, rootRadius } = sizes;
89
+ if (!(sizes.halfToothAngle > 0)) {
90
+ throw new InputError("`backlash` takes the whole tooth away.", "backlash");
91
+ }
92
+ if (!(tipRadius >= baseRadius)) {
93
+ throw new InputError("The tips of the teeth reach inside the base circle, where no involute runs: give the ring more `teeth` or a smaller `addendum`.", "teeth");
94
+ }
95
+ const gapAngle = Math.PI / spec.teeth;
96
+ const flank = new UpperFlank(baseRadius, gapAngle - sizes.halfToothAngle, radiansOf(spec.pressureAngle));
97
+ const tipRoll = flank.rollAt(tipRadius);
98
+ const rootRoll = flank.rollAt(rootRadius);
99
+ if (!(angleOf(flank.pointAt(rootRoll)) > GAP_MARGIN)) {
100
+ throw new InputError("The gaps come to a point inside the root circle: lower the `dedendum`.", "dedendum");
101
+ }
102
+ if (!(angleOf(flank.pointAt(tipRoll)) <= gapAngle - GAP_MARGIN)) {
103
+ throw new InputError("The teeth come to a point before they reach the tip circle: lower the `addendum`.", "addendum");
104
+ }
105
+ const radius = largestFitting(spec.rootFillet * spec.module, candidate => {
106
+ if (!(rootRadius - candidate > baseRadius)) {
107
+ return false;
108
+ }
109
+ const place = topRoundPlace(flank, baseRadius, rootRadius, candidate);
110
+ return place.roll > tipRoll && angleOf(place.centre) >= gapAngle * FILLET_GAP_SHARE;
111
+ });
112
+ if (radius < SHARP_FILLET * spec.module) {
113
+ return flank.fitted(tipRoll, rootRoll, FIT_TOLERANCE * spec.module);
114
+ }
115
+ const place = topRoundPlace(flank, baseRadius, rootRadius, radius);
116
+ return [...flank.fitted(tipRoll, place.roll, FIT_TOLERANCE * spec.module), reversedPiece(filletArc(place, radius, "root"))];
117
+ };
118
+ export function ringGearOutline(spec, centre = [0, 0], rotation = 0) {
119
+ const sizes = ringGearSizes(spec);
120
+ const upper = ringGapFlankPieces(spec, sizes);
121
+ return toothedOutline(upper, { top: sizes.rootRadius, topPart: "root", gap: sizes.tipRadius, gapPart: "tip" }, spec.teeth, centre, radiansOf(rotation) + Math.PI / spec.teeth);
122
+ }
123
+ const lifted = (point) => [point[0], point[1], 0];
124
+ export function gearMovePoints(from, move, segments) {
125
+ const to = lifted(move.to);
126
+ if (move.kind === "arc") {
127
+ const arc = arcThroughThreePoints(from, lifted(move.through), to);
128
+ return arc === undefined ? [from, to] : pointsOnArc(arc, from, to, segments);
129
+ }
130
+ if (move.kind === "cubic") {
131
+ const control1 = lifted(move.control1);
132
+ const control2 = lifted(move.control2);
133
+ return Array.from({ length: segments + 1 }, (_, step) => step === 0 ? from : step === segments ? to : pointOnCubic3(from, control1, control2, to, step / segments));
134
+ }
135
+ return [from, to];
136
+ }
137
+ export function gearOutlinePoints(outline, segments) {
138
+ if (!Number.isInteger(segments) || segments < 1) {
139
+ throw new InputError("`segments` is not a whole number of at least 1.", "segments");
140
+ }
141
+ const points = [];
142
+ const sameAs = (point, other) => other !== undefined && point[0] === other[0] && point[1] === other[1] && point[2] === other[2];
143
+ let from = lifted(outline.start);
144
+ for (const move of outline.moves) {
145
+ gearMovePoints(from, move, segments).slice(0, -1).forEach(point => {
146
+ if (!sameAs(point, points[points.length - 1])) {
147
+ points.push(point);
148
+ }
149
+ });
150
+ from = lifted(move.to);
151
+ }
152
+ if (points.length > 1 && sameAs(points[points.length - 1], points[0])) {
153
+ points.pop();
154
+ }
155
+ return points;
156
+ }
@@ -0,0 +1,5 @@
1
+ import type * as Inputs from "../inputs";
2
+ import type { GearOutline, HelicalGearSizes, HelicalGearSpec, SpurGearSpec } from "./gear-types";
3
+ export declare function helicalTransverseSpec(spec: HelicalGearSpec): SpurGearSpec;
4
+ export declare function helicalGearSizes(spec: HelicalGearSpec): HelicalGearSizes;
5
+ export declare function helicalGearOutline(spec: HelicalGearSpec, centre?: Inputs.Base.Point2, rotation?: number): GearOutline;
@@ -0,0 +1,33 @@
1
+ import { InputError } from "../kernel-calls/errors";
2
+ import { MAX_HELIX_ANGLE, MAX_PRESSURE_ANGLE, SHOWN_DIGITS } from "./gears.constants";
3
+ import { degreesOf, radiansOf } from "../services/helpers/geometry/scalars";
4
+ import { spurGearOutline, spurGearSizes } from "./gears";
5
+ export function helicalTransverseSpec(spec) {
6
+ if (!(Math.abs(spec.helixAngle) < MAX_HELIX_ANGLE)) {
7
+ throw new InputError(`\`helixAngle\` is not between -${String(MAX_HELIX_ANGLE)} and ${String(MAX_HELIX_ANGLE)} degrees.`, "helixAngle");
8
+ }
9
+ spurGearSizes(spec);
10
+ const cos = Math.cos(radiansOf(spec.helixAngle));
11
+ const pressureAngle = degreesOf(Math.atan(Math.tan(radiansOf(spec.pressureAngle)) / cos));
12
+ if (!(pressureAngle < MAX_PRESSURE_ANGLE)) {
13
+ throw new InputError(`\`pressureAngle\` ${String(spec.pressureAngle)} with \`helixAngle\` ${String(spec.helixAngle)} gives a transverse pressure angle of ${String(Number(pressureAngle.toPrecision(SHOWN_DIGITS)))} degrees, above ${String(MAX_PRESSURE_ANGLE)}: lower one of them.`, "pressureAngle");
14
+ }
15
+ return {
16
+ module: spec.module / cos,
17
+ teeth: spec.teeth,
18
+ pressureAngle,
19
+ profileShift: spec.profileShift * cos,
20
+ backlash: spec.backlash,
21
+ addendum: spec.addendum * cos,
22
+ dedendum: spec.dedendum * cos,
23
+ rootFillet: spec.rootFillet * cos,
24
+ };
25
+ }
26
+ export function helicalGearSizes(spec) {
27
+ const transverse = helicalTransverseSpec(spec);
28
+ const sizes = spurGearSizes(transverse);
29
+ return Object.assign(Object.assign({}, sizes), { transverseModule: transverse.module, transversePressureAngle: transverse.pressureAngle, twist: degreesOf(Math.tan(radiansOf(spec.helixAngle)) / sizes.pitchRadius) });
30
+ }
31
+ export function helicalGearOutline(spec, centre = [0, 0], rotation = 0) {
32
+ return spurGearOutline(helicalTransverseSpec(spec), centre, rotation);
33
+ }