@metamesh/modeling 0.12.0 → 0.13.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 (629) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +60 -72
  3. package/dist/api/engine.d.ts +123 -97
  4. package/dist/api/geometry.d.ts +3896 -3307
  5. package/dist/api/index.d.ts +2489 -2268
  6. package/dist/api/text.d.ts +119 -107
  7. package/dist/docs/guides/concepts.md +197 -0
  8. package/dist/docs/guides/fonts.md +51 -0
  9. package/dist/docs/guides/fundamentals.md +135 -0
  10. package/dist/docs/guides/generation.md +221 -0
  11. package/dist/docs/guides/hosting.md +88 -0
  12. package/dist/docs/guides/recipes.md +668 -0
  13. package/dist/docs/manifest.json +9851 -0
  14. package/dist/docs/reference/engine/Export3mfOptions.md +29 -0
  15. package/dist/docs/reference/engine/ExportMeshPart.md +65 -0
  16. package/dist/docs/reference/engine/GenerationOptions.md +62 -0
  17. package/dist/docs/reference/engine/GeometryResource.md +77 -0
  18. package/dist/docs/reference/engine/ModelDependencies.md +41 -0
  19. package/dist/docs/reference/engine/ModelEngine.md +103 -0
  20. package/dist/docs/reference/engine/ModelEngineOptions.md +33 -0
  21. package/dist/docs/reference/engine/ModelSession.md +96 -0
  22. package/dist/docs/reference/engine/ModelSnapshot.md +173 -0
  23. package/dist/docs/reference/engine/SessionOptions.md +123 -0
  24. package/dist/docs/reference/engine/SnapshotPart.md +130 -0
  25. package/dist/docs/reference/engine/categories/host-lifecycle.md +37 -0
  26. package/dist/docs/reference/engine/createModelEngine.md +56 -0
  27. package/dist/docs/reference/engine/defaultModelingLimits.md +7 -0
  28. package/dist/docs/reference/engine/modelingWasmUrl.md +7 -0
  29. package/dist/docs/reference/engine/validateModel.md +48 -0
  30. package/dist/docs/reference/engine.md +25 -0
  31. package/dist/docs/reference/geometry/AcmeThreadProfileSpec.md +75 -0
  32. package/dist/docs/reference/geometry/AlignedCircularSegmentsOptions.md +79 -0
  33. package/dist/docs/reference/geometry/Anchor3.md +49 -0
  34. package/dist/docs/reference/geometry/ArcCurve2.md +70 -0
  35. package/dist/docs/reference/geometry/ArcCurve3.md +94 -0
  36. package/dist/docs/reference/geometry/AttachTransformOptions.md +58 -0
  37. package/dist/docs/reference/geometry/AxisAngleRotation3.md +61 -0
  38. package/dist/docs/reference/geometry/Bounds2.md +39 -0
  39. package/dist/docs/reference/geometry/Bounds3.md +39 -0
  40. package/dist/docs/reference/geometry/BoundsFit2.md +52 -0
  41. package/dist/docs/reference/geometry/BoundsFit3.md +52 -0
  42. package/dist/docs/reference/geometry/BoundsFitOptions.md +23 -0
  43. package/dist/docs/reference/geometry/BoundsFromSizeOptions.md +23 -0
  44. package/dist/docs/reference/geometry/BoxAnchorFace.md +7 -0
  45. package/dist/docs/reference/geometry/BoxAnchorOptions.md +59 -0
  46. package/dist/docs/reference/geometry/BoxEdge.md +7 -0
  47. package/dist/docs/reference/geometry/BoxEdgeSelection.md +14 -0
  48. package/dist/docs/reference/geometry/BoxEdgeTreatments.md +15 -0
  49. package/dist/docs/reference/geometry/BoxOptions.md +87 -0
  50. package/dist/docs/reference/geometry/ButtressPressureFlankSide.md +7 -0
  51. package/dist/docs/reference/geometry/ButtressThreadProfileSpec.md +93 -0
  52. package/dist/docs/reference/geometry/ChamferedEdgeTreatment.md +29 -0
  53. package/dist/docs/reference/geometry/CircleContourOptions.md +15 -0
  54. package/dist/docs/reference/geometry/CircularPrimitiveOptions.md +59 -0
  55. package/dist/docs/reference/geometry/ClearanceHoleDimensions.md +41 -0
  56. package/dist/docs/reference/geometry/ClearanceHoleFit.md +7 -0
  57. package/dist/docs/reference/geometry/CompensatedThreadDiameters.md +53 -0
  58. package/dist/docs/reference/geometry/Contour.md +17 -0
  59. package/dist/docs/reference/geometry/ContourCurve.md +35 -0
  60. package/dist/docs/reference/geometry/ContourPoint.md +29 -0
  61. package/dist/docs/reference/geometry/ContourSegment.md +86 -0
  62. package/dist/docs/reference/geometry/CorrespondingComponent.md +46 -0
  63. package/dist/docs/reference/geometry/CorrespondingContour.md +46 -0
  64. package/dist/docs/reference/geometry/CorrespondingProfile.md +22 -0
  65. package/dist/docs/reference/geometry/CorrespondingProfileStation.md +27 -0
  66. package/dist/docs/reference/geometry/CubicBezierCurve2.md +70 -0
  67. package/dist/docs/reference/geometry/CubicBezierCurve3.md +70 -0
  68. package/dist/docs/reference/geometry/Curve2.md +16 -0
  69. package/dist/docs/reference/geometry/Curve3.md +16 -0
  70. package/dist/docs/reference/geometry/CurveSamplingOptions.md +64 -0
  71. package/dist/docs/reference/geometry/CustomThreadProfileSpec.md +73 -0
  72. package/dist/docs/reference/geometry/CylinderAnchorFace.md +7 -0
  73. package/dist/docs/reference/geometry/CylinderAnchorOptions.md +83 -0
  74. package/dist/docs/reference/geometry/CylinderOptions.md +53 -0
  75. package/dist/docs/reference/geometry/CylindricalGearDimensions.md +209 -0
  76. package/dist/docs/reference/geometry/CylindricalGearMeshKind.md +7 -0
  77. package/dist/docs/reference/geometry/CylindricalGearOutlineOptions.md +71 -0
  78. package/dist/docs/reference/geometry/CylindricalGearPairDimensions.md +82 -0
  79. package/dist/docs/reference/geometry/CylindricalGearPairMotionOptions.md +34 -0
  80. package/dist/docs/reference/geometry/CylindricalGearPairMotionReport.md +41 -0
  81. package/dist/docs/reference/geometry/CylindricalGearPairSpec.md +47 -0
  82. package/dist/docs/reference/geometry/CylindricalGearSpec.md +82 -0
  83. package/dist/docs/reference/geometry/DEFAULT_GEOMETRY_TOLERANCE.md +7 -0
  84. package/dist/docs/reference/geometry/EdgeTreatment.md +17 -0
  85. package/dist/docs/reference/geometry/EllipseContourOptions.md +15 -0
  86. package/dist/docs/reference/geometry/EndTreatments.md +34 -0
  87. package/dist/docs/reference/geometry/ExtrudeOptions.md +134 -0
  88. package/dist/docs/reference/geometry/ExtrusionSamplingOptions.md +77 -0
  89. package/dist/docs/reference/geometry/FittedTextLayout.md +60 -0
  90. package/dist/docs/reference/geometry/Frame3.md +58 -0
  91. package/dist/docs/reference/geometry/GeometryError.md +97 -0
  92. package/dist/docs/reference/geometry/GeometryErrorCode.md +7 -0
  93. package/dist/docs/reference/geometry/GeometryErrorContext.md +29 -0
  94. package/dist/docs/reference/geometry/GeometryResolution.md +65 -0
  95. package/dist/docs/reference/geometry/GeometrySamplingLimits.md +62 -0
  96. package/dist/docs/reference/geometry/GeometryToleranceOptions.md +41 -0
  97. package/dist/docs/reference/geometry/GridPatternOptions.md +42 -0
  98. package/dist/docs/reference/geometry/HeightfieldMeshLimits.md +14 -0
  99. package/dist/docs/reference/geometry/HeightfieldOptions.md +67 -0
  100. package/dist/docs/reference/geometry/HeightfieldPreflight.md +53 -0
  101. package/dist/docs/reference/geometry/HelicalThreadRidgeMeshOptions.md +141 -0
  102. package/dist/docs/reference/geometry/HelicalThreadSolidMeshOptions.md +265 -0
  103. package/dist/docs/reference/geometry/HelicalThreadSolidMeshPreflight.md +53 -0
  104. package/dist/docs/reference/geometry/IDENTITY_TRANSFORM3.md +14 -0
  105. package/dist/docs/reference/geometry/InternalThreadCutterOptions.md +242 -0
  106. package/dist/docs/reference/geometry/LineCurve2.md +46 -0
  107. package/dist/docs/reference/geometry/LineCurve3.md +46 -0
  108. package/dist/docs/reference/geometry/LinearPatternOptions.md +30 -0
  109. package/dist/docs/reference/geometry/LoftCorrespondence.md +19 -0
  110. package/dist/docs/reference/geometry/LoftMeshStation.md +27 -0
  111. package/dist/docs/reference/geometry/LoftOptions.md +84 -0
  112. package/dist/docs/reference/geometry/LoftPlacement.md +66 -0
  113. package/dist/docs/reference/geometry/METRIC_FASTENER_STANDARDS.md +18 -0
  114. package/dist/docs/reference/geometry/MatchProfilesOptions.md +35 -0
  115. package/dist/docs/reference/geometry/MetricFastenerSize.md +7 -0
  116. package/dist/docs/reference/geometry/MetricFastenerStandard.md +72 -0
  117. package/dist/docs/reference/geometry/MetricHexNutDimensions.md +29 -0
  118. package/dist/docs/reference/geometry/MetricSocketCapHeadDimensions.md +41 -0
  119. package/dist/docs/reference/geometry/ModelingLimits.md +126 -0
  120. package/dist/docs/reference/geometry/PRINTABLE_THREAD_FIT_POLICIES.md +17 -0
  121. package/dist/docs/reference/geometry/Path2.md +14 -0
  122. package/dist/docs/reference/geometry/Path3.md +14 -0
  123. package/dist/docs/reference/geometry/PathFrame.md +46 -0
  124. package/dist/docs/reference/geometry/PathNormalGuide.md +38 -0
  125. package/dist/docs/reference/geometry/PathPatternOptions.md +46 -0
  126. package/dist/docs/reference/geometry/PathPlacement.md +34 -0
  127. package/dist/docs/reference/geometry/PlanarMeshOptimizationFallbackReason.md +7 -0
  128. package/dist/docs/reference/geometry/PlanarMeshOptimizationOptions.md +156 -0
  129. package/dist/docs/reference/geometry/PlanarMeshOptimizationResult.md +120 -0
  130. package/dist/docs/reference/geometry/PlanarPatchQuality.md +190 -0
  131. package/dist/docs/reference/geometry/Polygon.md +38 -0
  132. package/dist/docs/reference/geometry/PolylineResamplingOptions.md +92 -0
  133. package/dist/docs/reference/geometry/PrimitivePlacement.md +31 -0
  134. package/dist/docs/reference/geometry/PrimitivePlacementOptions.md +83 -0
  135. package/dist/docs/reference/geometry/PrintableThreadFit.md +7 -0
  136. package/dist/docs/reference/geometry/PrintableThreadFitPolicy.md +45 -0
  137. package/dist/docs/reference/geometry/Profile.md +22 -0
  138. package/dist/docs/reference/geometry/ProfileComponent2.md +46 -0
  139. package/dist/docs/reference/geometry/ProfileContour2.md +34 -0
  140. package/dist/docs/reference/geometry/ProfileSpan2.md +47 -0
  141. package/dist/docs/reference/geometry/ProfiledEdgeTreatment.md +36 -0
  142. package/dist/docs/reference/geometry/RackPitchDimensions.md +113 -0
  143. package/dist/docs/reference/geometry/RackPitchSpec.md +77 -0
  144. package/dist/docs/reference/geometry/RadialPatternOptions.md +62 -0
  145. package/dist/docs/reference/geometry/RadialSizing.md +7 -0
  146. package/dist/docs/reference/geometry/RadialSizingOptions.md +40 -0
  147. package/dist/docs/reference/geometry/RectangleContourOptions.md +66 -0
  148. package/dist/docs/reference/geometry/RectangleCornerTreatment.md +34 -0
  149. package/dist/docs/reference/geometry/RectangleCornerTreatments.md +14 -0
  150. package/dist/docs/reference/geometry/RectangleProfileOptions.md +94 -0
  151. package/dist/docs/reference/geometry/Region.md +14 -0
  152. package/dist/docs/reference/geometry/RegularPolygonContourOptions.md +84 -0
  153. package/dist/docs/reference/geometry/ResolvedGeometryTolerance.md +65 -0
  154. package/dist/docs/reference/geometry/RevolveOptions.md +82 -0
  155. package/dist/docs/reference/geometry/RoundedEdgeTreatment.md +91 -0
  156. package/dist/docs/reference/geometry/RowLayoutOptions.md +23 -0
  157. package/dist/docs/reference/geometry/SampleContourOptions.md +71 -0
  158. package/dist/docs/reference/geometry/SampleHelixOptions.md +95 -0
  159. package/dist/docs/reference/geometry/SampleSideProfileOptions.md +71 -0
  160. package/dist/docs/reference/geometry/SampledCurve2.md +34 -0
  161. package/dist/docs/reference/geometry/SampledCurve3.md +34 -0
  162. package/dist/docs/reference/geometry/SampledThreadHelices.md +58 -0
  163. package/dist/docs/reference/geometry/SideProfileCurve.md +35 -0
  164. package/dist/docs/reference/geometry/SideProfilePoint.md +29 -0
  165. package/dist/docs/reference/geometry/SideProfileSegment.md +86 -0
  166. package/dist/docs/reference/geometry/SmoothEdgeTreatment.md +71 -0
  167. package/dist/docs/reference/geometry/SolidMeshValidationOptions.md +34 -0
  168. package/dist/docs/reference/geometry/SphereOptions.md +15 -0
  169. package/dist/docs/reference/geometry/SquareThreadProfileSpec.md +75 -0
  170. package/dist/docs/reference/geometry/StrokePathCap.md +7 -0
  171. package/dist/docs/reference/geometry/StrokePathJoin.md +7 -0
  172. package/dist/docs/reference/geometry/StrokePathRegionOptions.md +85 -0
  173. package/dist/docs/reference/geometry/SvgImportOptions.md +60 -0
  174. package/dist/docs/reference/geometry/SvgRegionPreflight.md +61 -0
  175. package/dist/docs/reference/geometry/SvgRegionPreflightGeometryMetrics.md +118 -0
  176. package/dist/docs/reference/geometry/SvgRegionPreflightRepairs.md +65 -0
  177. package/dist/docs/reference/geometry/SvgRegionPreflightSourceMetrics.md +53 -0
  178. package/dist/docs/reference/geometry/SweepOptions.md +109 -0
  179. package/dist/docs/reference/geometry/SweepOrientation.md +109 -0
  180. package/dist/docs/reference/geometry/ThreadBevelOptions.md +53 -0
  181. package/dist/docs/reference/geometry/ThreadCircularSegmentsOptions.md +100 -0
  182. package/dist/docs/reference/geometry/ThreadCompensationOptions.md +73 -0
  183. package/dist/docs/reference/geometry/ThreadEndStyle.md +7 -0
  184. package/dist/docs/reference/geometry/ThreadEndTreatmentOptions.md +113 -0
  185. package/dist/docs/reference/geometry/ThreadHandedness.md +7 -0
  186. package/dist/docs/reference/geometry/ThreadHelixOptions.md +120 -0
  187. package/dist/docs/reference/geometry/ThreadLeadInEnvelope.md +7 -0
  188. package/dist/docs/reference/geometry/ThreadLeadInShape.md +7 -0
  189. package/dist/docs/reference/geometry/ThreadProfile.md +82 -0
  190. package/dist/docs/reference/geometry/ThreadProfileBaseSpec.md +49 -0
  191. package/dist/docs/reference/geometry/ThreadProfileSpec.md +19 -0
  192. package/dist/docs/reference/geometry/ThreadRole.md +7 -0
  193. package/dist/docs/reference/geometry/ThreadedNutBevel.md +7 -0
  194. package/dist/docs/reference/geometry/ThreadedNutOptions.md +269 -0
  195. package/dist/docs/reference/geometry/ThreadedNutPreflight.md +94 -0
  196. package/dist/docs/reference/geometry/ThreadedNutShape.md +7 -0
  197. package/dist/docs/reference/geometry/ThreadedRodOptions.md +242 -0
  198. package/dist/docs/reference/geometry/TorusOptions.md +105 -0
  199. package/dist/docs/reference/geometry/Transform3.md +12 -0
  200. package/dist/docs/reference/geometry/TrapezoidalThreadProfileSpec.md +91 -0
  201. package/dist/docs/reference/geometry/TriangleMesh.md +34 -0
  202. package/dist/docs/reference/geometry/TriangleMeshAnalysis.md +119 -0
  203. package/dist/docs/reference/geometry/TriangleMeshAnalysisOptions.md +75 -0
  204. package/dist/docs/reference/geometry/TriangleMeshMeasurements.md +75 -0
  205. package/dist/docs/reference/geometry/TriangleMeshQualityOptions.md +39 -0
  206. package/dist/docs/reference/geometry/TriangleMeshQualityReport.md +190 -0
  207. package/dist/docs/reference/geometry/TriangleMeshSignature.md +107 -0
  208. package/dist/docs/reference/geometry/TriangleMeshSignatureOptions.md +41 -0
  209. package/dist/docs/reference/geometry/TriangleMeshSignatureTolerances.md +29 -0
  210. package/dist/docs/reference/geometry/TriangleMeshValidationOptions.md +51 -0
  211. package/dist/docs/reference/geometry/TriangularThreadProfileSpec.md +91 -0
  212. package/dist/docs/reference/geometry/TubeOptions.md +138 -0
  213. package/dist/docs/reference/geometry/Vector2.md +7 -0
  214. package/dist/docs/reference/geometry/Vector3.md +7 -0
  215. package/dist/docs/reference/geometry/VectorTextArcBaseline.md +53 -0
  216. package/dist/docs/reference/geometry/VectorTextLayout.md +39 -0
  217. package/dist/docs/reference/geometry/VectorTextLayoutOptions.md +111 -0
  218. package/dist/docs/reference/geometry/VectorTextMetrics.md +94 -0
  219. package/dist/docs/reference/geometry/VectorTextOptions.md +50 -0
  220. package/dist/docs/reference/geometry/add3.md +38 -0
  221. package/dist/docs/reference/geometry/analyzeTriangleMesh.md +57 -0
  222. package/dist/docs/reference/geometry/analyzeTriangleMeshQuality.md +52 -0
  223. package/dist/docs/reference/geometry/anchorFrame3.md +40 -0
  224. package/dist/docs/reference/geometry/applyTransformDirection3.md +41 -0
  225. package/dist/docs/reference/geometry/applyTransformPoint3.md +39 -0
  226. package/dist/docs/reference/geometry/attachTransform.md +73 -0
  227. package/dist/docs/reference/geometry/boundsCenter.md +62 -0
  228. package/dist/docs/reference/geometry/boundsFromSize.md +83 -0
  229. package/dist/docs/reference/geometry/boundsSize.md +62 -0
  230. package/dist/docs/reference/geometry/boxAnchor3.md +48 -0
  231. package/dist/docs/reference/geometry/buildHelicalThreadRidgeMesh.md +68 -0
  232. package/dist/docs/reference/geometry/buildHelicalThreadSolidMesh.md +102 -0
  233. package/dist/docs/reference/geometry/categories/bounds-layout.md +35 -0
  234. package/dist/docs/reference/geometry/categories/curves-paths.md +63 -0
  235. package/dist/docs/reference/geometry/categories/mechanical.md +101 -0
  236. package/dist/docs/reference/geometry/categories/meshes.md +73 -0
  237. package/dist/docs/reference/geometry/categories/pattern-placement.md +34 -0
  238. package/dist/docs/reference/geometry/categories/primitive-options.md +36 -0
  239. package/dist/docs/reference/geometry/categories/profiles-regions.md +74 -0
  240. package/dist/docs/reference/geometry/categories/resolution-errors.md +46 -0
  241. package/dist/docs/reference/geometry/categories/transforms-math.md +63 -0
  242. package/dist/docs/reference/geometry/categories/vector-import.md +40 -0
  243. package/dist/docs/reference/geometry/circleContour.md +33 -0
  244. package/dist/docs/reference/geometry/closeToAxis.md +34 -0
  245. package/dist/docs/reference/geometry/compensateThreadDiameters.md +51 -0
  246. package/dist/docs/reference/geometry/compensateThreadProfileAxially.md +42 -0
  247. package/dist/docs/reference/geometry/compensateThreadProfileForFaceting.md +56 -0
  248. package/dist/docs/reference/geometry/composeTransform3.md +40 -0
  249. package/dist/docs/reference/geometry/computeClosedParallelTransportFrames.md +45 -0
  250. package/dist/docs/reference/geometry/computeParallelTransportFrames.md +47 -0
  251. package/dist/docs/reference/geometry/computeTriangleMeshCentroid.md +31 -0
  252. package/dist/docs/reference/geometry/containsBounds.md +72 -0
  253. package/dist/docs/reference/geometry/contourContainsPoint.md +33 -0
  254. package/dist/docs/reference/geometry/createAnchor3.md +63 -0
  255. package/dist/docs/reference/geometry/createThreadProfile.md +37 -0
  256. package/dist/docs/reference/geometry/createTriangleMeshSignature.md +60 -0
  257. package/dist/docs/reference/geometry/cross3.md +38 -0
  258. package/dist/docs/reference/geometry/cumulativePathLengths.md +33 -0
  259. package/dist/docs/reference/geometry/cylinderAnchor3.md +56 -0
  260. package/dist/docs/reference/geometry/defaultGeometrySamplingLimits.md +14 -0
  261. package/dist/docs/reference/geometry/distributeAlongPath.md +51 -0
  262. package/dist/docs/reference/geometry/dot3.md +38 -0
  263. package/dist/docs/reference/geometry/ellipseContour.md +33 -0
  264. package/dist/docs/reference/geometry/eulerTransform3.md +38 -0
  265. package/dist/docs/reference/geometry/extrudeMesh.md +73 -0
  266. package/dist/docs/reference/geometry/fitBounds.md +95 -0
  267. package/dist/docs/reference/geometry/fitTextLayout.md +57 -0
  268. package/dist/docs/reference/geometry/frameTransform3.md +44 -0
  269. package/dist/docs/reference/geometry/getMetricClearanceHole.md +33 -0
  270. package/dist/docs/reference/geometry/getMetricFastenerStandard.md +27 -0
  271. package/dist/docs/reference/geometry/gridPatternTransforms.md +31 -0
  272. package/dist/docs/reference/geometry/heightfieldMesh.md +43 -0
  273. package/dist/docs/reference/geometry/inverseTransform3.md +30 -0
  274. package/dist/docs/reference/geometry/isGeometryError.md +26 -0
  275. package/dist/docs/reference/geometry/joinTriangleMeshes.md +36 -0
  276. package/dist/docs/reference/geometry/layoutRow.md +43 -0
  277. package/dist/docs/reference/geometry/length3.md +26 -0
  278. package/dist/docs/reference/geometry/lerp3.md +38 -0
  279. package/dist/docs/reference/geometry/linearPatternTransforms.md +31 -0
  280. package/dist/docs/reference/geometry/loftMesh.md +72 -0
  281. package/dist/docs/reference/geometry/matchProfiles.md +51 -0
  282. package/dist/docs/reference/geometry/measureInternalCylindricalGearPairMotion.md +47 -0
  283. package/dist/docs/reference/geometry/measureTriangleMesh.md +55 -0
  284. package/dist/docs/reference/geometry/meshBounds.md +35 -0
  285. package/dist/docs/reference/geometry/minimumCylindricalGearToothCountWithoutUndercut.md +29 -0
  286. package/dist/docs/reference/geometry/normalize3.md +32 -0
  287. package/dist/docs/reference/geometry/normalizeContour.md +45 -0
  288. package/dist/docs/reference/geometry/normalizePolygon.md +37 -0
  289. package/dist/docs/reference/geometry/normalizeRegion.md +33 -0
  290. package/dist/docs/reference/geometry/optimizePlanarPatches.md +91 -0
  291. package/dist/docs/reference/geometry/pathLength.md +33 -0
  292. package/dist/docs/reference/geometry/pathPatternTransforms.md +57 -0
  293. package/dist/docs/reference/geometry/preflightHeightfield.md +34 -0
  294. package/dist/docs/reference/geometry/preflightHelicalThreadSolidMesh.md +96 -0
  295. package/dist/docs/reference/geometry/preflightInternalThreadCutter.md +85 -0
  296. package/dist/docs/reference/geometry/preflightSvgRegion.md +56 -0
  297. package/dist/docs/reference/geometry/preflightThreadedNut.md +96 -0
  298. package/dist/docs/reference/geometry/preflightThreadedRod.md +85 -0
  299. package/dist/docs/reference/geometry/projectOntoPlane3.md +32 -0
  300. package/dist/docs/reference/geometry/radialPatternTransforms.md +47 -0
  301. package/dist/docs/reference/geometry/rectangleContour.md +49 -0
  302. package/dist/docs/reference/geometry/rectangleProfile.md +53 -0
  303. package/dist/docs/reference/geometry/regionArea.md +34 -0
  304. package/dist/docs/reference/geometry/regionBounds.md +27 -0
  305. package/dist/docs/reference/geometry/regularPolygonContour.md +53 -0
  306. package/dist/docs/reference/geometry/resamplePolyline2.md +64 -0
  307. package/dist/docs/reference/geometry/resamplePolyline3.md +67 -0
  308. package/dist/docs/reference/geometry/resolveAlignedCircularSegments.md +79 -0
  309. package/dist/docs/reference/geometry/resolveArcSegments.md +67 -0
  310. package/dist/docs/reference/geometry/resolveCircularSegments.md +61 -0
  311. package/dist/docs/reference/geometry/resolveCylindricalGear.md +31 -0
  312. package/dist/docs/reference/geometry/resolveCylindricalGearPair.md +31 -0
  313. package/dist/docs/reference/geometry/resolveExtrusionDivisions.md +74 -0
  314. package/dist/docs/reference/geometry/resolveGeometrySamplingLimits.md +26 -0
  315. package/dist/docs/reference/geometry/resolveGeometryTolerance.md +59 -0
  316. package/dist/docs/reference/geometry/resolvePrintableThreadFitPolicy.md +27 -0
  317. package/dist/docs/reference/geometry/resolveRackPitch.md +27 -0
  318. package/dist/docs/reference/geometry/resolveThreadCircularSegments.md +59 -0
  319. package/dist/docs/reference/geometry/reverseTriangleMesh.md +30 -0
  320. package/dist/docs/reference/geometry/revolveMesh.md +76 -0
  321. package/dist/docs/reference/geometry/rotateAroundAxis3.md +38 -0
  322. package/dist/docs/reference/geometry/rotationTransform3.md +49 -0
  323. package/dist/docs/reference/geometry/roundClosedPolylinePath.md +50 -0
  324. package/dist/docs/reference/geometry/sampleContour.md +77 -0
  325. package/dist/docs/reference/geometry/sampleCurve2.md +61 -0
  326. package/dist/docs/reference/geometry/sampleCurve3.md +61 -0
  327. package/dist/docs/reference/geometry/sampleCylindricalGearOutline.md +58 -0
  328. package/dist/docs/reference/geometry/sampleHelix.md +41 -0
  329. package/dist/docs/reference/geometry/sampleInternalCylindricalGearSpaceOutline.md +59 -0
  330. package/dist/docs/reference/geometry/sampleRackToothPath.md +39 -0
  331. package/dist/docs/reference/geometry/sampleSideProfile.md +73 -0
  332. package/dist/docs/reference/geometry/sampleTextContours.md +53 -0
  333. package/dist/docs/reference/geometry/sampleThreadHelices.md +63 -0
  334. package/dist/docs/reference/geometry/scale3.md +38 -0
  335. package/dist/docs/reference/geometry/scaleTransform3.md +34 -0
  336. package/dist/docs/reference/geometry/signedContourArea.md +26 -0
  337. package/dist/docs/reference/geometry/starContour.md +51 -0
  338. package/dist/docs/reference/geometry/strokePathRegion.md +63 -0
  339. package/dist/docs/reference/geometry/subtract3.md +38 -0
  340. package/dist/docs/reference/geometry/sweepMesh.md +82 -0
  341. package/dist/docs/reference/geometry/transformContour.md +42 -0
  342. package/dist/docs/reference/geometry/transformDeterminant3.md +32 -0
  343. package/dist/docs/reference/geometry/transformPath2.md +40 -0
  344. package/dist/docs/reference/geometry/transformPath3.md +33 -0
  345. package/dist/docs/reference/geometry/transformRegion.md +40 -0
  346. package/dist/docs/reference/geometry/transformTriangleMesh.md +42 -0
  347. package/dist/docs/reference/geometry/translationTransform3.md +31 -0
  348. package/dist/docs/reference/geometry/triangulateContour.md +26 -0
  349. package/dist/docs/reference/geometry/validateSolidMesh.md +52 -0
  350. package/dist/docs/reference/geometry/validateTransform3.md +43 -0
  351. package/dist/docs/reference/geometry/validateTriangleMesh.md +59 -0
  352. package/dist/docs/reference/geometry.md +30 -0
  353. package/dist/docs/reference/model/Anchor3.md +54 -0
  354. package/dist/docs/reference/model/AttachOptions.md +63 -0
  355. package/dist/docs/reference/model/Bounds2.md +39 -0
  356. package/dist/docs/reference/model/Bounds3.md +39 -0
  357. package/dist/docs/reference/model/BoxEdge.md +15 -0
  358. package/dist/docs/reference/model/BoxEdgeSelection.md +19 -0
  359. package/dist/docs/reference/model/BoxEdgeTreatments.md +20 -0
  360. package/dist/docs/reference/model/BoxOptions.md +92 -0
  361. package/dist/docs/reference/model/ChamferedEdgeTreatment.md +35 -0
  362. package/dist/docs/reference/model/CircleContourOptions.md +21 -0
  363. package/dist/docs/reference/model/CircleOptions.md +21 -0
  364. package/dist/docs/reference/model/CircularPrimitiveOptions.md +64 -0
  365. package/dist/docs/reference/model/Computed.md +35 -0
  366. package/dist/docs/reference/model/ComputedValue.md +20 -0
  367. package/dist/docs/reference/model/Contour.md +22 -0
  368. package/dist/docs/reference/model/CorrespondingComponent.md +46 -0
  369. package/dist/docs/reference/model/CorrespondingContour.md +46 -0
  370. package/dist/docs/reference/model/CorrespondingProfile.md +22 -0
  371. package/dist/docs/reference/model/CorrespondingProfileStation.md +27 -0
  372. package/dist/docs/reference/model/CylinderOptions.md +58 -0
  373. package/dist/docs/reference/model/DiagnosticOptions.md +23 -0
  374. package/dist/docs/reference/model/EdgeTreatment.md +22 -0
  375. package/dist/docs/reference/model/EllipseContourOptions.md +21 -0
  376. package/dist/docs/reference/model/EllipseOptions.md +21 -0
  377. package/dist/docs/reference/model/EndTreatments.md +39 -0
  378. package/dist/docs/reference/model/ExtrudeOptions.md +140 -0
  379. package/dist/docs/reference/model/FinalizedModel.md +121 -0
  380. package/dist/docs/reference/model/FinalizedPart.md +87 -0
  381. package/dist/docs/reference/model/Frame3.md +63 -0
  382. package/dist/docs/reference/model/GenerateCallback.md +37 -0
  383. package/dist/docs/reference/model/GenerateContext.md +277 -0
  384. package/dist/docs/reference/model/GeneratedPart.md +93 -0
  385. package/dist/docs/reference/model/GenerationDiagnostic.md +41 -0
  386. package/dist/docs/reference/model/GenerationError.md +54 -0
  387. package/dist/docs/reference/model/GeometryResolution.md +70 -0
  388. package/dist/docs/reference/model/GeometrySamplingLimits.md +62 -0
  389. package/dist/docs/reference/model/GeometryToleranceOptions.md +46 -0
  390. package/dist/docs/reference/model/GridPatternOptions.md +43 -0
  391. package/dist/docs/reference/model/HeightfieldOptions.md +67 -0
  392. package/dist/docs/reference/model/HelicalThreadRidgeMeshOptions.md +140 -0
  393. package/dist/docs/reference/model/HelicalThreadSolidMeshPreflight.md +58 -0
  394. package/dist/docs/reference/model/HullOptions.md +72 -0
  395. package/dist/docs/reference/model/ImmutableBuffer-type.md +80 -0
  396. package/dist/docs/reference/model/ImmutableTriangleMesh.md +34 -0
  397. package/dist/docs/reference/model/ImplicitOptions.md +83 -0
  398. package/dist/docs/reference/model/InternalThreadCutterOptions.md +245 -0
  399. package/dist/docs/reference/model/LinearPatternOptions.md +31 -0
  400. package/dist/docs/reference/model/LoftCorrespondence.md +27 -0
  401. package/dist/docs/reference/model/LoftOptions.md +91 -0
  402. package/dist/docs/reference/model/LoftPlacement.md +73 -0
  403. package/dist/docs/reference/model/LoftStation.md +35 -0
  404. package/dist/docs/reference/model/MatchProfilesOptions.md +35 -0
  405. package/dist/docs/reference/model/ModelProgram.md +44 -0
  406. package/dist/docs/reference/model/ModelingLimits.md +126 -0
  407. package/dist/docs/reference/model/NumericArray.md +7 -0
  408. package/dist/docs/reference/model/PartGeometry.md +16 -0
  409. package/dist/docs/reference/model/PartOptions.md +65 -0
  410. package/dist/docs/reference/model/PathNormalGuide.md +45 -0
  411. package/dist/docs/reference/model/PathPatternOptions.md +47 -0
  412. package/dist/docs/reference/model/PatternSource.md +26 -0
  413. package/dist/docs/reference/model/PlaneOptions.md +39 -0
  414. package/dist/docs/reference/model/Polygon-type.md +43 -0
  415. package/dist/docs/reference/model/PolygonOptions.md +112 -0
  416. package/dist/docs/reference/model/PrimitivePlacement.md +40 -0
  417. package/dist/docs/reference/model/PrimitivePlacementOptions.md +88 -0
  418. package/dist/docs/reference/model/PrintableThreadFit.md +14 -0
  419. package/dist/docs/reference/model/PrintableThreadFitPolicy.md +50 -0
  420. package/dist/docs/reference/model/Profile.md +22 -0
  421. package/dist/docs/reference/model/ProfileComponent2.md +46 -0
  422. package/dist/docs/reference/model/ProfileContour2.md +34 -0
  423. package/dist/docs/reference/model/ProfileSpan2.md +47 -0
  424. package/dist/docs/reference/model/ProfiledEdgeTreatment.md +41 -0
  425. package/dist/docs/reference/model/RadialPatternOptions.md +63 -0
  426. package/dist/docs/reference/model/RadialSizing.md +15 -0
  427. package/dist/docs/reference/model/RadialSizingOptions.md +40 -0
  428. package/dist/docs/reference/model/RectangleContourOptions.md +72 -0
  429. package/dist/docs/reference/model/RectangleCornerTreatment.md +40 -0
  430. package/dist/docs/reference/model/RectangleCornerTreatments.md +20 -0
  431. package/dist/docs/reference/model/RectangleOptions.md +107 -0
  432. package/dist/docs/reference/model/Region.md +19 -0
  433. package/dist/docs/reference/model/RegionOffsetJoin.md +16 -0
  434. package/dist/docs/reference/model/RegionOffsetOptions.md +65 -0
  435. package/dist/docs/reference/model/RegularPolygonOptions.md +53 -0
  436. package/dist/docs/reference/model/RevolveOptions.md +89 -0
  437. package/dist/docs/reference/model/RoundedEdgeTreatment.md +96 -0
  438. package/dist/docs/reference/model/Section.md +450 -0
  439. package/dist/docs/reference/model/SectionHullOptions.md +72 -0
  440. package/dist/docs/reference/model/SectionInspection.md +98 -0
  441. package/dist/docs/reference/model/SmoothEdgeTreatment.md +76 -0
  442. package/dist/docs/reference/model/Solid.md +350 -0
  443. package/dist/docs/reference/model/SolidInspection.md +98 -0
  444. package/dist/docs/reference/model/SolidRayHit.md +58 -0
  445. package/dist/docs/reference/model/SphereOptions.md +20 -0
  446. package/dist/docs/reference/model/StarOptions.md +98 -0
  447. package/dist/docs/reference/model/SvgOrigin.md +16 -0
  448. package/dist/docs/reference/model/SvgPathSectionOptions.md +78 -0
  449. package/dist/docs/reference/model/SvgSectionOptions.md +66 -0
  450. package/dist/docs/reference/model/SweepOptions.md +116 -0
  451. package/dist/docs/reference/model/SweepOrientation.md +116 -0
  452. package/dist/docs/reference/model/TextSectionOptions.md +41 -0
  453. package/dist/docs/reference/model/ThreadEndStyle.md +14 -0
  454. package/dist/docs/reference/model/ThreadEndTreatmentOptions.md +117 -0
  455. package/dist/docs/reference/model/ThreadHandedness.md +14 -0
  456. package/dist/docs/reference/model/ThreadLeadInEnvelope.md +14 -0
  457. package/dist/docs/reference/model/ThreadLeadInShape.md +14 -0
  458. package/dist/docs/reference/model/ThreadProfile.md +86 -0
  459. package/dist/docs/reference/model/ThreadRidgeOptions.md +18 -0
  460. package/dist/docs/reference/model/ThreadedNutBevel.md +14 -0
  461. package/dist/docs/reference/model/ThreadedNutOptions.md +273 -0
  462. package/dist/docs/reference/model/ThreadedNutPreflight.md +98 -0
  463. package/dist/docs/reference/model/ThreadedNutShape.md +14 -0
  464. package/dist/docs/reference/model/ThreadedRodOptions.md +245 -0
  465. package/dist/docs/reference/model/TorusOptions.md +110 -0
  466. package/dist/docs/reference/model/Transform2.md +15 -0
  467. package/dist/docs/reference/model/Transform3.md +18 -0
  468. package/dist/docs/reference/model/TriangleMesh.md +42 -0
  469. package/dist/docs/reference/model/TriangleMeshAnalysis.md +123 -0
  470. package/dist/docs/reference/model/TriangleMeshMeasurements.md +79 -0
  471. package/dist/docs/reference/model/TubeOptions.md +143 -0
  472. package/dist/docs/reference/model/Vector2.md +15 -0
  473. package/dist/docs/reference/model/Vector3.md +15 -0
  474. package/dist/docs/reference/model/VectorTextLayout.md +40 -0
  475. package/dist/docs/reference/model/VectorTextMetrics.md +100 -0
  476. package/dist/docs/reference/model/anchor.md +46 -0
  477. package/dist/docs/reference/model/box.md +62 -0
  478. package/dist/docs/reference/model/categories/boolean-operations.md +37 -0
  479. package/dist/docs/reference/model/categories/bounded-surfaces.md +26 -0
  480. package/dist/docs/reference/model/categories/contracts.md +16 -0
  481. package/dist/docs/reference/model/categories/core-values-errors.md +30 -0
  482. package/dist/docs/reference/model/categories/explicit-profiles.md +32 -0
  483. package/dist/docs/reference/model/categories/extrude-revolve-sweep.md +42 -0
  484. package/dist/docs/reference/model/categories/generation.md +44 -0
  485. package/dist/docs/reference/model/categories/inspection.md +23 -0
  486. package/dist/docs/reference/model/categories/mesh-inspection.md +29 -0
  487. package/dist/docs/reference/model/categories/primitives.md +61 -0
  488. package/dist/docs/reference/model/categories/resolution.md +18 -0
  489. package/dist/docs/reference/model/categories/sections.md +59 -0
  490. package/dist/docs/reference/model/categories/threads.md +50 -0
  491. package/dist/docs/reference/model/categories/transforms-placement.md +43 -0
  492. package/dist/docs/reference/model/circle.md +39 -0
  493. package/dist/docs/reference/model/components.md +68 -0
  494. package/dist/docs/reference/model/compose.md +31 -0
  495. package/dist/docs/reference/model/cylinder.md +52 -0
  496. package/dist/docs/reference/model/distance.md +45 -0
  497. package/dist/docs/reference/model/ellipse.md +39 -0
  498. package/dist/docs/reference/model/extrude.md +83 -0
  499. package/dist/docs/reference/model/fromRegion.md +33 -0
  500. package/dist/docs/reference/model/generate.md +46 -0
  501. package/dist/docs/reference/model/gridPattern.md +80 -0
  502. package/dist/docs/reference/model/heightfield.md +40 -0
  503. package/dist/docs/reference/model/hull.md +74 -0
  504. package/dist/docs/reference/model/immutableBuffer.md +44 -0
  505. package/dist/docs/reference/model/immutableMesh.md +40 -0
  506. package/dist/docs/reference/model/implicit.md +47 -0
  507. package/dist/docs/reference/model/inspectSection.md +38 -0
  508. package/dist/docs/reference/model/inspectSolid.md +38 -0
  509. package/dist/docs/reference/model/internalThreadCutter.md +100 -0
  510. package/dist/docs/reference/model/intersect.md +70 -0
  511. package/dist/docs/reference/model/isEmpty.md +39 -0
  512. package/dist/docs/reference/model/linearPattern.md +80 -0
  513. package/dist/docs/reference/model/loft.md +137 -0
  514. package/dist/docs/reference/model/matchProfiles.md +42 -0
  515. package/dist/docs/reference/model/minkowskiSum.md +37 -0
  516. package/dist/docs/reference/model/pathPattern.md +118 -0
  517. package/dist/docs/reference/model/polygon.md +40 -0
  518. package/dist/docs/reference/model/preflightInternalThreadCutter.md +89 -0
  519. package/dist/docs/reference/model/preflightThreadedNut.md +100 -0
  520. package/dist/docs/reference/model/preflightThreadedRod.md +89 -0
  521. package/dist/docs/reference/model/radialPattern.md +113 -0
  522. package/dist/docs/reference/model/rayCast.md +40 -0
  523. package/dist/docs/reference/model/rectangle.md +59 -0
  524. package/dist/docs/reference/model/regularPolygon.md +39 -0
  525. package/dist/docs/reference/model/revolve.md +74 -0
  526. package/dist/docs/reference/model/solidFromMesh.md +42 -0
  527. package/dist/docs/reference/model/sphere.md +42 -0
  528. package/dist/docs/reference/model/split.md +54 -0
  529. package/dist/docs/reference/model/splitByPlane.md +66 -0
  530. package/dist/docs/reference/model/star.md +63 -0
  531. package/dist/docs/reference/model/svgPathSection.md +65 -0
  532. package/dist/docs/reference/model/svgSection.md +64 -0
  533. package/dist/docs/reference/model/sweep.md +92 -0
  534. package/dist/docs/reference/model/textSection.md +57 -0
  535. package/dist/docs/reference/model/threadRidge.md +72 -0
  536. package/dist/docs/reference/model/threadedNut.md +110 -0
  537. package/dist/docs/reference/model/threadedRod.md +99 -0
  538. package/dist/docs/reference/model/toRegion.md +33 -0
  539. package/dist/docs/reference/model/toTriangleMesh.md +27 -0
  540. package/dist/docs/reference/model/torus.md +70 -0
  541. package/dist/docs/reference/model/tube.md +77 -0
  542. package/dist/docs/reference/model/union.md +72 -0
  543. package/dist/docs/reference/model.md +39 -0
  544. package/dist/docs/reference/text/Bounds2.md +34 -0
  545. package/dist/docs/reference/text/MAX_VECTOR_FONT_BYTES.md +7 -0
  546. package/dist/docs/reference/text/Vector2.md +7 -0
  547. package/dist/docs/reference/text/VectorFont.md +186 -0
  548. package/dist/docs/reference/text/VectorFontOptions.md +17 -0
  549. package/dist/docs/reference/text/VectorTextArcBaseline.md +53 -0
  550. package/dist/docs/reference/text/VectorTextLayout.md +34 -0
  551. package/dist/docs/reference/text/VectorTextLayoutOptions.md +111 -0
  552. package/dist/docs/reference/text/VectorTextMetrics.md +94 -0
  553. package/dist/docs/reference/text/VectorTextOptions.md +50 -0
  554. package/dist/docs/reference/text/categories/font-preparation.md +38 -0
  555. package/dist/docs/reference/text/prepareVectorFont.md +46 -0
  556. package/dist/docs/reference/text.md +21 -0
  557. package/dist/engine/construction-operations.js +10 -3
  558. package/dist/engine/deferred-context.js +12 -3
  559. package/dist/engine/execution.js +1 -1
  560. package/dist/engine/export-3mf.js +2 -2
  561. package/dist/engine/finalization.js +3 -3
  562. package/dist/engine/loft-operations.js +4 -4
  563. package/dist/engine/native/adapter.js +1 -1
  564. package/dist/engine/native/regions.js +9 -9
  565. package/dist/engine/pattern-operations.js +24 -13
  566. package/dist/engine/pattern-transform.js +9 -0
  567. package/dist/engine/placement.js +2 -2
  568. package/dist/engine/primitive-operations.js +10 -10
  569. package/dist/engine/profile-mesh.js +7 -7
  570. package/dist/engine/section-operations.js +25 -14
  571. package/dist/engine/session-graph.js +5 -3
  572. package/dist/engine/session.js +1 -2
  573. package/dist/geometry/bounds.js +117 -0
  574. package/dist/geometry/cylinder.js +5 -1
  575. package/dist/geometry/edge-finishing.js +2 -2
  576. package/dist/geometry/heightfield.js +1 -1
  577. package/dist/geometry/index.js +15 -12
  578. package/dist/geometry/{loft-correspondence.js → loft/loft-correspondence.js} +3 -3
  579. package/dist/geometry/{loft-geometry.js → loft/loft-geometry.js} +8 -8
  580. package/dist/geometry/{loft-options.js → loft/loft-options.js} +2 -2
  581. package/dist/geometry/{loft-simple-mesh.js → loft/loft-simple-mesh.js} +6 -6
  582. package/dist/geometry/{loft-triangulation.js → loft/loft-triangulation.js} +6 -6
  583. package/dist/geometry/{loft.js → loft/loft.js} +8 -8
  584. package/dist/geometry/math/vector3.js +5 -1
  585. package/dist/geometry/mechanical/gears.js +2 -2
  586. package/dist/geometry/mechanical/thread-mesh.js +3 -3
  587. package/dist/geometry/mechanical/thread-profiles.js +2 -2
  588. package/dist/geometry/mechanical/thread-surface.js +14 -5
  589. package/dist/geometry/{mesh-centroid.js → mesh/mesh-centroid.js} +1 -1
  590. package/dist/geometry/{mesh-planar.js → mesh/mesh-planar.js} +1 -1
  591. package/dist/geometry/{mesh-quality.js → mesh/mesh-quality.js} +2 -2
  592. package/dist/geometry/{mesh-signature.js → mesh/mesh-signature.js} +2 -2
  593. package/dist/geometry/{mesh-solid.js → mesh/mesh-solid.js} +2 -2
  594. package/dist/geometry/{mesh.js → mesh/mesh.js} +7 -8
  595. package/dist/geometry/paths/frames.js +4 -5
  596. package/dist/geometry/patterns/options.js +1 -0
  597. package/dist/{engine/pattern-placements.js → geometry/patterns/placements.js} +22 -8
  598. package/dist/geometry/patterns.js +25 -0
  599. package/dist/geometry/primitive-resolvers.js +9 -9
  600. package/dist/geometry/profiles/contour.js +3 -3
  601. package/dist/geometry/profiles/matched.js +3 -3
  602. package/dist/geometry/profiles/profiles.js +10 -10
  603. package/dist/geometry/profiles/rectangle.js +7 -7
  604. package/dist/geometry/profiles/shapes.js +9 -9
  605. package/dist/geometry/profiles/side-profile.js +37 -0
  606. package/dist/geometry/regions.js +15 -15
  607. package/dist/geometry/revolve/revolve-mesh.js +5 -5
  608. package/dist/geometry/stroke-path.js +2 -2
  609. package/dist/geometry/svg/errors.js +0 -3
  610. package/dist/geometry/svg/fill.js +7 -7
  611. package/dist/geometry/svg/index.js +1 -1
  612. package/dist/geometry/svg/matrix.js +0 -114
  613. package/dist/geometry/svg/parser.js +1 -439
  614. package/dist/geometry/svg-import.js +3 -3
  615. package/dist/geometry/sweeps/sweep-closed.js +1 -1
  616. package/dist/geometry/sweeps/sweep-mesh.js +1 -1
  617. package/dist/geometry/sweeps/sweep-open.js +3 -3
  618. package/dist/geometry/sweeps/validation.js +2 -2
  619. package/dist/geometry/text-fitting.js +85 -0
  620. package/dist/geometry/tolerance.js +2 -2
  621. package/dist/geometry/transform-geometry.js +9 -9
  622. package/dist/model/execution-binding.js +3 -3
  623. package/dist/model/generation.js +1 -1
  624. package/dist/model/operation-contracts.js +1 -0
  625. package/dist/model/operation-dispatch.js +6 -0
  626. package/dist/model/operations.js +19 -49
  627. package/package.json +10 -8
  628. /package/dist/geometry/{mesh-edge-table.js → mesh/mesh-edge-table.js} +0 -0
  629. /package/dist/geometry/{mesh-solid-intersections.js → mesh/mesh-solid-intersections.js} +0 -0
@@ -1,2268 +1,2489 @@
1
- /** Imported modeling operations and opaque host-owned contracts. @packageDocumentation */
2
-
3
- /** ACME 29-degree included-angle profile. */
4
- declare interface AcmeThreadProfileSpec extends ThreadProfileBaseSpec {
5
- /** Selects the 29-degree ACME profile family. */
6
- readonly kind: "acme";
7
- /**
8
- * Radial depth in millimetres.
9
- * @defaultValue `pitch / 2`
10
- */
11
- readonly depth?: number;
12
- }
13
-
14
- /**
15
- * Reads a copied, immutable named anchor from this exact active generation.
16
- *
17
- * @example Read the top datum
18
- * ```ts
19
- * const plate = box({ size: [30, 20, 6] });
20
- * anchor(plate, "top"); // position [0, 0, 3], direction [0, 0, 1]
21
- * ```
22
- */
23
- export declare function anchor(shape: Solid | Section, name: string): Anchor3;
24
-
25
- /**
26
- * An attachment pose on a solid or assembly.
27
- *
28
- * `direction` is the outward attachment normal. `up` controls roll and must not
29
- * be parallel to `direction`; anchor construction projects and normalizes it.
30
- */
31
- export declare interface Anchor3 {
32
- /** Unit outward normal used as the anchor's local +Z direction. */
33
- readonly direction: Vec3;
34
- /** World-space attachment position. */
35
- readonly position: Vec3;
36
- /** Roll guide projected into the plane perpendicular to `direction`. */
37
- readonly up: Vec3;
38
- }
39
-
40
- /**
41
- * Degree-based anchor attachment controls for a scoped solid.
42
- */
43
- export declare interface AttachOptions {
44
- /** Align outward directions face-to-face (`opposed`) or in parallel (`same`). */
45
- readonly alignment?: "opposed" | "same";
46
- /** Separation along the target anchor's outward direction in millimetres. */
47
- readonly gap?: number;
48
- /** Additional right-handed roll about the attached direction, in degrees. */
49
- readonly spinDegrees?: number;
50
- /** Optional numeric comparison overrides. */
51
- readonly tolerance?: GeometryToleranceOptions;
52
- }
53
-
54
- /**
55
- * Axis-aligned box with uniform or disjoint named edge/group treatments.
56
- *
57
- * @example Rounded box
58
- * ```ts
59
- * box({ size: [30, 20, 8], treatment: { kind: "round", radius: 2 } });
60
- * ```
61
- */
62
- export declare function box(options: BoxOptions): Solid;
63
-
64
- /** Box edges use +Z top, +Y front and +X right; vertical names list front/back first. */
65
- export declare type BoxEdge = "top-front" | "top-back" | "top-left" | "top-right" | "bottom-front" | "bottom-back" | "bottom-left" | "bottom-right" | "front-left" | "front-right" | "back-left" | "back-right";
66
-
67
- /** Named individual edges or top/bottom rims and all four vertical edges. */
68
- export declare type BoxEdgeSelection = BoxEdge | "top" | "bottom" | "vertical";
69
-
70
- /** Independent treatments for disjoint named edge selections; overlapping selections fail. */
71
- export declare type BoxEdgeTreatments = Readonly<Partial<Record<BoxEdgeSelection, EdgeTreatment>>>;
72
-
73
- /**
74
- * Dimensions, placement, and uniform or independently selected finishing for an axis-aligned box.
75
- */
76
- export declare interface BoxOptions extends PrimitivePlacement {
77
- /** Explicit sampling ceilings for edge treatments, bounded by the host policy. */
78
- readonly limits?: Partial<GeometrySamplingLimits>;
79
- /**
80
- * Centers the box on the XYZ origin when `true`; otherwise its minimum corner is at the origin.
81
- * @defaultValue `true`
82
- */
83
- readonly center?: boolean;
84
- /** Positive uniform size or explicit `[X, Y, Z]` extents in millimetres. */
85
- readonly size: number | Vec3;
86
- /** Uniform treatment or independent disjoint nominal edge/group treatments. */
87
- readonly treatment?: EdgeTreatment | BoxEdgeTreatments;
88
- }
89
-
90
- /** Axial side carrying the near-normal pressure flank of a buttress thread. */
91
- declare type ButtressPressureFlankSide = "negative" | "positive";
92
-
93
- /** Asymmetric printable buttress profile with 7/45-degree flanks. */
94
- declare interface ButtressThreadProfileSpec extends ThreadProfileBaseSpec {
95
- /** Selects the asymmetric printable buttress profile family. */
96
- readonly kind: "buttress";
97
- /**
98
- * Radial depth in millimetres.
99
- * @defaultValue `0.66271 * pitch`
100
- */
101
- readonly depth?: number;
102
- /**
103
- * Axial side of each tooth carrying the 7-degree pressure flank. The opposite side uses the
104
- * 45-degree clearance flank.
105
- * @defaultValue `"positive"`
106
- */
107
- readonly pressureFlankSide?: ButtressPressureFlankSide;
108
- }
109
-
110
- /**
111
- * A planar edge or corner chamfer with equal or independent surface setbacks.
112
- */
113
- export declare interface ChamferedEdgeTreatment {
114
- /** Selects a straight bevel between adjoining surfaces. */
115
- readonly kind: "chamfer";
116
- /** Positive tangent setbacks in millimetres, equal or [first surface, second surface]; selected treatments must fit without overlap. */
117
- readonly distance: number | readonly [first: number, second: number];
118
- }
119
-
120
- /**
121
- * Centered circular section.
122
- *
123
- * @example Size to polygon faces
124
- * ```ts
125
- * circle({ diameter: 12, sizing: "face" });
126
- * ```
127
- */
128
- export declare function circle(options: CircleOptions): Section;
129
-
130
- /**
131
- * Circular profile dimensions with exactly one radius or diameter and explicit sampling.
132
- */
133
- export declare type CircleLoopOptions = CircularPrimitiveOptions & RadialSizingOptions & ({
134
- /** Positive nominal radius in millimetres; mutually exclusive with diameter. */
135
- readonly radius: number;
136
- /** Full diameter is unavailable when radius is supplied. */
137
- readonly diameter?: never;
138
- } | {
139
- /** Positive full diameter in millimetres; mutually exclusive with radius. */
140
- readonly diameter: number;
141
- /** Radius is unavailable when diameter is supplied. */
142
- readonly radius?: never;
143
- });
144
-
145
- /**
146
- * Circular dimensions with exactly one nominal radius or diameter.
147
- */
148
- export declare type CircleOptions = CircleLoopOptions & PrimitivePlacement;
149
-
150
- /**
151
- * Tessellation controls shared by circular primitives across Geometry entry points.
152
- */
153
- export declare interface CircularPrimitiveOptions {
154
- /** Explicit sampling ceilings; bound modeling operations may only lower the host policy. */
155
- readonly limits?: Partial<GeometrySamplingLimits>;
156
- /**
157
- * Exact circumferential segment count from three through the configured safety limit.
158
- *
159
- * This local topology override takes precedence over {@link CircularPrimitiveOptions.resolution}
160
- * and any active model-wide resolution policy.
161
- */
162
- readonly segments?: number;
163
- /** Operation-level physical tessellation policy over the active model-wide policy. */
164
- readonly resolution?: GeometryResolution;
165
- }
166
-
167
- /**
168
- * Separates a solid's disconnected surface shells into same-session solid handles.
169
- *
170
- * For solids without enclosed cavities, these shells are the disconnected material islands.
171
- * Enclosed cavities produce separate inward shells with negative signed volume; these cannot
172
- * be finalized alone as manufacturing parts. This does not cut connected geometry.
173
- *
174
- * @example Move disconnected pieces independently
175
- * ```ts
176
- * const islands = union([box({ size: 8 }), box({ size: 8 }).translate([12, 0, 0])]);
177
- * const pieces = components(islands);
178
- * // Component order is unspecified; the index only sets a display height here.
179
- * union(pieces.map((piece, index) => piece.translate([0, 0, index * 6])));
180
- * ```
181
- */
182
- export declare function components(solid: Solid): readonly Solid[];
183
-
184
- /** Separates filled 2D islands into sections, retaining each island's holes; empty gives []. */
185
- export declare function components(section: Section): readonly Section[];
186
-
187
- /** Combines disjoint components without resolving overlap. */
188
- export declare function compose(solids: readonly Solid[]): Solid;
189
-
190
- /** A lazy session-owned reader. Calling it tracks its output in the current computation. */
191
- export declare interface Computed<T> {
192
- /** Compile-time ownership brand; readers are created by the engine's context helper. */
193
- readonly [computedBrand]: "Computed";
194
- /** Reads immutable data or a deferred recipe; evaluation is synchronous and cached. */
195
- (): T;
196
- }
197
-
198
- declare const computedBrand: unique symbol;
199
-
200
- /** A value supplied immediately or by a lazy computed reader. */
201
- export declare type ComputedValue<T> = T | Computed<T>;
202
-
203
- /** One sampled component retaining contour identities and logical point correspondence. */
204
- export declare interface CorrespondingComponent {
205
- /** Stable canonical lowercase identity; unique within the containing topology or output. */
206
- readonly id: string;
207
- /** Counterclockwise outer contour. */
208
- readonly outer: CorrespondingContour;
209
- /** Clockwise hole contours belonging to this component. */
210
- readonly holes: readonly CorrespondingContour[];
211
- }
212
-
213
- /** A sampled contour retaining logical slots, including intentionally collapsed spans. */
214
- export declare interface CorrespondingContour {
215
- /** Stable canonical lowercase identity; unique within the containing topology or output. */
216
- readonly id: string;
217
- /** Ordered sampled points in millimetres; closing vertices are implicit. */
218
- readonly points: Loop2;
219
- /** One span identity per point; indices correspond between every matched family member. */
220
- readonly spans: readonly string[];
221
- }
222
-
223
- /** Shared logical contour sampling suitable for a loft or hollow sweep. */
224
- export declare interface CorrespondingProfile {
225
- /** Ordered components with explicit contour identities. */
226
- readonly components: readonly CorrespondingComponent[];
227
- }
228
-
229
- /** One already matched profile at an explicit height or right-handed spatial frame. */
230
- export declare type CorrespondingProfileStation = LoftPlacement & {
231
- /** Already corresponding filled contours with authoritative landmark slots. */
232
- readonly profile: CorrespondingProfile;
233
- };
234
-
235
- /** Caller-defined periodic axial/radial profile in millimetres. */
236
- declare interface CustomThreadProfileSpec extends ThreadProfileBaseSpec {
237
- /** Selects a caller-defined periodic profile. */
238
- readonly kind: "custom";
239
- /**
240
- * Open path spanning exactly `[-pitch/2, pitch/2]`, with both endpoints on the minor envelope,
241
- * one connected ridge, one contiguous crest, and radial zero at the major envelope.
242
- */
243
- readonly points: readonly Vec2[];
244
- }
245
-
246
- /**
247
- * +Z cylinder or frustum. Face sizing compensates polygon faceting.
248
- *
249
- * @example Cylinder
250
- * ```ts
251
- * cylinder({ height: 20, radius: 10 });
252
- * ```
253
- *
254
- * @example Cone
255
- * ```ts
256
- * cylinder({ height: 20, radius: [10, 0] });
257
- * ```
258
- */
259
- export declare function cylinder(options: CylinderOptions): Solid;
260
-
261
- /**
262
- * Dimensions, placement, independent end finishing, and tessellation for a Z-axis cylinder or frustum.
263
- */
264
- export declare type CylinderOptions = CircularPrimitiveOptions & RadialSizingOptions & PrimitivePlacement & {
265
- /**
266
- * Centers the solid on the Z origin when `true`; otherwise its bottom is at `Z = 0`.
267
- * @defaultValue `true`
268
- */
269
- readonly center?: boolean;
270
- /** Independent end treatments; first setback is cap inset and second follows the sloped side. */
271
- readonly ends?: EndTreatments;
272
- /** Total height along +Z in millimetres. */
273
- readonly height: number;
274
- } & ({
275
- /** Positive uniform radius or nonnegative `[bottom, top]` radii in millimetres; one must be positive. */
276
- readonly radius: number | readonly [bottom: number, top: number];
277
- /** Full diameter is unavailable when radius is supplied. */
278
- readonly diameter?: never;
279
- } | {
280
- /** Positive uniform diameter or nonnegative `[bottom, top]` diameters in millimetres; one must be positive. */
281
- readonly diameter: number | readonly [bottom: number, top: number];
282
- /** Radius is unavailable when diameter is supplied. */
283
- readonly radius?: never;
284
- });
285
-
286
- /** Typed parameter association for an assertion or warning. */
287
- export declare interface DiagnosticOptions<P> {
288
- /** Existing top-level parameter key. */
289
- readonly parameterId?: Extract<keyof P, string> | undefined;
290
- }
291
-
292
- /**
293
- * Measures the minimum separation between two nonempty solids in millimetres.
294
- *
295
- * Uses actual geometry, not bounding-box separation or distance between object origins.
296
- * Contact or overlapping material returns zero, including one solid inside another.
297
- * The kernel's search range is managed internally; the result is not capped at a caller limit.
298
- * Empty, expired or foreign-build handles reject. Results follow native numeric precision.
299
- *
300
- * @example Measure the gap between two blocks
301
- * ```ts
302
- * const left = box({ size: 10 });
303
- * const right = box({ size: 10 }).translate([13, 0, 0]);
304
- * const gap = distance(left, right); // 3 mm
305
- * ```
306
- */
307
- export declare function distance(solid: Solid, other: Solid): number;
308
-
309
- /**
310
- * Uniform finishing vocabulary shared by applicable solid edges and profile corners.
311
- */
312
- export declare type EdgeTreatment = ChamferedEdgeTreatment | RoundedEdgeTreatment | SmoothEdgeTreatment | ProfiledEdgeTreatment;
313
-
314
- /**
315
- * Centered elliptical section.
316
- *
317
- * @example Ellipse by full dimensions
318
- * ```ts
319
- * ellipse({ size: [30, 20] });
320
- * ```
321
- */
322
- export declare function ellipse(options: EllipseOptions): Section;
323
-
324
- /**
325
- * Ellipse dimensions with exactly one XY radii or full-size tuple and explicit sampling.
326
- */
327
- export declare type EllipseLoopOptions = CircularPrimitiveOptions & ({
328
- /** Positive XY radii in millimetres; mutually exclusive with size. */
329
- readonly radius: Vec2;
330
- /** Full XY extents are unavailable when radius is supplied. */
331
- readonly size?: never;
332
- } | {
333
- /** Positive full XY extents in millimetres; mutually exclusive with radius. */
334
- readonly size: Vec2;
335
- /** XY radii are unavailable when size is supplied. */
336
- readonly radius?: never;
337
- });
338
-
339
- /**
340
- * Ellipse dimensions in local XY, with exactly one radii or full-size tuple.
341
- */
342
- export declare type EllipseOptions = EllipseLoopOptions & PrimitivePlacement;
343
-
344
- /**
345
- * Independent inward finishing on primitive or straight convex extrusion ends.
346
- */
347
- export declare interface EndTreatments {
348
- /** Bottom cap and adjoining side; omitted leaves the end untreated. */
349
- readonly bottom?: EdgeTreatment;
350
- /** Top cap and adjoining side; omitted leaves the end untreated. */
351
- readonly top?: EdgeTreatment;
352
- }
353
-
354
- /**
355
- * Extrudes explicit corresponding contours along +Z with degree twist and top scaling.
356
- * Filled Sections use `section.extrude(options)`.
357
- *
358
- * @example Extrude
359
- * ```ts
360
- * import { extrude, matchProfiles } from "@metamesh/modeling";
361
- * import { rectangleProfile } from "@metamesh/modeling/geometry";
362
- *
363
- * const [profile] = matchProfiles([rectangleProfile({ size: [30, 20] })]);
364
- * extrude(profile!, { height: 8 });
365
- * ```
366
- */
367
- export declare function extrude(shape: CorrespondingProfile, options: ExtrudeOptions): Solid;
368
-
369
- /**
370
- * Dimensions and sampling shared by native and pure +Z extrusion.
371
- */
372
- export declare interface ExtrudeOptions extends ExtrusionSamplingOptions {
373
- /** Positive extrusion height in millimetres. */
374
- readonly height: number;
375
- /** Center the extrusion on Z; otherwise its bottom is at zero. Defaults to false. */
376
- readonly center?: boolean;
377
- /** Independent inward end treatments on straight convex single-contour extrusions. */
378
- readonly ends?: EndTreatments;
379
- }
380
-
381
- /** Shared sampling controls for a twisted or scaled linear extrusion. */
382
- declare interface ExtrusionSamplingOptions {
383
- /** Exact number of intermediate profiles, nonnegative; overrides physical sampling. */
384
- readonly divisions?: number;
385
- /** Explicit output and sampling allocation ceilings. */
386
- readonly limits?: Partial<ModelingLimits>;
387
- /** Operation-level physical policy over the nearest model scope. */
388
- readonly resolution?: GeometryResolution;
389
- /** Finite uniform or XY scale of the top profile; defaults to one. */
390
- readonly scaleTop?: number | Vec2;
391
- /** Finite rotation of the top profile about +Z, in degrees; defaults to zero. */
392
- readonly twistDegrees?: number;
393
- }
394
-
395
- /** Finalized manufacturing snapshot. Its arrays are independent of all native values. */
396
- export declare interface FinalizedModel {
397
- /** Ordered finalized manufacturing parts with copied transferable arrays. */
398
- readonly parts: readonly FinalizedPart[];
399
- /** Axis-aligned XYZ bounds in millimetres. */
400
- readonly bounds: MeshBounds;
401
- /** Aggregate counts, unique backing storage, volume, and execution timings. */
402
- readonly stats: {
403
- /** Aggregate position-buffer vertex count. */
404
- readonly vertices: number;
405
- /** Aggregate indexed triangle count. */
406
- readonly triangles: number;
407
- /** Signed enclosed volume of all selected parts in cubic millimetres. */
408
- readonly volumeMm3: number;
409
- /** Unique transferable backing-buffer bytes, counted once across all parts. */
410
- readonly bytes: number;
411
- /** Synchronous callback duration in milliseconds. */
412
- readonly buildMs: number;
413
- /** Manufacturing validation and buffer finalization duration in milliseconds. */
414
- readonly finalizationMs: number;
415
- /** Total callback and finalization duration in milliseconds. */
416
- readonly generationMs: number;
417
- };
418
- }
419
-
420
- /** Copied manufacturing part with facts computed from the finalized mesh. */
421
- export declare interface FinalizedPart extends TriangleMesh {
422
- /** Stable canonical lowercase identity; unique within the containing topology or output. */
423
- readonly id: string;
424
- /** Optional six-digit hex RGB display color. */
425
- readonly color?: string;
426
- /** Fresh validated facts for these exact finalized buffers. */
427
- readonly measurements: TriangleMeshAnalysis;
428
- }
429
-
430
- /** A right-handed orthonormal coordinate frame expressed in world coordinates. */
431
- export declare interface Frame3 {
432
- /** World-space origin of the local frame. */
433
- readonly origin: Vec3;
434
- /** Unit vector defining the local +X axis. */
435
- readonly xAxis: Vec3;
436
- /** Unit vector defining the local +Y axis. */
437
- readonly yAxis: Vec3;
438
- /** Unit vector defining the local +Z axis. */
439
- readonly zAxis: Vec3;
440
- }
441
-
442
- /** Imports explicit region topology once. */
443
- export declare function fromRegion(region: Region2): Section;
444
-
445
- /**
446
- * Defines a typed model without executing it. Use `computed` only for work worth reusing.
447
- *
448
- * @example A simple model
449
- * ```ts
450
- * const model = generate<{ height: number }>(({ params, part, assert }) => {
451
- * assert(params.height > 0, "Height must be positive.");
452
- * return [part("body", box({ size: [10, 10, params.height] }))];
453
- * });
454
- * ```
455
- */
456
- export declare function generate<P, S = Record<never, never>>(callback: GenerateCallback<P, S>): ModelProgram<P, S>;
457
-
458
- /** Pure synchronous generation callback; caches are an optional performance optimization. */
459
- export declare type GenerateCallback<P, S = Record<never, never>> = (context: GenerateContext<P, S>) => readonly GeneratedPart[];
460
-
461
- /** The sole synchronous authoring context, supplied independently of Studio. */
462
- export declare interface GenerateContext<P, S = Record<never, never>> {
463
- /** Frozen ordinary parameter values; synchronous top-level reads are tracked. */
464
- readonly params: Readonly<P>;
465
- /** Host-prepared readonly synchronous capabilities, fixed for the session. */
466
- readonly services: Readonly<S>;
467
- /**
468
- * Registers a lazy pure calculation and automatically tracks parameter and computed-reader reads.
469
- * Optional dependencies add changing outer captures; entries compare with Object.is. Objects and
470
- * arrays must be deeply immutable. An empty list still tracks reads inside the callback.
471
- */
472
- readonly computed: <T>(id: string, callback: () => T, dependencies?: readonly unknown[]) => Computed<T>;
473
- /** Declares a semantic part with identity placement, or explicit placement and appearance. */
474
- readonly part: {
475
- (id: string, geometry: ComputedValue<PartGeometry>): GeneratedPart;
476
- (id: string, options: PartOptions): GeneratedPart;
477
- };
478
- /** Immediately aborts on false; geometry observations in the condition run first. */
479
- readonly assert: {
480
- (condition: false, message: string, options?: DiagnosticOptions<P>): never;
481
- (condition: boolean, message: string, options?: DiagnosticOptions<P>): void;
482
- };
483
- /** Records a nonblocking issue; call only in the outer generation callback. */
484
- readonly warn: (message: string, options?: DiagnosticOptions<P>) => void;
485
- }
486
-
487
- /** One declared output part. Construct with the context's `part` helper. */
488
- export declare interface GeneratedPart extends PartOptions {
489
- /** Unique canonical lowercase hyphen-separated identity, at most 64 characters. */
490
- readonly id: string;
491
- }
492
-
493
- /** Structured user-facing issue associated with the attempted revision. */
494
- export declare interface GenerationDiagnostic {
495
- /** An error aborts generation; a warning allows generation to continue. */
496
- readonly severity: "error" | "warning";
497
- /** Human-readable corrective guidance. */
498
- readonly message: string;
499
- /** Optional control identity, validated against the supplied parameters. */
500
- readonly parameterId?: string | undefined;
501
- }
502
-
503
- /** A user-correctable assertion failure. Successful computation caches never retain failures. */
504
- export declare class GenerationError extends Error {
505
- /** Issues reached in normal JavaScript order, ending with the first failed assertion. */
506
- readonly diagnostics: readonly GenerationDiagnostic[];
507
- /** Captures immutable diagnostics; unexpected author errors retain their original type. */
508
- constructor(diagnostics: readonly GenerationDiagnostic[]);
509
- }
510
-
511
- /**
512
- * Tessellation policy for sampled geometry measured in millimetres.
513
- */
514
- export declare interface GeometryResolution {
515
- /** Optional exact full-circle segment count, of at least three, bounded by the selected circular ceiling. */
516
- readonly circularSegments?: number;
517
- /** Maximum radial chord error in millimetres; defaults to 0.05. */
518
- readonly maxChordError?: number;
519
- /** Optional maximum sampled edge length in millimetres. */
520
- readonly maxSegmentLength?: number;
521
- /** Upper safety bound for a full circle; defaults to the selected maxCircularSegments (512 by default). */
522
- readonly maximumSegments?: number;
523
- /** Lower full-circle segment count; defaults to 16 or a lower selected circular ceiling. */
524
- readonly minimumSegments?: number;
525
- }
526
-
527
- /** Explicit allocation ceilings for pure sampling and host-owned modeling operations. */
528
- export declare interface GeometrySamplingLimits {
529
- /** Maximum points in one sampled path or placement/frame result. */
530
- readonly maxPathPoints: number;
531
- /** Maximum aggregate points in one sampled profile or Section. */
532
- readonly maxProfilePoints: number;
533
- /** Maximum points in one profile swept along a path. */
534
- readonly maxSweepProfilePoints: number;
535
- /** Maximum segments around one complete circle. */
536
- readonly maxCircularSegments: number;
537
- }
538
-
539
- /** Optional overrides for MetaMesh's geometry comparison policy. */
540
- export declare interface GeometryToleranceOptions {
541
- /** Absolute distance floor in model units. Must be finite and greater than zero. */
542
- readonly absolute?: number;
543
- /** Angular comparison threshold in radians. Must be finite and greater than zero. */
544
- readonly angular?: number;
545
- /** Dimensionless scale multiplier. Must be finite and non-negative. */
546
- readonly relative?: number;
547
- }
548
-
549
- /**
550
- * XY or XYZ copies, optionally centered or placed in an explicit frame.
551
- *
552
- * @example Centered XY grid
553
- * ```ts
554
- * gridPattern(box({ size: 4 }), { count: [3, 2], spacing: [10, 10], center: true });
555
- * ```
556
- */
557
- export declare function gridPattern(source: PatternSource, options: GridPatternOptions): readonly Solid[];
558
-
559
- /**
560
- * XY or XYZ grid with X varying fastest. The first item starts at the local origin.
561
- */
562
- export declare type GridPatternOptions = {
563
- /** Center the complete distribution around its local origin; defaults to false. */
564
- readonly center?: boolean;
565
- /** Optional right-handed local axes and origin for the grid. */
566
- readonly frame?: Frame3;
567
- } & ({
568
- /** Positive integer counts on X and Y. */
569
- readonly count: Vec2;
570
- /** Signed millimetres between adjacent copies on X and Y. */
571
- readonly spacing: Vec2;
572
- } | {
573
- /** Positive integer counts on X, Y and Z. */
574
- readonly count: Vec3;
575
- /** Signed millimetres between adjacent copies on X, Y and Z. */
576
- readonly spacing: Vec3;
577
- });
578
-
579
- /**
580
- * Closed rectilinear top above a flat base, with uniform or explicit XY coordinates.
581
- * Samples each grid height once; center-error triangulation also samples each cell centre.
582
- *
583
- * @example Heightfield
584
- * ```ts
585
- * heightfield({
586
- * size: [30, 20], segments: [24, 16],
587
- * height: ([x, y]) => 3 + Math.cos(x / 5) * Math.cos(y / 5),
588
- * });
589
- * ```
590
- */
591
- export declare function heightfield(options: HeightfieldOptions): Solid;
592
-
593
- /**
594
- * A closed rectilinear heightfield above a flat base, with uniform or explicit XY samples in millimetres.
595
- *
596
- * Uniform sampling requires positive `size: [width, depth]` and positive integer `segments: [x, y]`.
597
- * Optional `origin` sets the lower-left XY corner; omitting it centres the footprint on XY.
598
- * Alternatively, supply `coordinates: { x, y }` with at least two strictly increasing finite
599
- * absolute samples per axis, distinct in Float32. This infers the footprint and interval counts;
600
- * `size`, `segments`, and `origin` cannot be combined with explicit coordinates.
601
- */
602
- export declare type HeightfieldOptions = {
603
- /** Absolute top Z at the supplied XY point. Every sample must be above baseZ. */
604
- readonly height: (point: Vec2) => number;
605
- /** Flat bottom Z. Defaults to zero. */
606
- readonly baseZ?: number;
607
- /**
608
- * Top-cell diagonal policy. Defaults to fixed (lower-left to upper-right).
609
- * min-edge selects the shorter 3D diagonal; center-error selects the diagonal whose endpoint
610
- * average is closest to one extra height sample at the physical cell centre. Ties use fixed.
611
- * All policies retain two triangles per cell; neither estimates error elsewhere in the cell.
612
- */
613
- readonly triangulation?: "fixed" | "min-edge" | "center-error";
614
- } & ({
615
- /** Positive XY footprint for uniform sampling. */
616
- readonly size: Vec2;
617
- /** Exact positive integer X/Y interval counts. */
618
- readonly segments: readonly [x: number, y: number];
619
- /** Lower-left footprint XY. Omitted centers the footprint on XY. */
620
- readonly origin?: Vec2;
621
- /** Explicit coordinates cannot be combined with uniform sampling. */
622
- readonly coordinates?: never;
623
- } | {
624
- /**
625
- * Absolute XY coordinates, each with at least two strictly increasing finite values that
626
- * remain distinct in Float32. Uneven spacing permits caller-owned local refinement.
627
- */
628
- readonly coordinates: {
629
- /** Absolute X samples in ascending order. */
630
- readonly x: readonly number[];
631
- /** Absolute Y samples in ascending order. */
632
- readonly y: readonly number[];
633
- };
634
- /** The footprint is inferred from explicit coordinates. */
635
- readonly size?: never;
636
- /** Interval counts are inferred from explicit coordinates. */
637
- readonly segments?: never;
638
- /** Explicit coordinates already include their origin. */
639
- readonly origin?: never;
640
- });
641
-
642
- /** Runtime-neutral options for the dedicated helical ridge mesher. */
643
- export declare interface HelicalThreadRidgeMeshOptions {
644
- /**
645
- * Optional bottom/top ridge-end treatments. Standalone ridges honor the requested boundaries;
646
- * BOSL2-style non-cut lead-in scaling is available on complete thread solids.
647
- */
648
- readonly ends?: ThreadEndTreatmentOptions;
649
- /** Helix direction. Default: `right`. */
650
- readonly handedness?: ThreadHandedness;
651
- /** Total threaded axial length in millimetres. */
652
- readonly length: number;
653
- /** Explicit output and circular allocation ceilings. */
654
- readonly limits?: Partial<ModelingLimits>;
655
- /** Nominal major diameter before any caller-owned fit compensation. */
656
- readonly majorDiameter: number;
657
- /** Angular offset of the first start in degrees. Default: `0`. */
658
- readonly phaseDegrees?: number;
659
- /** Validated periodic profile repeated around the shaft. */
660
- readonly profile: ThreadProfile;
661
- /** Optional circular-resolution policy. */
662
- readonly resolution?: GeometryResolution;
663
- /** Number of evenly phased starts. Default: `1`. */
664
- readonly starts?: number;
665
- /** Optional numerical tolerance overrides. */
666
- readonly tolerance?: GeometryToleranceOptions;
667
- }
668
-
669
- /** Conservative allocation facts resolved before constructing a direct thread solid mesh. */
670
- export declare interface HelicalThreadSolidMeshPreflight {
671
- /** Uniform axial intervals required only by a requested physical segment-length limit. */
672
- readonly axialIntervals: number;
673
- /** Start-aligned full-circle segment count used by the surface mesh. */
674
- readonly circularSegments: number;
675
- /** Conservative surface-row count across profile breaks, ends, and bevel stations. */
676
- readonly estimatedRows: number;
677
- /** Conservative triangle count used by the selected output allocation policy. */
678
- readonly estimatedTriangles: number;
679
- }
680
-
681
- /**
682
- * Convex hull of points or solids.
683
- *
684
- * @example Hull
685
- * ```ts
686
- * const left = sphere({ radius: 5 }).translate([-10, 0, 0]);
687
- * const right = sphere({ radius: 5 }).translate([10, 0, 0]);
688
- * hull({ solids: [left, right] });
689
- * ```
690
- */
691
- export declare function hull(options: HullOptions): Solid;
692
-
693
- /** Convex filled XY hull of finite points or same-session sections. */
694
- export declare function hull(options: SectionHullOptions): Section;
695
-
696
- /** Hull inputs are either finite points or same-session solids. */
697
- export declare type HullOptions = {
698
- /** Finite millimetre XYZ points to include in the convex hull. */
699
- readonly points: readonly Vec3[];
700
- /** Point input excludes solid input. */
701
- readonly solids?: never;
702
- } | {
703
- /** Same-build solids to include in the convex hull. */
704
- readonly solids: readonly Solid[];
705
- /** Solid input excludes point input. */
706
- readonly points?: never;
707
- };
708
-
709
- /** Owned immutable numeric data. Use copy() to obtain mutable storage for numerical work. */
710
- export declare interface ImmutableBuffer<T extends NumericArray> {
711
- /** Opaque element-storage brand; construct buffers with immutableBuffer(). */
712
- readonly [immutableBufferBrand]: T;
713
- /** Number of numeric elements, independent of their byte width. */
714
- readonly length: number;
715
- /** Reads an integer offset; negative offsets count from the end. Invalid offsets return undefined. */
716
- at(this: void, index: number): number | undefined;
717
- /** Returns a fresh mutable array of the original numeric type; never exposes cached storage. */
718
- copy(this: void): T;
719
- }
720
-
721
- /**
722
- * Copies numeric data once into private storage. This pure helper needs no active generation.
723
- * @example
724
- * ```ts
725
- * import { immutableBuffer } from "@metamesh/modeling";
726
- * const heights = immutableBuffer(new Float32Array([2, 4, 6]));
727
- * const count = heights.length;
728
- * const first = heights.at(0);
729
- * const editable = heights.copy();
730
- * editable[0] = 8; // heights still contains 2, 4, 6.
731
- * ```
732
- */
733
- export declare function immutableBuffer<T extends NumericArray>(source: T): ImmutableBuffer<T>;
734
-
735
- declare const immutableBufferBrand: unique symbol;
736
-
737
- /**
738
- * Copies mesh buffers into immutable data; geometric validation still occurs when modeling or finalizing.
739
- * @example
740
- * ```ts
741
- * import { generate, immutableMesh } from "@metamesh/modeling";
742
- * import { heightfieldMesh } from "@metamesh/modeling/geometry";
743
- * const model = generate(({ computed, part }) => {
744
- * const surface = computed("surface", () => immutableMesh(heightfieldMesh({
745
- * size: [10, 10], segments: [8, 8], height: () => 2,
746
- * })));
747
- * return [part("surface", surface)];
748
- * });
749
- * ```
750
- */
751
- export declare function immutableMesh(mesh: TriangleMesh): ImmutableTriangleMesh;
752
-
753
- /** Immutable local XYZ positions and triangle indices, suitable for a computed value or part. */
754
- export declare interface ImmutableTriangleMesh {
755
- /** Packed XYZ coordinates in millimetres. */
756
- readonly positions: ImmutableBuffer<Float32Array>;
757
- /** Zero-based vertex indices, three per triangle. */
758
- readonly indices: ImmutableBuffer<Uint32Array>;
759
- }
760
-
761
- /** Bounded positive-inside implicit field constructor. */
762
- export declare function implicit(options: ImplicitOptions): Solid;
763
-
764
- /** Positive-inside sampling, bounded to 4M native BCC grid slots and 8M field calls. */
765
- export declare interface ImplicitOptions {
766
- /** Positive-inside scalar field evaluated at finite XYZ points. */
767
- readonly field: (point: Vec3) => number;
768
- /** Axis-aligned XYZ bounds in millimetres. */
769
- readonly bounds: MeshBounds;
770
- /** Positive sampling edge length in millimetres. */
771
- readonly edgeLength: number;
772
- /** Field isosurface value; defaults to zero. */
773
- readonly level?: number;
774
- /** Positive native geometric tolerance in millimetres; omitted uses interpolated grid crossings. */
775
- readonly tolerance?: number;
776
- }
777
-
778
- /**
779
- * Copies lightweight section measurements.
780
- *
781
- * @example Check filled area
782
- * ```ts
783
- * const facts = inspectSection(rectangle({ size: [20, 10] }));
784
- * facts.area; // 200 mm²
785
- * ```
786
- */
787
- export declare function inspectSection(section: Section): SectionInspection;
788
-
789
- /**
790
- * Reads immutable native facts once per solid; temporary components are owned by the build.
791
- *
792
- * @example Check dimensions and volume
793
- * ```ts
794
- * const facts = inspectSolid(box({ size: [30, 20, 6] }));
795
- * facts.volume; // 3600 mm³
796
- * ```
797
- */
798
- export declare function inspectSolid(solid: Solid): SolidInspection;
799
-
800
- /**
801
- * Compensated internal threaded cutter.
802
- *
803
- * @example Internal thread
804
- * ```ts
805
- * import { cylinder, internalThreadCutter } from "@metamesh/modeling";
806
- * import { createThreadProfile } from "@metamesh/modeling/geometry";
807
- * const profile = createThreadProfile({ kind: "triangular", pitch: 1.75 });
808
- * const body = cylinder({ diameter: 20, height: 12, center: false });
809
- * const cutter = internalThreadCutter({ nominalMajorDiameter: 12, length: 12, profile });
810
- * body.subtract([cutter]);
811
- * ```
812
- */
813
- export declare function internalThreadCutter(options: InternalThreadCutterOptions): Solid;
814
-
815
- /** Options for a compensated internal-thread subtraction tool along +Z. */
816
- export declare interface InternalThreadCutterOptions extends Omit<HelicalThreadRidgeMeshOptions, "majorDiameter">, ThreadBevelOptions {
817
- /** Printable fit or caller-calibrated allowances. Default: `normal`. */
818
- readonly fit?: PrintableThreadFit | PrintableThreadFitPolicy;
819
- /** Nominal major diameter before female compensation and faceting correction. */
820
- readonly nominalMajorDiameter: number;
821
- }
822
-
823
- /**
824
- * Robust intersection.
825
- *
826
- * @example Intersect
827
- * ```ts
828
- * intersect([box({ size: 20 }), sphere({ radius: 12 })]);
829
- * ```
830
- */
831
- export declare function intersect(solids: readonly Solid[]): Solid;
832
-
833
- /** Native filled section intersection; dimensions cannot be mixed. */
834
- export declare function intersect(sections: readonly Section[]): Section;
835
-
836
- /**
837
- * Checks whether a same-session solid or filled section contains no geometry.
838
- *
839
- * Accepts a 3D Solid or 2D Section handle, not a finalized model or raw triangle mesh.
840
- * Useful after a Boolean operation whose inputs may not overlap; no mesh is extracted.
841
- *
842
- * @example Check a missed intersection
843
- * ```ts
844
- * const body = box({ size: 10 });
845
- * const distant = box({ size: 10 }).translate([30, 0, 0]);
846
- * const empty = intersect([body, distant]);
847
- * const missed = isEmpty(empty); // true
848
- * ```
849
- */
850
- export declare function isEmpty(shape: Solid | Section): boolean;
851
-
852
- /**
853
- * Repeats one solid along a normalized direction.
854
- *
855
- * @example Three copies along X
856
- * ```ts
857
- * linearPattern(box({ size: 4 }), { count: 3, spacing: 10 });
858
- * ```
859
- */
860
- export declare function linearPattern(source: PatternSource, options: LinearPatternOptions): readonly Solid[];
861
-
862
- /**
863
- * Equal linear intervals determined by exactly two of count, spacing and total length.
864
- */
865
- export declare type LinearPatternOptions = {
866
- /** Direction of repetition; magnitude is ignored. Defaults to +X. */
867
- readonly direction?: Vec3;
868
- } & ({
869
- /** Positive copy count, including the original. */
870
- readonly count: number;
871
- /** Signed nonzero millimetres between adjacent copies. */
872
- readonly spacing: number;
873
- /** Determined by count and spacing. */
874
- readonly length?: never;
875
- } | {
876
- /** Positive copy count, including the original. */
877
- readonly count: number;
878
- /** Signed millimetres from first to last copy; zero only for one copy. */
879
- readonly length: number;
880
- /** Determined by count and length. */
881
- readonly spacing?: never;
882
- } | {
883
- /** Signed nonzero millimetres between adjacent copies. */
884
- readonly spacing: number;
885
- /** Signed first-to-last millimetres; a nonnegative whole multiple of spacing. */
886
- readonly length: number;
887
- /** Determined by spacing and length. */
888
- readonly count?: never;
889
- });
890
-
891
- /**
892
- * Lofts primitive Sections at z heights or frames; arbitrary Sections and loops require an explicit correspondence method.
893
- *
894
- * @example Loft
895
- * ```ts
896
- * loft([
897
- * { profile: circle({ diameter: 16 }), z: 0 },
898
- * { profile: rectangle({ size: [30, 20], treatment: { kind: "round", radius: 3 } }), z: 30 },
899
- * ]);
900
- * ```
901
- */
902
- export declare function loft(stations: readonly LoftStation[], options?: LoftOptions): Solid;
903
-
904
- /** Lofts explicit corresponding contours, including holes and collapsed logical slots. */
905
- export declare function loft(stations: readonly CorrespondingProfileStation[], options?: LoftOptions): Solid;
906
-
907
- /**
908
- * Associates ordered loft contours without inferring component identities or repairing topology.
909
- *
910
- * - `direct` preserves seams and subdivides edges to a common count without dropping vertices.
911
- * - `reindex` applies direct subdivision, then selects the next contour's cyclic phase with the
912
- * least total world-space connection length.
913
- * - `fast-distance` preserves supplied seams and minimizes connection length over ordered closed
914
- * vertex associations, repeating vertices for triangular fans.
915
- * - `distance` runs the same ordered optimization over every cyclic phase of the next contour.
916
- *
917
- * Components and holes are paired by their existing order. Use identified profiles when semantic
918
- * correspondence must remain authoritative.
919
- */
920
- export declare type LoftCorrespondence = "direct" | "reindex" | "fast-distance" | "distance";
921
-
922
- /**
923
- * Shared controls for native and pure lofts. Point data and arbitrary Sections require explicit correspondence.
924
- */
925
- export declare interface LoftOptions {
926
- /** One method or one per consecutive station gap. Omitted preserves known landmarks, including circle/ellipse-to-rectangle corners, or maps other unlike primitive seams directly. */
927
- readonly correspondence?: LoftCorrespondence | readonly LoftCorrespondence[];
928
- /** Extra points follow edge length or distribute equally across existing segments. Defaults to perimeter for direct/reindex, or segments when any distance method is selected; distance methods require segments. */
929
- readonly distribution?: "perimeter" | "segments";
930
- /** Positive integer point-density multiplier, uniformly or per input profile. Original vertices are retained. Defaults to one. */
931
- readonly refine?: number | readonly number[];
932
- /** Nonnegative count of world-linearly interpolated profiles, uniformly or per gap. Defaults to zero. */
933
- readonly slices?: number | readonly number[];
934
- /** Physical curve policy for retained primitives, and maximum edge length for point data. Exact primitive curve counts take precedence. */
935
- readonly resolution?: GeometryResolution;
936
- /** Explicit output and sampling budgets; native operations may only lower host ceilings. */
937
- readonly limits?: Partial<ModelingLimits>;
938
- }
939
-
940
- /**
941
- * A horizontal XY station height, or an explicit right-handed spatial frame, never both.
942
- */
943
- export declare type LoftPlacement = {
944
- /** Horizontal XY station height in millimetres. */
945
- readonly z: number;
946
- /** Excluded when a horizontal height is supplied. */
947
- readonly frame?: never;
948
- } | {
949
- /** Right-handed orthonormal station frame in world coordinates. */
950
- readonly frame: Frame3;
951
- /** Excluded when an explicit spatial frame is supplied. */
952
- readonly z?: never;
953
- };
954
-
955
- /**
956
- * A Section or point loop at an explicit height or frame.
957
- */
958
- export declare type LoftStation = LoftPlacement & {
959
- /** Same-build filled Section or ordered XY boundary point data. */
960
- readonly profile: Section | Loop2;
961
- };
962
-
963
- /**
964
- * A closed two-dimensional boundary whose first point is not repeated at the end.
965
- *
966
- * Polygon exteriors are counter-clockwise and holes are clockwise. Algorithms
967
- * may reject duplicate adjacent points or fewer than three effective vertices.
968
- */
969
- export declare type Loop2 = readonly Vec2[];
970
-
971
- /** Explicit family matching on a shared physical span grid using session or operation resolution. */
972
- export declare function matchProfiles(profiles: readonly Profile[], options?: MatchProfilesOptions): readonly CorrespondingProfile[];
973
-
974
- /** Explicit family sampling settings; omitted values use physical package defaults. */
975
- export declare interface MatchProfilesOptions {
976
- /** Local physical sampling policy; exact interval counts take precedence. */
977
- readonly resolution?: GeometryResolution;
978
- /** Explicit per-profile and circular ceilings; the family also has a one-million-slot work bound. */
979
- readonly limits?: Partial<GeometrySamplingLimits>;
980
- }
981
-
982
- /**
983
- * Axis-aligned bounds of a non-empty triangle mesh.
984
- */
985
- export declare interface MeshBounds {
986
- /** Inclusive minimum XYZ coordinates. */
987
- readonly min: Vec3;
988
- /** Inclusive maximum XYZ coordinates. */
989
- readonly max: Vec3;
990
- }
991
-
992
- /** Three-dimensional Minkowski sum. */
993
- export declare function minkowskiSum(a: Solid, b: Solid): Solid;
994
-
995
- /** Aggregate manufacturing output ceilings selected by a trusted host. */
996
- export declare interface ModelingLimits extends GeometrySamplingLimits {
997
- /** Maximum number of named finalized parts. */
998
- readonly maxParts: number;
999
- /** Maximum aggregate output vertex count. */
1000
- readonly maxVertices: number;
1001
- /** Maximum aggregate output triangle count. */
1002
- readonly maxTriangles: number;
1003
- /** Maximum unique transferable output backing-buffer bytes. */
1004
- readonly maxBytes: number;
1005
- }
1006
-
1007
- /** Stateless portable program descriptor. Execution and caches belong to an engine session. */
1008
- export declare interface ModelProgram<P, S = Record<never, never>> {
1009
- /** Exact generation protocol discriminator. */
1010
- readonly kind: "metamesh-model";
1011
- /** Typed synchronous declaration callback. */
1012
- readonly generate: GenerateCallback<P, S>;
1013
- }
1014
-
1015
- /** Numeric storage supported by immutable generation buffers. */
1016
- export declare type NumericArray = Float32Array | Float64Array | Uint32Array | Uint8Array | Int32Array;
1017
-
1018
- /** Manufacturing geometry; filled sections are intermediate construction values. */
1019
- export declare type PartGeometry = Solid | TriangleMesh | ImmutableTriangleMesh;
1020
-
1021
- /** Appearance and rigid placement of a finished local manufacturing part. */
1022
- export declare interface PartOptions {
1023
- /** Local geometry or a lazy reader; native objects never cross a revision. */
1024
- readonly geometry: ComputedValue<PartGeometry>;
1025
- /** XYZ translation in millimetres, applied after rotation; defaults to zero. */
1026
- readonly position?: ComputedValue<Vec3>;
1027
- /** Fixed global X, Y, Z rotations in degrees; defaults to zero. */
1028
- readonly rotation?: ComputedValue<Vec3>;
1029
- /** Optional six-digit hexadecimal semantic part color. */
1030
- readonly color?: string;
1031
- }
1032
-
1033
- /**
1034
- * Supplies a profile-X orientation guide for each original normalized sweep station.
1035
- *
1036
- * @param point - Current XYZ path point in model units.
1037
- * @param index - Zero-based index of `point` in the normalized authored sweep path.
1038
- * @returns A finite guide vector that is not parallel to the local path tangent.
1039
- */
1040
- export declare type PathNormalGuide = (point: Vec3, index: number) => Vec3;
1041
-
1042
- /**
1043
- * Physical arc-length copies along a sampled path, with optional tangent orientation.
1044
- *
1045
- * @example Copies along a bent path
1046
- * ```ts
1047
- * pathPattern(box({ size: 4 }), [[0, 0, 0], [20, 0, 0], [20, 20, 0]], { count: 5 });
1048
- * ```
1049
- */
1050
- export declare function pathPattern(source: PatternSource, path: readonly Vec3[], options: PathPatternOptions): readonly Solid[];
1051
-
1052
- /** Equal physical arc-length placements along an open or implicitly closed sampled path. */
1053
- export declare interface PathPatternOptions {
1054
- /** Positive number of copies; open paths include both endpoints when greater than one. */
1055
- readonly count: number;
1056
- /** Include the closing edge without duplicating the seam; defaults to false. */
1057
- readonly closed?: boolean;
1058
- /** Preserve the source orientation, or align its +Z to the path tangent; defaults to fixed. */
1059
- readonly orientation?: "fixed" | "tangent";
1060
- }
1061
-
1062
- /**
1063
- * One same-session shape, or a synchronous factory called once per copy in index order.
1064
- */
1065
- export declare type PatternSource = Solid | ((index: number) => Solid);
1066
-
1067
- /** A world-space cutting plane, retaining the half-space in the normal's direction. */
1068
- export declare interface PlaneOptions {
1069
- /** Finite nonzero plane normal; magnitude does not affect the plane. */
1070
- readonly normal: Vec3;
1071
- /** Signed millimetre distance from the origin along the unit normal. Defaults to zero. */
1072
- readonly offset?: number;
1073
- }
1074
-
1075
- /**
1076
- * One bounded two-dimensional polygon.
1077
- *
1078
- * `outer` is counter-clockwise and each hole is clockwise. Boundary arrays omit
1079
- * their duplicated closing point. Holes must lie inside `outer` and must not
1080
- * intersect each other or the exterior.
1081
- */
1082
- export declare interface Polygon2 {
1083
- /** Clockwise interior boundaries, each omitting its duplicated closing point. */
1084
- readonly holes: readonly Loop2[];
1085
- /** Counter-clockwise exterior boundary, omitting its duplicated closing point. */
1086
- readonly outer: Loop2;
1087
- }
1088
-
1089
- /** Allocation-free internal-thread facts. */
1090
- export declare function preflightInternalThreadCutter(options: InternalThreadCutterOptions): HelicalThreadSolidMeshPreflight;
1091
-
1092
- /** Allocation-free nut/cutter facts. */
1093
- export declare function preflightThreadedNut(options: ThreadedNutOptions): ThreadedNutPreflight;
1094
-
1095
- /** Allocation-free external-thread facts. */
1096
- export declare function preflightThreadedRod(options: ThreadedRodOptions): HelicalThreadSolidMeshPreflight;
1097
-
1098
- /** Placement shared by solid and filled-section factories. */
1099
- export declare interface PrimitivePlacement {
1100
- /** Applied after local construction; Section placement must preserve the XY plane. */
1101
- readonly placement?: PrimitivePlacementOptions;
1102
- }
1103
-
1104
- /** Maps an explicit or named shape-local attachment anchor onto a world-space anchor. */
1105
- export declare interface PrimitivePlacementOptions {
1106
- /** Shape-local source frame or a named primitive anchor such as bottom. */
1107
- readonly source: Anchor3 | string;
1108
- /** World-space target frame in millimetres. */
1109
- readonly target: Anchor3;
1110
- /** Align outward directions face-to-face or in parallel. Defaults to opposed. */
1111
- readonly alignment?: "opposed" | "same";
1112
- /** Finite separation along the target direction in millimetres. Defaults to zero. */
1113
- readonly gap?: number;
1114
- /** Finite additional roll around the attached direction in degrees. Defaults to zero. */
1115
- readonly spinDegrees?: number;
1116
- /** Explicit numeric comparison overrides for anchor normalization. */
1117
- readonly tolerance?: GeometryToleranceOptions;
1118
- }
1119
-
1120
- /**
1121
- * Named baseline fit policies for calibrated FDM-style printed threads.
1122
- */
1123
- export declare type PrintableThreadFit = "tight" | "normal" | "loose";
1124
-
1125
- /**
1126
- * Explicit radial and axial allowances for a mating printed thread pair.
1127
- *
1128
- * Male and female radial values are applied independently, so their sum is the
1129
- * assembled radial clearance. Values are millimetres and intentionally do not
1130
- * encode printer, material, or process calibration.
1131
- */
1132
- export declare interface PrintableThreadFitPolicy {
1133
- /** Nominal axial backlash available between opposing flanks. */
1134
- readonly axialBacklash: number;
1135
- /** Radial increase applied to an internal thread envelope. */
1136
- readonly femaleRadialOutset: number;
1137
- /** Radial reduction applied to an external thread envelope. */
1138
- readonly maleRadialInset: number;
1139
- }
1140
-
1141
- /** An explicit component/contour/span topology, before shared family sampling. */
1142
- export declare interface Profile {
1143
- /** Ordered components with explicit contour identities. */
1144
- readonly components: readonly ProfileComponent2[];
1145
- }
1146
-
1147
- /** One component and its explicitly identified holes. */
1148
- export declare interface ProfileComponent2 {
1149
- /** Stable canonical lowercase identity; unique within the containing topology or output. */
1150
- readonly id: string;
1151
- /** Counterclockwise outer contour. */
1152
- readonly outer: ProfileContour2;
1153
- /** Clockwise hole contours belonging to this component. */
1154
- readonly holes: readonly ProfileContour2[];
1155
- }
1156
-
1157
- /** Ordered, closed spans. Outer winding is CCW and hole winding is CW. */
1158
- export declare interface ProfileContour2 {
1159
- /** Stable canonical lowercase identity; unique within the containing topology or output. */
1160
- readonly id: string;
1161
- /** Ordered identified spans; the last endpoint meets the first start. */
1162
- readonly spans: readonly ProfileSpan2[];
1163
- }
1164
-
1165
- /** A deliberately sampled, inward-only corner profile with exact polyline geometry. */
1166
- export declare interface ProfiledEdgeTreatment {
1167
- /** Selects an explicit corner profile; no analytic curve is inferred from its samples. */
1168
- readonly kind: "profile";
1169
- /**
1170
- * Millimetre setbacks on adjoining surfaces, from [positive, 0] to [0, positive].
1171
- * First coordinates decrease and second coordinates increase. Cylinder/extrusion ends use
1172
- * cap inset first, side setback second; planar corners use incoming then outgoing edges.
1173
- */
1174
- readonly profile: readonly Vec2[];
1175
- }
1176
-
1177
- /** An identified line, circular arc, or cubic Bézier between corresponding landmarks. */
1178
- export declare type ProfileSpan2 = {
1179
- /** Stable canonical lowercase identity; unique within the containing topology or output. */
1180
- readonly id: string;
1181
- /** Optional exact span interval count; the family uses the largest requested count. */
1182
- readonly segments?: number;
1183
- /** Optional span-local physical sampling over the family's resolution; exact intervals take precedence. */
1184
- readonly resolution?: GeometryResolution;
1185
- } & ({
1186
- /** Selects a straight span. */
1187
- readonly kind: "line";
1188
- /** Start point in millimetres. */
1189
- readonly start: Vec2;
1190
- /** End point in millimetres. */
1191
- readonly end: Vec2;
1192
- } | {
1193
- /** Selects the geometric curve or span family. */
1194
- readonly kind: "arc";
1195
- /** Center point in millimetres. */
1196
- readonly center: Vec2;
1197
- /** Circular radius in millimetres. */
1198
- readonly radius: number;
1199
- /** Initial counterclockwise angle in degrees. */
1200
- readonly startDegrees: number;
1201
- /** Signed counterclockwise angular sweep in degrees. */
1202
- readonly sweepDegrees: number;
1203
- } | {
1204
- /** Selects a cubic Bézier span with the same coordinates as CubicBezierCurve2. */
1205
- readonly kind: "cubic";
1206
- /** Start point in millimetres. */
1207
- readonly start: Vec2;
1208
- /** First control point in millimetres. */
1209
- readonly control1: Vec2;
1210
- /** Second control point in millimetres. */
1211
- readonly control2: Vec2;
1212
- /** End point in millimetres. */
1213
- readonly end: Vec2;
1214
- });
1215
-
1216
- /**
1217
- * Repeats one solid about an axis.
1218
- *
1219
- * @example Six copies around Z
1220
- * ```ts
1221
- * const pin = cylinder({ height: 6, radius: 2 }).translate([12, 0, 0]);
1222
- * radialPattern(pin, { count: 6, axis: [0, 0, 1], angleDegrees: 60 });
1223
- * ```
1224
- */
1225
- export declare function radialPattern(source: PatternSource, options: RadialPatternOptions): readonly Solid[];
1226
-
1227
- /**
1228
- * Options for repeating one solid around an axis through a center point.
1229
- */
1230
- export declare interface RadialPatternOptions {
1231
- /** Number of solids to return, including the original. */
1232
- readonly count: number;
1233
- /** Axis of the right-handed rotation. Its magnitude is ignored. */
1234
- readonly axis: Vec3;
1235
- /** Signed rotation from one copy to the next, in degrees. */
1236
- readonly angleDegrees: number;
1237
- /** Rotation center in world coordinates. Defaults to the origin. */
1238
- readonly center?: Vec3;
1239
- }
1240
-
1241
- /**
1242
- * Radial dimensions refer to polygon vertices or compensate faceting to meet polygon faces.
1243
- */
1244
- export declare type RadialSizing = "vertex" | "face";
1245
-
1246
- /**
1247
- * Nominal radial sizing shared by circular and regular polygon construction.
1248
- */
1249
- export declare interface RadialSizingOptions {
1250
- /** Explicit sampling ceilings; bound modeling operations may only lower the host policy. */
1251
- readonly limits?: Partial<GeometrySamplingLimits>;
1252
- /** Vertex sizing is inscribed; face sizing circumscribes the nominal radius. Defaults to vertex. */
1253
- readonly sizing?: RadialSizing;
1254
- }
1255
-
1256
- /** Copies intersections along the finite directed origin-to-endpoint segment. */
1257
- export declare function rayCast(solid: Solid, origin: Vec3, endpoint: Vec3): readonly SolidRayHit[];
1258
-
1259
- /**
1260
- * Filled rectangular section with uniform or independently treated corners.
1261
- *
1262
- * @example Round the corners
1263
- * ```ts
1264
- * rectangle({ size: [30, 20], treatment: { kind: "round", radius: 3 } });
1265
- * ```
1266
- */
1267
- export declare function rectangle(options: RectangleOptions): Section;
1268
-
1269
- /** A rectangle corner, including an explicitly untreated corner in a treatment tuple. */
1270
- export declare type RectangleCornerTreatment = EdgeTreatment | {
1271
- /** Leaves this corner untreated. */
1272
- readonly kind: "square";
1273
- };
1274
-
1275
- /** Corner treatments ordered top-right, top-left, bottom-left, bottom-right. */
1276
- export declare type RectangleCornerTreatments = readonly [
1277
- topRight: RectangleCornerTreatment,
1278
- topLeft: RectangleCornerTreatment,
1279
- bottomLeft: RectangleCornerTreatment,
1280
- bottomRight: RectangleCornerTreatment
1281
- ];
1282
-
1283
- /**
1284
- * Shared rectangle dimensions, origin and uniform or per-corner treatment.
1285
- */
1286
- export declare interface RectangleLoopOptions {
1287
- /** Positive uniform size or explicit XY extents in millimetres. */
1288
- readonly size: number | Vec2;
1289
- /** Center on XY; otherwise the minimum corner is the origin. Defaults to true. */
1290
- readonly center?: boolean;
1291
- /** Uniform treatment or four corner treatments. Exact round segments describe a complete circle and must divide by four. */
1292
- readonly treatment?: EdgeTreatment | RectangleCornerTreatments;
1293
- /** Explicit sampling ceiling for the complete output profile. */
1294
- readonly limits?: Partial<GeometrySamplingLimits>;
1295
- }
1296
-
1297
- /**
1298
- * Rectangle dimensions, placement and uniform or per-corner treatment.
1299
- */
1300
- export declare interface RectangleOptions extends RectangleLoopOptions, PrimitivePlacement {
1301
- }
1302
-
1303
- /** A two-dimensional region represented by disjoint filled polygons. */
1304
- export declare type Region2 = readonly Polygon2[];
1305
-
1306
- /** Clipper2 join styles accepted by robust region offsets. */
1307
- export declare type RegionOffsetJoin = "miter" | "round" | "square";
1308
-
1309
- /** Options controlling robust Clipper2 region offsets. */
1310
- export declare interface RegionOffsetOptions {
1311
- /** Number of segments per full circle for round joins. */
1312
- readonly circularSegments?: number;
1313
- /** Corner treatment; defaults to `round`. */
1314
- readonly join?: RegionOffsetJoin;
1315
- /** Maximum miter extension in offset-distance multiples; at least two. */
1316
- readonly miterLimit?: number;
1317
- /** Operation-level physical tessellation policy over the active model-wide policy. */
1318
- readonly resolution?: GeometryResolution;
1319
- }
1320
-
1321
- /**
1322
- * Regular polygon with a vertex on +X.
1323
- *
1324
- * @example Hexagonal section
1325
- * ```ts
1326
- * regularPolygon({ radius: 10, sides: 6, sizing: "face" });
1327
- * ```
1328
- */
1329
- export declare function regularPolygon(options: RegularPolygonOptions): Section;
1330
-
1331
- /**
1332
- * Regular polygon dimensions, radial convention and degree rotation.
1333
- */
1334
- export declare type RegularPolygonOptions = RadialSizingOptions & PrimitivePlacement & {
1335
- /** Positive nominal radius in millimetres, interpreted according to sizing. */
1336
- readonly radius: number;
1337
- /** Exact integer side count from three through 100000. */
1338
- readonly sides: number;
1339
- /** Counterclockwise rotation in degrees; defaults to zero with a vertex on +X. */
1340
- readonly rotationDegrees?: number;
1341
- };
1342
-
1343
- /**
1344
- * Revolves explicit corresponding radial/Z contours around +Z, with caps for partial sweeps.
1345
- * Filled Sections use `section.revolve(options)`.
1346
- *
1347
- * @example Revolve
1348
- * ```ts
1349
- * import { matchProfiles, revolve } from "@metamesh/modeling";
1350
- * import { rectangleProfile } from "@metamesh/modeling/geometry";
1351
- *
1352
- * // Contour coordinates are [radius, Z].
1353
- * const [profile] = matchProfiles([rectangleProfile({ size: [4, 16], center: false })]);
1354
- * revolve(profile!, { revolveDegrees: 270 });
1355
- * ```
1356
- */
1357
- export declare function revolve(shape: CorrespondingProfile, options?: RevolveOptions): Solid;
1358
-
1359
- /**
1360
- * Circumferential sampling and degree sweep shared by pure and filled revolution.
1361
- */
1362
- export declare interface RevolveOptions extends CircularPrimitiveOptions {
1363
- /**
1364
- * Positive angular sweep no greater than 360 degrees; partial revolutions have end caps.
1365
- * Segment counts describe a complete circle and scale to this angular span. Native filled
1366
- * revolutions require at least three sweep intervals: adaptive sampling refines to that floor,
1367
- * while exact counts that imply fewer intervals reject. Pure revolveMesh supports one interval.
1368
- */
1369
- readonly revolveDegrees?: number;
1370
- /** Explicit output and sampling allocation ceilings. */
1371
- readonly limits?: Partial<ModelingLimits>;
1372
- }
1373
-
1374
- /**
1375
- * A circular edge or corner roundover with explicit physical sampling.
1376
- */
1377
- export declare interface RoundedEdgeTreatment extends CircularPrimitiveOptions {
1378
- /** Selects circular corners or spherical all-edge roundovers. */
1379
- readonly kind: "round";
1380
- /** Radius in millimetres. Rectangles permit zero through half their smallest dimension; boxes require a positive smaller radius. */
1381
- readonly radius: number;
1382
- }
1383
-
1384
- /**
1385
- * Immutable deferred filled XY section recipe belonging to exactly one model session.
1386
- * Methods run during synchronous generation and preserve their receiver.
1387
- * Distances use millimetres; rotations are counterclockwise degrees about the origin.
1388
- * Construction uses the session resolution unless the operation supplies explicit options.
1389
- *
1390
- * @example Extrude an outline with a border
1391
- * ```ts
1392
- * const body = rectangle({ size: [20, 12] })
1393
- * .subtract([rectangle({ size: [16, 8] })])
1394
- * .offset(0.5)
1395
- * .extrude({ height: 4 });
1396
- * ```
1397
- */
1398
- export declare interface Section {
1399
- /** Compile-time ownership brand for a same-session section. */
1400
- readonly [sectionBrand]: "Section";
1401
- /** Translates XY coordinates in millimetres. */
1402
- translate(this: Section, offset: Vec2): Section;
1403
- /** Rotates counterclockwise about the origin by a scalar angle in degrees. */
1404
- rotate(this: Section, degrees: number): Section;
1405
- /**
1406
- * Nonsingular scaling about the origin.
1407
- */
1408
- scale(this: Section, factors: number | Vec2): Section;
1409
- /** Reflection across an origin line/plane. */
1410
- mirror(this: Section, normal: Vec2): Section;
1411
- /** Row-major affine transform preserving dimensionality. */
1412
- transform(this: Section, matrix: Transform2): Section;
1413
- /** Native section difference; an empty cutter array preserves the source. */
1414
- subtract(this: Section, cutters: readonly Section[]): Section;
1415
- /**
1416
- * Simplifies filled 2D contours using an explicit positive millimetre tolerance.
1417
- *
1418
- * Useful for dense imported outlines before extrusion. This changes the outline rather
1419
- * than selecting a lower rendering quality; fine features may be removed.
1420
- */
1421
- simplify(this: Section, tolerance: number): Section;
1422
- /**
1423
- * Returns a new same-session handle with copied named anchors; existing names may be replaced.
1424
- */
1425
- withAnchors(this: Section, anchors: Readonly<Record<string, Anchor3>>): Section;
1426
- /**
1427
- * Native millimetre offset preserving holes.
1428
- */
1429
- offset(this: Section, distance: number, options?: RegionOffsetOptions): Section;
1430
- /**
1431
- * Extrudes along +Z with degree twist and top scaling.
1432
- */
1433
- extrude(this: Section, options: ExtrudeOptions): Solid;
1434
- /**
1435
- * Revolves a filled radial/Z shape around +Z, with caps for partial sweeps.
1436
- */
1437
- revolve(this: Section, options?: RevolveOptions): Solid;
1438
- /**
1439
- * Sweeps this filled section using the selected frame policy and degree twist.
1440
- */
1441
- sweep(this: Section, path: readonly Vec3[], options?: SweepOptions): Solid;
1442
- }
1443
-
1444
- declare const sectionBrand: unique symbol;
1445
-
1446
- /**
1447
- * Creates a native filled section without an intermediate Region2 conversion.
1448
- */
1449
- export declare function sectionFromContours(contours: readonly Loop2[], options?: SectionFromContoursOptions): Section;
1450
-
1451
- /**
1452
- * Filled-contour resolution. Closing vertices are implicit.
1453
- */
1454
- export declare interface SectionFromContoursOptions {
1455
- /** Nonzero or even-odd filled-contour rule; defaults to nonzero. */
1456
- readonly fillRule?: "nonzero" | "evenodd";
1457
- }
1458
-
1459
- /** Planar convex hull inputs are finite XY points or same-session filled sections. */
1460
- export declare type SectionHullOptions = {
1461
- /** At least three finite millimetre XY points spanning positive area. */
1462
- readonly points: readonly Vec2[];
1463
- /** Point input excludes section input. */
1464
- readonly sections?: never;
1465
- } | {
1466
- /** One through 1000 same-session sections to include in the convex hull. */
1467
- readonly sections: readonly Section[];
1468
- /** Section input excludes point input. */
1469
- readonly points?: never;
1470
- };
1471
-
1472
- /**
1473
- * Immutable native filled section facts in millimetres and square millimetres.
1474
- * Repeated inspections of the same native shape share these facts within one revision.
1475
- */
1476
- export declare interface SectionInspection {
1477
- /** Whether this filled section has no area or boundary. */
1478
- readonly isEmpty: boolean;
1479
- /** Filled section area in square millimetres. */
1480
- readonly area: number;
1481
- /** Number of extracted outer and hole contours. */
1482
- readonly contours: number;
1483
- /** Inclusive maximum coordinates in millimetres. */
1484
- readonly max: Vec2;
1485
- /** Inclusive minimum coordinates in millimetres. */
1486
- readonly min: Vec2;
1487
- /** Number of disconnected filled section components. */
1488
- readonly parts: number;
1489
- /** Number of native section vertices. */
1490
- readonly vertices: number;
1491
- }
1492
-
1493
- /** A cubic corner transition with zero curvature at its straight tangent joins. */
1494
- export declare interface SmoothEdgeTreatment {
1495
- /** Selects continuous-curvature cubic rounding, rather than a circular radius. */
1496
- readonly kind: "smooth";
1497
- /** Positive tangent setbacks, equal or [first, second], in millimetres. */
1498
- readonly distance: number | readonly [first: number, second: number];
1499
- /** Exact cubic interval count, positive; overrides physical sampling. */
1500
- readonly segments?: number;
1501
- /** Physical chord/edge-length sampling; circularSegments does not describe a cubic. */
1502
- readonly resolution?: GeometryResolution;
1503
- /** Explicit sampling ceilings, bounded by the host policy. */
1504
- readonly limits?: Partial<GeometrySamplingLimits>;
1505
- }
1506
-
1507
- /**
1508
- * Immutable deferred solid recipe belonging to exactly one model session.
1509
- * Methods run during synchronous generation, preserve their receiver, and use millimetres and degrees.
1510
- * A no-op may reuse the receiver; final part placement belongs in `part` options.
1511
- *
1512
- * @example Shape a body with a through bore
1513
- * ```ts
1514
- * const body = box({ size: [30, 20, 6] })
1515
- * .subtract([cylinder({ height: 8, radius: 3 })])
1516
- * .rotate([0, 0, 45]);
1517
- * ```
1518
- */
1519
- export declare interface Solid {
1520
- /** Compile-time ownership brand for a same-session solid. */
1521
- readonly [solidBrand]: "Solid";
1522
- /**
1523
- * Translates XYZ coordinates in millimetres.
1524
- */
1525
- translate(this: Solid, offset: Vec3): Solid;
1526
- /**
1527
- * Rotates about the origin using XYZ Euler angles in degrees.
1528
- */
1529
- rotate(this: Solid, degrees: Vec3): Solid;
1530
- /**
1531
- * Nonsingular scaling about the origin.
1532
- */
1533
- scale(this: Solid, factors: number | Vec3): Solid;
1534
- /**
1535
- * Reflection across an origin line/plane.
1536
- */
1537
- mirror(this: Solid, normal: Vec3): Solid;
1538
- /** Row-major affine transform preserving dimensionality. */
1539
- transform(this: Solid, matrix: Transform3): Solid;
1540
- /**
1541
- * Robust difference; an empty cutter array preserves the source.
1542
- */
1543
- subtract(this: Solid, cutters: readonly Solid[]): Solid;
1544
- /**
1545
- * Simplifies a solid using an explicit positive millimetre tolerance.
1546
- *
1547
- * Removes redundant vertices while keeping surfaces within the greater of this tolerance
1548
- * and the solid's existing native tolerance. Choose it from the detail you can afford to lose.
1549
- */
1550
- simplify(this: Solid, tolerance: number): Solid;
1551
- /**
1552
- * Returns a new same-session handle with copied named anchors; existing names may be replaced.
1553
- */
1554
- withAnchors(this: Solid, anchors: Readonly<Record<string, Anchor3>>): Solid;
1555
- /**
1556
- * Places an explicit or named source anchor against an explicit target anchor.
1557
- */
1558
- attach(this: Solid, source: Anchor3 | string, target: Anchor3, options?: AttachOptions): Solid;
1559
- /** Replaces native tolerance on an immutable copy; zero selects the kernel minimum. */
1560
- setTolerance(this: Solid, tolerance: number): Solid;
1561
- /** Projects this solid into a filled XY section. */
1562
- projectSection(this: Solid): Section;
1563
- /** Takes a filled horizontal slice at Z millimetres. */
1564
- sliceSection(this: Solid, z: number): Section;
1565
- }
1566
-
1567
- declare const solidBrand: unique symbol;
1568
-
1569
- /**
1570
- * Imports a bounded closed indexed mesh.
1571
- *
1572
- * @example Mesh import
1573
- * ```ts
1574
- * import { solidFromMesh } from "@metamesh/modeling";
1575
- * import { extrudeMesh, rectangleLoop } from "@metamesh/modeling/geometry";
1576
- *
1577
- * const mesh = extrudeMesh(rectangleLoop({ size: [20, 12] }), { height: 6 });
1578
- * solidFromMesh(mesh);
1579
- * ```
1580
- */
1581
- export declare function solidFromMesh(mesh: TriangleMesh | ImmutableTriangleMesh): Solid;
1582
-
1583
- /**
1584
- * Immutable solid bounds, emptiness, component count, volume, surface area and native tolerance.
1585
- * Repeated inspections of the same native shape share these facts within one revision.
1586
- */
1587
- export declare interface SolidInspection {
1588
- /** Whether this native solid contains no material. */
1589
- readonly isEmpty: boolean;
1590
- /** Inclusive maximum coordinates in millimetres. */
1591
- readonly max: Vec3;
1592
- /** Inclusive minimum coordinates in millimetres. */
1593
- readonly min: Vec3;
1594
- /** Number of connected surface shells; inward cavity shells count separately. */
1595
- readonly parts: number;
1596
- /** Enclosed native solid volume in cubic millimetres. */
1597
- readonly volume: number;
1598
- /** Total native surface area in square millimetres. */
1599
- readonly surfaceArea: number;
1600
- /** Effective native geometric tolerance in millimetres. */
1601
- readonly tolerance: number;
1602
- }
1603
-
1604
- /** Copied surface intersection from a finite directed segment. Distance is in millimetres. */
1605
- export declare interface SolidRayHit {
1606
- /** Copied numeric native face identity. */
1607
- readonly faceId: number;
1608
- /** Distance from the ray origin in millimetres. */
1609
- readonly distance: number;
1610
- /** Intersection position in millimetres. */
1611
- readonly position: Vec3;
1612
- /** Outward unit surface normal at the intersection. */
1613
- readonly normal: Vec3;
1614
- }
1615
-
1616
- /**
1617
- * Origin-centered sphere.
1618
- *
1619
- * @example Sphere
1620
- * ```ts
1621
- * sphere({ diameter: 20 });
1622
- * ```
1623
- */
1624
- export declare function sphere(options: SphereOptions): Solid;
1625
-
1626
- /**
1627
- * Exactly one radius or diameter, placement, and tessellation for an origin-centered sphere.
1628
- */
1629
- export declare type SphereOptions = CircularPrimitiveOptions & PrimitivePlacement & ({
1630
- /** Positive radius in millimetres; mutually exclusive with diameter. */
1631
- readonly radius: number;
1632
- /** Full diameter is unavailable when radius is supplied. */
1633
- readonly diameter?: never;
1634
- } | {
1635
- /** Positive full diameter in millimetres; mutually exclusive with radius. */
1636
- readonly diameter: number;
1637
- /** Radius is unavailable when diameter is supplied. */
1638
- readonly radius?: never;
1639
- });
1640
-
1641
- /**
1642
- * Splits a solid into [inside the cutter, outside the cutter].
1643
- *
1644
- * The first result is the intersection; the second is the subtraction. The cutter itself
1645
- * is not returned. Either result may be empty or contain multiple disconnected components.
1646
- *
1647
- * @example Keep the plug and the surrounding body
1648
- * ```ts
1649
- * const body = box({ size: [30, 20, 8] });
1650
- * const cutter = cylinder({ height: 10, diameter: 8 });
1651
- * const [plug, remainder] = split(body, cutter);
1652
- * // Move the plug beside the body to show both results.
1653
- * union([plug.translate([0, -20, 0]), remainder]);
1654
- * ```
1655
- */
1656
- export declare function split(solid: Solid, cutter: Solid): readonly [Solid, Solid];
1657
-
1658
- /**
1659
- * Splits a solid into [positive-normal side, negative side] at a world-space plane.
1660
- *
1661
- * The nonzero normal is normalized; offset is the signed distance from the origin in
1662
- * millimetres, defaulting to zero. Both cut faces are closed. Select either tuple result
1663
- * to retain one side; either result may be empty.
1664
- *
1665
- * @example Separate two halves at X = 0
1666
- * ```ts
1667
- * const body = box({ size: [30, 20, 8] });
1668
- * const [right, left] = splitByPlane(body, { normal: [1, 0, 0] });
1669
- * // The gap is only for display; the cut itself removes no material.
1670
- * union([right.translate([4, 0, 0]), left.translate([-4, 0, 0])]);
1671
- * ```
1672
- *
1673
- * @example Keep only the positive half
1674
- * ```ts
1675
- * const [right] = splitByPlane(box({ size: [30, 20, 8] }), { normal: [1, 0, 0] });
1676
- * right;
1677
- * ```
1678
- */
1679
- export declare function splitByPlane(solid: Solid, plane: PlaneOptions): readonly [Solid, Solid];
1680
-
1681
- /** Square profile with equal crest and root widths. */
1682
- declare interface SquareThreadProfileSpec extends ThreadProfileBaseSpec {
1683
- /** Selects the square profile family. */
1684
- readonly kind: "square";
1685
- /**
1686
- * Radial depth in millimetres.
1687
- * @defaultValue `pitch / 2`
1688
- */
1689
- readonly depth?: number;
1690
- }
1691
-
1692
- /**
1693
- * Alternating outer/inner star vertices.
1694
- *
1695
- * @example Five-point section
1696
- * ```ts
1697
- * star({ outerRadius: 12, innerRadius: 6, points: 5 });
1698
- * ```
1699
- */
1700
- export declare function star(options: StarOptions): Section;
1701
-
1702
- /**
1703
- * Alternating outer and inner vertices, centered on the XY origin.
1704
- */
1705
- export declare interface StarOptions extends PrimitivePlacement {
1706
- /** Explicit sampling ceilings, bounded by the host policy. */
1707
- readonly limits?: Partial<GeometrySamplingLimits>;
1708
- /** Positive outer vertex radius in millimetres. */
1709
- readonly outerRadius: number;
1710
- /** Positive inner vertex radius, smaller than the outer radius. */
1711
- readonly innerRadius: number;
1712
- /** Integer outer point count from three through 50000. */
1713
- readonly points: number;
1714
- /** Initial counterclockwise rotation in degrees; defaults to zero. */
1715
- readonly rotationDegrees?: number;
1716
- }
1717
-
1718
- /** Placement of painted SVG geometry after SVG Y-axis inversion. */
1719
- export declare type SvgOrigin = "center" | "document";
1720
-
1721
- /**
1722
- * Imports bounded filled SVG path data.
1723
- *
1724
- * @example Fill an SVG path in millimetres
1725
- * ```ts
1726
- * svgPathSection("M0 0H20V12H0Z", { origin: "center", scale: 1 });
1727
- * ```
1728
- */
1729
- export declare function svgPathSection(path: string, options?: SvgPathSectionOptions): Section;
1730
-
1731
- /** Bounded filled SVG path sampling. Path scale converts user units to millimetres. */
1732
- export declare interface SvgPathSectionOptions {
1733
- /** Local allocation ceilings may only lower the configured engine policy. */
1734
- readonly limits?: Partial<GeometrySamplingLimits>;
1735
- /** Nonzero or even-odd filled-contour rule; defaults to nonzero. */
1736
- readonly fillRule?: "evenodd" | "nonzero";
1737
- /** Local physical sampling policy; exact interval counts take precedence. */
1738
- readonly resolution?: GeometryResolution;
1739
- /** Center the painted bounds or preserve original path coordinates. */
1740
- readonly origin?: SvgOrigin;
1741
- /** Positive uniform factor converting SVG user units to millimetres; defaults to one. */
1742
- readonly scale?: number;
1743
- }
1744
-
1745
- /**
1746
- * Imports bounded painted SVG document geometry.
1747
- *
1748
- * @example Import a physical SVG rectangle
1749
- * ```ts
1750
- * svgSection(
1751
- * '<svg xmlns="http://www.w3.org/2000/svg" width="30mm" height="20mm" viewBox="0 0 30 20"><rect width="30" height="20"/></svg>',
1752
- * { origin: "center" },
1753
- * );
1754
- * ```
1755
- */
1756
- export declare function svgSection(svg: string, options?: SvgSectionOptions): Section;
1757
-
1758
- /**
1759
- * Bounded SVG document sampling. Center origin uses the final painted bounds.
1760
- */
1761
- export declare interface SvgSectionOptions {
1762
- /** Local allocation ceilings may only lower the configured engine policy. */
1763
- readonly limits?: Partial<GeometrySamplingLimits>;
1764
- /** Exact circular tessellation count overriding physical sampling. */
1765
- readonly circularSegments?: number;
1766
- /** Local physical sampling policy; exact interval counts take precedence. */
1767
- readonly resolution?: GeometryResolution;
1768
- /** Place the painted bounds around the origin or preserve document coordinates. */
1769
- readonly origin?: SvgOrigin;
1770
- }
1771
-
1772
- /**
1773
- * Sweeps explicit corresponding contours using the selected frame policy.
1774
- * Filled Sections use `section.sweep(path, options)`.
1775
- *
1776
- * @example Sweep
1777
- * ```ts
1778
- * import { matchProfiles, sweep } from "@metamesh/modeling";
1779
- * import { rectangleProfile } from "@metamesh/modeling/geometry";
1780
- *
1781
- * const [profile] = matchProfiles([rectangleProfile({ size: [6, 3] })]);
1782
- * sweep(profile!, [[0, 0, 0], [0, 0, 15], [10, 0, 25]], {
1783
- * orientation: { kind: "transport", initialNormal: [0, 1, 0] },
1784
- * });
1785
- * ```
1786
- */
1787
- export declare function sweep(shape: CorrespondingProfile, path: readonly Vec3[], options?: SweepOptions): Solid;
1788
-
1789
- /**
1790
- * Controls shared by pure mesh construction and filled modeling sweeps.
1791
- */
1792
- export declare interface SweepOptions {
1793
- /** Join the path's last station to its first. Open paths retain watertight end caps. */
1794
- readonly closed?: boolean;
1795
- /** Explicit output and sampling allocation ceilings. */
1796
- readonly limits?: Partial<ModelingLimits>;
1797
- /** Explicit frame policy; default transport minimizes rotations, initially projecting +X then +Y then +Z. */
1798
- readonly orientation?: SweepOrientation;
1799
- /** Physical sampling of nonzero twist; inserted stations retain authored station controls. */
1800
- readonly resolution?: GeometryResolution;
1801
- /** Total additional profile rotation in degrees, with progression selected by twistBy. */
1802
- readonly twistDegrees?: number;
1803
- /** Twist advances by physical path length (default), or normalized authored station position, including a closed seam gap. */
1804
- readonly twistBy?: "length" | "stations";
1805
- /** Positive uniform/XY scale, or one XY pair per path station. Defaults to one. */
1806
- readonly scale?: number | Vec2 | readonly Vec2[];
1807
- /** Corresponding point-index advance at a rotationally equivalent closed seam. */
1808
- readonly seamProfileOffset?: number;
1809
- }
1810
-
1811
- /**
1812
- * Explicit profile-X frame policy; all normals are directed, and selected singular policies reject.
1813
- */
1814
- export declare type SweepOrientation = {
1815
- /** Minimizes frame rotation by parallel transport. */
1816
- readonly kind: "transport";
1817
- /** Initial profile +X guide, projected perpendicular to the first tangent. */
1818
- readonly initialNormal?: Vec3;
1819
- } | {
1820
- /** Projects one fixed world-space normal at every path station. */
1821
- readonly kind: "fixed-normal";
1822
- /** Directed profile +X guide; must not be parallel to any local tangent. */
1823
- readonly normal: Vec3;
1824
- } | {
1825
- /** Uses an explicitly directed normal callback at each original normalized station. */
1826
- readonly kind: "guide";
1827
- /** Finite profile +X guide callback, evaluated once per original path station. */
1828
- readonly normal: PathNormalGuide;
1829
- } | {
1830
- /** Uses sampled curvature normals; zero-curvature stations reject. */
1831
- readonly kind: "frenet";
1832
- };
1833
-
1834
- /**
1835
- * Consumes a previously prepared layout; never shapes or fetches a font.
1836
- *
1837
- * @example Use a prepared text layout
1838
- * ```ts
1839
- * // Prepare the exact font and layout before entering build.
1840
- * function labelSection(layout: VectorTextLayout) {
1841
- * return textSection(layout);
1842
- * }
1843
- * ```
1844
- */
1845
- export declare function textSection(layout: VectorTextLayout, options?: TextSectionOptions): Section;
1846
-
1847
- /**
1848
- * Physical curve sampling applied to already prepared vector text.
1849
- */
1850
- export declare interface TextSectionOptions {
1851
- /** Local allocation ceilings may only lower the configured engine policy. */
1852
- readonly limits?: Partial<GeometrySamplingLimits>;
1853
- /** Local physical sampling policy; exact interval counts take precedence. */
1854
- readonly resolution?: GeometryResolution;
1855
- }
1856
-
1857
- /** End bevel controls shared by threaded rods and cutters. */
1858
- declare interface ThreadBevelOptions {
1859
- /** Apply a 45-degree bevel at Z=0. */
1860
- readonly bevelBottom?: boolean;
1861
- /**
1862
- * Axial bevel extent in millimetres. Active blunt ends default to one sixth of the compensated
1863
- * male minor radius or female major radius; other ends default to the profile depth.
1864
- */
1865
- readonly bevelSize?: number;
1866
- /** Apply a 45-degree bevel at Z=length. */
1867
- readonly bevelTop?: boolean;
1868
- }
1869
-
1870
- /**
1871
- * Compensated threaded nut.
1872
- *
1873
- * @example Threaded nut
1874
- * ```ts
1875
- * import { threadedNut } from "@metamesh/modeling";
1876
- * import { createThreadProfile } from "@metamesh/modeling/geometry";
1877
- *
1878
- * const profile = createThreadProfile({ kind: "triangular", pitch: 1.75 });
1879
- * threadedNut({ nominalMajorDiameter: 12, thickness: 8, width: 20, shape: "hex", profile, fit: "normal" });
1880
- * ```
1881
- */
1882
- export declare function threadedNut(options: ThreadedNutOptions): Solid;
1883
-
1884
- /** Nut-edge bevel selection. */
1885
- export declare type ThreadedNutBevel = "automatic" | "both" | "inside" | "none" | "outside";
1886
-
1887
- /**
1888
- * Options for a compensated nut with an internal thread.
1889
- */
1890
- export declare interface ThreadedNutOptions extends Omit<InternalThreadCutterOptions, "bevelBottom" | "bevelSize" | "bevelTop" | "length"> {
1891
- /** Nut body bevel selection. Default: `automatic`. */
1892
- readonly bevel?: ThreadedNutBevel;
1893
- /** Optional physical policy for a round body, independent of the thread's matched facet grid. */
1894
- readonly bodyResolution?: GeometryResolution;
1895
- /** 45-degree body chamfer extent. Default: `min(profile.depth, thickness/4)`. */
1896
- readonly chamferSize?: number;
1897
- /** Leave the bottom outside edge flat for build-plate adhesion. Default: `false`. */
1898
- readonly flushBuildPlateBottom?: boolean;
1899
- /** Nut body shape. */
1900
- readonly shape: ThreadedNutShape;
1901
- /** Nut thickness along +Z in millimetres. */
1902
- readonly thickness: number;
1903
- /** Across-flats width for hex/square or diameter for round, in millimetres. */
1904
- readonly width: number;
1905
- }
1906
-
1907
- /** Allocation-free body, cutter, and end-face facts resolved for a threaded nut. */
1908
- export declare interface ThreadedNutPreflight {
1909
- /** Polygon segment count used by the nut body. */
1910
- readonly bodySegments: number;
1911
- /** Shared 45-degree chamfer size applied to the selected body and cutter edges. */
1912
- readonly chamferSize: number;
1913
- /** Maximum compensated cutter radius at either requested face. */
1914
- readonly cutterFaceRadius: number;
1915
- /** Minimum nut-body inradius across the requested top and bottom faces. */
1916
- readonly minimumBodyFaceInradius: number;
1917
- /** Smallest radial wall left between the body and cutter at either requested face. */
1918
- readonly minimumFaceWall: number;
1919
- /** Conservative allocation facts for the exact extended internal-thread cutter mesh. */
1920
- readonly thread: HelicalThreadSolidMeshPreflight;
1921
- /** Start-aligned circular facet count used by the compensated thread cutter. */
1922
- readonly threadCircularSegments: number;
1923
- }
1924
-
1925
- /**
1926
- * Supported printable nut body shapes.
1927
- */
1928
- export declare type ThreadedNutShape = "hex" | "round" | "square";
1929
-
1930
- /**
1931
- * Compensated external threaded rod.
1932
- *
1933
- * @example Threaded rod
1934
- * ```ts
1935
- * import { threadedRod } from "@metamesh/modeling";
1936
- * import { createThreadProfile } from "@metamesh/modeling/geometry";
1937
- *
1938
- * const profile = createThreadProfile({ kind: "triangular", pitch: 1.75 });
1939
- * threadedRod({ nominalMajorDiameter: 12, length: 24, profile, fit: "normal" });
1940
- * ```
1941
- */
1942
- export declare function threadedRod(options: ThreadedRodOptions): Solid;
1943
-
1944
- /**
1945
- * Options for a compensated external threaded rod along +Z.
1946
- */
1947
- export declare interface ThreadedRodOptions extends Omit<HelicalThreadRidgeMeshOptions, "majorDiameter">, ThreadBevelOptions {
1948
- /** Printable fit or caller-calibrated allowances. Default: `normal`. */
1949
- readonly fit?: PrintableThreadFit | PrintableThreadFitPolicy;
1950
- /** Nominal major diameter before male compensation. */
1951
- readonly nominalMajorDiameter: number;
1952
- }
1953
-
1954
- /** End shape of a generated helical ridge. */
1955
- export declare type ThreadEndStyle = "blunt" | "standard" | "tapered";
1956
-
1957
- /** Axial end controls for a generated ridge. */
1958
- export declare interface ThreadEndTreatmentOptions {
1959
- /**
1960
- * Ridge shape at the lower working boundary. `blunt` ends at full profile height, `standard`
1961
- * clips the periodic profile at the face, and `tapered` ramps out from the minor envelope.
1962
- * @defaultValue `"blunt"`
1963
- */
1964
- readonly bottom?: ThreadEndStyle;
1965
- /**
1966
- * Non-negative unthreaded envelope length reserved at each non-standard end, in millimetres.
1967
- * Active blunt bevels may raise this reservation to the effective bevel size.
1968
- * @defaultValue `0`
1969
- */
1970
- readonly endLength?: number;
1971
- /**
1972
- * Radial envelope toward which a blunt lead-in collapses.
1973
- * @defaultValue `"minor"`
1974
- */
1975
- readonly leadInEnvelope?: ThreadLeadInEnvelope;
1976
- /**
1977
- * Physical circumferential lead-in length in millimetres.
1978
- * @defaultValue The profile depth.
1979
- */
1980
- readonly leadInLength?: number;
1981
- /**
1982
- * Cross-section scaling curve used by blunt ends. `cut` switches abruptly to the full profile.
1983
- * @defaultValue `"cut"`
1984
- */
1985
- readonly leadInShape?: ThreadLeadInShape;
1986
- /**
1987
- * Ridge shape at the upper working boundary. `blunt` ends at full profile height, `standard`
1988
- * clips the periodic profile at the face, and `tapered` ramps into the minor envelope.
1989
- * @defaultValue `"blunt"`
1990
- */
1991
- readonly top?: ThreadEndStyle;
1992
- }
1993
-
1994
- /**
1995
- * Direction in which a conventional helical thread advances around +Z.
1996
- */
1997
- export declare type ThreadHandedness = "left" | "right";
1998
-
1999
- /** Radial envelope toward which a blunt lead-in collapses. */
2000
- export declare type ThreadLeadInEnvelope = "major" | "minor";
2001
-
2002
- /** BOSL2-compatible cross-section scaling curve for a blunt thread lead-in. */
2003
- export declare type ThreadLeadInShape = "cut" | "linear" | "smooth" | "sqrt";
2004
-
2005
- /**
2006
- * A validated immutable periodic thread profile in `[axial, radial]` millimetres.
2007
- */
2008
- export declare interface ThreadProfile {
2009
- /** Axial width of the flat at the major envelope. */
2010
- readonly crestFlatWidth: number;
2011
- /** Radial distance from the major envelope to the root. */
2012
- readonly depth: number;
2013
- /** Profile family that produced this validated profile. */
2014
- readonly kind: ThreadProfileSpec["kind"];
2015
- /** Adjacent axial thread spacing in millimetres. */
2016
- readonly pitch: number;
2017
- /** Immutable open `[axial, radial]` path spanning one pitch. */
2018
- readonly points: readonly Vec2[];
2019
- /** Axial width of the flat at the minor envelope. */
2020
- readonly rootFlatWidth: number;
2021
- }
2022
-
2023
- /** Fields shared by all thread profile specifications. */
2024
- declare interface ThreadProfileBaseSpec {
2025
- /** Adjacent axial thread spacing in millimetres. */
2026
- readonly pitch: number;
2027
- /** Optional numerical tolerance overrides. */
2028
- readonly tolerance?: GeometryToleranceOptions;
2029
- }
2030
-
2031
- /**
2032
- * Supported built-in and caller-defined thread profiles.
2033
- */
2034
- declare type ThreadProfileSpec = AcmeThreadProfileSpec | ButtressThreadProfileSpec | CustomThreadProfileSpec | SquareThreadProfileSpec | TrapezoidalThreadProfileSpec | TriangularThreadProfileSpec;
2035
-
2036
- /** Helical ridge mesh construction. */
2037
- export declare function threadRidge(options: ThreadRidgeOptions): Solid;
2038
-
2039
- /** Parameters for a helical ridge before solid construction. */
2040
- export declare type ThreadRidgeOptions = HelicalThreadRidgeMeshOptions;
2041
-
2042
- /** Explicit copied topology inspection; not needed for section operations. */
2043
- export declare function toRegion(section: Section): Region2;
2044
-
2045
- /**
2046
- * Torus around +Z.
2047
- *
2048
- * @example Torus
2049
- * ```ts
2050
- * torus({ majorRadius: 12, minorRadius: 3 });
2051
- * ```
2052
- */
2053
- export declare function torus(options: TorusOptions): Solid;
2054
-
2055
- /**
2056
- * Dimensions and independent ring/profile tessellation for a torus around the Z axis.
2057
- */
2058
- export declare interface TorusOptions extends PrimitivePlacement {
2059
- /** Explicit sampling ceilings, bounded by the host policy. */
2060
- readonly limits?: Partial<GeometrySamplingLimits>;
2061
- /** Radius from the Z axis to the profile center, in millimetres; greater than `minorRadius`. */
2062
- readonly majorRadius: number;
2063
- /** Exact segment count around the Z axis; omitted uses adaptive resolution. */
2064
- readonly majorSegments?: number;
2065
- /** Radius of the swept circular profile in millimetres. */
2066
- readonly minorRadius: number;
2067
- /** Exact segment count around the swept profile; omitted uses adaptive resolution. */
2068
- readonly minorSegments?: number;
2069
- /** Operation-level physical tessellation policy over the active model-wide policy. */
2070
- readonly resolution?: GeometryResolution;
2071
- }
2072
-
2073
- /** Copies a handle to manufacturing mesh buffers. */
2074
- export declare function toTriangleMesh(solid: Solid): TriangleMesh;
2075
-
2076
- /** Row-major affine XY matrix. Translation occupies m02/m12; final row is [0, 0, 1]. */
2077
- export declare type Transform2 = readonly [
2078
- m00: number,
2079
- m01: number,
2080
- m02: number,
2081
- m10: number,
2082
- m11: number,
2083
- m12: number,
2084
- m20: number,
2085
- m21: number,
2086
- m22: number
2087
- ];
2088
-
2089
- /**
2090
- * A row-major affine 4x4 matrix applied to column vectors.
2091
- *
2092
- * Translation occupies indices 3, 7, and 11. The final row must be
2093
- * `[0, 0, 0, 1]` within the active geometry tolerance.
2094
- */
2095
- export declare type Transform3 = readonly [
2096
- m00: number,
2097
- m01: number,
2098
- m02: number,
2099
- m03: number,
2100
- m10: number,
2101
- m11: number,
2102
- m12: number,
2103
- m13: number,
2104
- m20: number,
2105
- m21: number,
2106
- m22: number,
2107
- m23: number,
2108
- m30: number,
2109
- m31: number,
2110
- m32: number,
2111
- m33: number
2112
- ];
2113
-
2114
- /** Trapezoidal thread profile with a configurable included angle. */
2115
- declare interface TrapezoidalThreadProfileSpec extends ThreadProfileBaseSpec {
2116
- /** Selects the trapezoidal profile family. */
2117
- readonly kind: "trapezoidal";
2118
- /**
2119
- * Radial depth in millimetres.
2120
- * @defaultValue `pitch / 2`
2121
- */
2122
- readonly depth?: number;
2123
- /**
2124
- * Included flank angle in degrees. Use `90` for printable 45-degree slopes.
2125
- * @defaultValue `30`
2126
- */
2127
- readonly threadAngle?: number;
2128
- }
2129
-
2130
- /**
2131
- * A topology-preserving indexed triangle mesh with XYZ vertex positions.
2132
- */
2133
- export declare interface TriangleMesh {
2134
- /** Three unsigned vertex indices per triangle. */
2135
- readonly indices: Uint32Array;
2136
- /** Flat XYZ coordinates, three finite values per vertex. */
2137
- readonly positions: Float32Array;
2138
- }
2139
-
2140
- /**
2141
- * Measurements and optional edge-connected topology from one validated mesh traversal.
2142
- */
2143
- export declare interface TriangleMeshAnalysis extends TriangleMeshMeasurements {
2144
- /** Number of referenced edge-connected components when `includeTopology` is requested. */
2145
- readonly connectedComponentCount?: number;
2146
- /** Number of distinct indexed undirected edges when `includeTopology` is requested. */
2147
- readonly edgeCount?: number;
2148
- }
2149
-
2150
- /**
2151
- * Geometric measurements derived from a validated, non-empty triangle mesh.
2152
- */
2153
- export declare interface TriangleMeshMeasurements {
2154
- /** Axis-aligned bounds. */
2155
- readonly bounds: MeshBounds;
2156
- /** Signed enclosed volume; positive values correspond to outward winding. */
2157
- readonly signedVolume: number;
2158
- /** Sum of all triangle areas in squared model units. */
2159
- readonly surfaceArea: number;
2160
- /** Number of indexed triangles. */
2161
- readonly triangleCount: number;
2162
- /** Number of distinct entries in the position buffer. */
2163
- readonly vertexCount: number;
2164
- }
2165
-
2166
- /**
2167
- * ISO/UTS-like 60-degree truncated triangular profile.
2168
- */
2169
- declare interface TriangularThreadProfileSpec extends ThreadProfileBaseSpec {
2170
- /** Selects the 60-degree triangular profile family. */
2171
- readonly kind: "triangular";
2172
- /**
2173
- * Crest width divided by pitch.
2174
- * @defaultValue `1 / 8`
2175
- */
2176
- readonly crestFlatRatio?: number;
2177
- /**
2178
- * Root width divided by pitch.
2179
- * @defaultValue `1 / 4`
2180
- */
2181
- readonly rootFlatRatio?: number;
2182
- }
2183
-
2184
- /**
2185
- * Hollow +Z tube.
2186
- *
2187
- * @example Tube
2188
- * ```ts
2189
- * tube({ height: 20, outerRadius: 10, innerRadius: 6 });
2190
- * ```
2191
- */
2192
- export declare function tube(options: TubeOptions): Solid;
2193
-
2194
- /**
2195
- * Dimensions, placement, and tessellation for a hollow Z-axis tube.
2196
- */
2197
- export declare interface TubeOptions extends CircularPrimitiveOptions, PrimitivePlacement {
2198
- /**
2199
- * Centers the tube on the Z origin when `true`; otherwise its bottom is at `Z = 0`.
2200
- * @defaultValue `true`
2201
- */
2202
- readonly center?: boolean;
2203
- /** Total height along Z in millimetres. */
2204
- readonly height: number;
2205
- /** Positive inner radius in millimetres. */
2206
- readonly innerRadius: number;
2207
- /** Outer radius in millimetres; greater than {@link TubeOptions.innerRadius}. */
2208
- readonly outerRadius: number;
2209
- }
2210
-
2211
- /**
2212
- * Robust union.
2213
- *
2214
- * @example Union
2215
- * ```ts
2216
- * const block = box({ size: 20 });
2217
- * const cap = sphere({ radius: 10 }).translate([0, 0, 10]);
2218
- * union([block, cap]);
2219
- * ```
2220
- */
2221
- export declare function union(solids: readonly Solid[]): Solid;
2222
-
2223
- /** Native filled section union; dimensions cannot be mixed. */
2224
- export declare function union(sections: readonly Section[]): Section;
2225
-
2226
- /** A two-dimensional Cartesian vector or point. */
2227
- export declare type Vec2 = readonly [x: number, y: number];
2228
-
2229
- /** A three-dimensional Cartesian vector or point. */
2230
- export declare type Vec3 = readonly [x: number, y: number, z: number];
2231
-
2232
- /** Exact curve bounds in millimetres; positive Y points upward. */
2233
- export declare interface VectorTextBounds {
2234
- /** Minimum X and Y of visible outlines, including accents, descenders, and overhangs. */
2235
- readonly min: readonly [number, number];
2236
- /** Maximum X and Y of visible outlines. */
2237
- readonly max: readonly [number, number];
2238
- }
2239
-
2240
- /**
2241
- * Immutable vector layout with no browser, font parser, or kernel ownership.
2242
- */
2243
- export declare interface VectorTextLayout {
2244
- /** Nonzero-filled path data in millimetres, positive Y upward; empty for text with no ink. */
2245
- readonly paths: readonly string[];
2246
- /** Exact measurements of these paths and their logical text layout. */
2247
- readonly metrics: VectorTextMetrics;
2248
- }
2249
-
2250
- /** Text measurements from the same immutable layout that supplies geometry and SVG outlines. */
2251
- export declare interface VectorTextMetrics {
2252
- /** Visible curve bounds after alignment, or null when the text has no ink. */
2253
- readonly bounds: VectorTextBounds | null;
2254
- /** Unaligned logical advance and negative baseline displacement in mm; arcs retain [arc length, 0]. */
2255
- readonly advance: readonly [number, number];
2256
- /** Maximum logical line advance in millimetres, including spaces; arc length on circular baselines. */
2257
- readonly logicalWidth: number;
2258
- /** Selected font's ascender distance above a baseline in millimetres, independent of the text. */
2259
- readonly ascent: number;
2260
- /** Selected font's descender distance below a baseline in millimetres, a non-negative value. */
2261
- readonly descent: number;
2262
- /** Actual distance between baselines in millimetres. */
2263
- readonly lineHeight: number;
2264
- /** Number of lines, including empty and trailing lines; empty text occupies one line. */
2265
- readonly lineCount: number;
2266
- }
2267
-
2268
- export { }
1
+ /** Imported modeling operations and opaque host-owned contracts. @packageDocumentation */
2
+
3
+ /** ACME 29-degree included-angle profile. */
4
+ declare interface AcmeThreadProfileSpec extends ThreadProfileBaseSpec {
5
+ /** Selects the 29-degree ACME profile family. */
6
+ readonly kind: "acme";
7
+ /**
8
+ * Radial depth in millimetres.
9
+ * @defaultValue `pitch / 2`
10
+ */
11
+ readonly depth?: number;
12
+ }
13
+
14
+ /**
15
+ * Reads a copied, immutable named anchor from this exact active generation.
16
+ *
17
+ * @example Read the top datum
18
+ * ```ts
19
+ * const plate = box({ size: [30, 20, 6] });
20
+ * anchor(plate, "top"); // position [0, 0, 3], direction [0, 0, 1]
21
+ * ```
22
+ */
23
+ export declare function anchor(shape: Solid | Section, name: string): Anchor3;
24
+
25
+ /**
26
+ * An attachment pose on a solid or assembly.
27
+ *
28
+ * `direction` is the outward attachment normal. `up` controls roll and must not
29
+ * be parallel to `direction`; anchor construction projects and normalizes it.
30
+ */
31
+ export declare interface Anchor3 {
32
+ /** Unit outward normal used as the anchor's local +Z direction. */
33
+ readonly direction: Vector3;
34
+ /** World-space attachment position. */
35
+ readonly position: Vector3;
36
+ /** Roll guide projected into the plane perpendicular to `direction`. */
37
+ readonly up: Vector3;
38
+ }
39
+
40
+ /**
41
+ * Degree-based anchor attachment controls for a scoped solid.
42
+ */
43
+ export declare interface AttachOptions {
44
+ /** Align outward directions face-to-face (`opposed`) or in parallel (`same`). */
45
+ readonly alignment?: "opposed" | "same";
46
+ /** Separation along the target anchor's outward direction in millimetres. */
47
+ readonly gap?: number;
48
+ /** Additional right-handed roll about the attached direction, in degrees. */
49
+ readonly spinDegrees?: number;
50
+ /** Optional numeric comparison overrides. */
51
+ readonly tolerance?: GeometryToleranceOptions;
52
+ }
53
+
54
+ /** Axis-aligned bounds in two-dimensional model space. */
55
+ export declare interface Bounds2 {
56
+ /** Inclusive maximum X/Y coordinates. */
57
+ readonly max: Vector2;
58
+ /** Inclusive minimum X/Y coordinates. */
59
+ readonly min: Vector2;
60
+ }
61
+
62
+ /** Axis-aligned bounds in three-dimensional model space. */
63
+ export declare interface Bounds3 {
64
+ /** Inclusive maximum X/Y/Z coordinates. */
65
+ readonly max: Vector3;
66
+ /** Inclusive minimum X/Y/Z coordinates. */
67
+ readonly min: Vector3;
68
+ }
69
+
70
+ /**
71
+ * Axis-aligned box with uniform or disjoint named edge/group treatments.
72
+ *
73
+ * @example Rounded box
74
+ * ```ts
75
+ * box({ size: [30, 20, 8], treatment: { kind: "round", radius: 2 } });
76
+ * ```
77
+ */
78
+ export declare function box(options: BoxOptions): Solid;
79
+
80
+ /** Box edges use +Z top, +Y front and +X right; vertical names list front/back first. */
81
+ export declare type BoxEdge =
82
+ | "top-front"
83
+ | "top-back"
84
+ | "top-left"
85
+ | "top-right"
86
+ | "bottom-front"
87
+ | "bottom-back"
88
+ | "bottom-left"
89
+ | "bottom-right"
90
+ | "front-left"
91
+ | "front-right"
92
+ | "back-left"
93
+ | "back-right";
94
+
95
+ /** Named individual edges or top/bottom rims and all four vertical edges. */
96
+ export declare type BoxEdgeSelection = BoxEdge | "top" | "bottom" | "vertical";
97
+
98
+ /** Independent treatments for disjoint named edge selections; overlapping selections fail. */
99
+ export declare type BoxEdgeTreatments = Readonly<
100
+ Partial<Record<BoxEdgeSelection, EdgeTreatment>>
101
+ >;
102
+
103
+ /**
104
+ * Dimensions, placement, and uniform or independently selected finishing for an axis-aligned box.
105
+ */
106
+ export declare interface BoxOptions extends PrimitivePlacement {
107
+ /** Explicit sampling ceilings for edge treatments, bounded by the host policy. */
108
+ readonly limits?: Partial<GeometrySamplingLimits>;
109
+ /**
110
+ * Centers the box on the XYZ origin when `true`; otherwise its minimum corner is at the origin.
111
+ * @defaultValue `true`
112
+ */
113
+ readonly center?: boolean;
114
+ /** Positive uniform size or explicit `[X, Y, Z]` extents in millimetres. */
115
+ readonly size: number | Vector3;
116
+ /** Uniform treatment or independent disjoint nominal edge/group treatments. */
117
+ readonly treatment?: EdgeTreatment | BoxEdgeTreatments;
118
+ }
119
+
120
+ /** Axial side carrying the near-normal pressure flank of a buttress thread. */
121
+ declare type ButtressPressureFlankSide = "negative" | "positive";
122
+
123
+ /** Asymmetric printable buttress profile with 7/45-degree flanks. */
124
+ declare interface ButtressThreadProfileSpec extends ThreadProfileBaseSpec {
125
+ /** Selects the asymmetric printable buttress profile family. */
126
+ readonly kind: "buttress";
127
+ /**
128
+ * Radial depth in millimetres.
129
+ * @defaultValue `0.66271 * pitch`
130
+ */
131
+ readonly depth?: number;
132
+ /**
133
+ * Axial side of each tooth carrying the 7-degree pressure flank. The opposite side uses the
134
+ * 45-degree clearance flank.
135
+ * @defaultValue `"positive"`
136
+ */
137
+ readonly pressureFlankSide?: ButtressPressureFlankSide;
138
+ }
139
+
140
+ /**
141
+ * A planar edge or corner chamfer with equal or independent surface setbacks.
142
+ */
143
+ export declare interface ChamferedEdgeTreatment {
144
+ /** Selects a straight bevel between adjoining surfaces. */
145
+ readonly kind: "chamfer";
146
+ /** Millimetre setbacks, equal or [first surface, second surface]. Zero or [0, 0] leaves the edge untreated; otherwise both must be positive and fit without overlap. */
147
+ readonly distance: number | readonly [first: number, second: number];
148
+ }
149
+
150
+ /**
151
+ * Centered circular section.
152
+ *
153
+ * @example Size to polygon faces
154
+ * ```ts
155
+ * circle({ diameter: 12, sizing: "face" });
156
+ * ```
157
+ */
158
+ export declare function circle(options: CircleOptions): Section;
159
+
160
+ /**
161
+ * Circular profile dimensions with exactly one radius or diameter and explicit sampling.
162
+ */
163
+ export declare type CircleContourOptions = CircularPrimitiveOptions &
164
+ RadialSizingOptions &
165
+ (
166
+ | {
167
+ /** Positive nominal radius in millimetres; mutually exclusive with diameter. */
168
+ readonly radius: number;
169
+ /** Full diameter is unavailable when radius is supplied. */
170
+ readonly diameter?: never;
171
+ }
172
+ | {
173
+ /** Positive full diameter in millimetres; mutually exclusive with radius. */
174
+ readonly diameter: number;
175
+ /** Radius is unavailable when diameter is supplied. */
176
+ readonly radius?: never;
177
+ }
178
+ );
179
+
180
+ /**
181
+ * Circular dimensions with exactly one nominal radius or diameter.
182
+ */
183
+ export declare type CircleOptions = CircleContourOptions & PrimitivePlacement;
184
+
185
+ /**
186
+ * Tessellation controls shared by circular primitives across Geometry entry points.
187
+ */
188
+ export declare interface CircularPrimitiveOptions {
189
+ /** Explicit sampling ceilings; bound modeling operations may only lower the host policy. */
190
+ readonly limits?: Partial<GeometrySamplingLimits>;
191
+ /**
192
+ * Exact circumferential segment count from three through the configured safety limit.
193
+ *
194
+ * This local topology override takes precedence over {@link CircularPrimitiveOptions.resolution}
195
+ * and any active model-wide resolution policy.
196
+ */
197
+ readonly segments?: number;
198
+ /** Operation-level physical tessellation policy over the active model-wide policy. */
199
+ readonly resolution?: GeometryResolution;
200
+ }
201
+
202
+ /**
203
+ * Separates a solid's disconnected surface shells into same-session solid handles.
204
+ *
205
+ * For solids without enclosed cavities, these shells are the disconnected material islands.
206
+ * Enclosed cavities produce separate inward shells with negative signed volume; these cannot
207
+ * be finalized alone as manufacturing parts. This does not cut connected geometry.
208
+ *
209
+ * @example Move disconnected pieces independently
210
+ * ```ts
211
+ * const islands = union([box({ size: 8 }), box({ size: 8 }).translate([12, 0, 0])]);
212
+ * const pieces = components(islands);
213
+ * // Component order is unspecified; the index only sets a display height here.
214
+ * union(pieces.map((piece, index) => piece.translate([0, 0, index * 6])));
215
+ * ```
216
+ */
217
+ export declare function components(solid: Solid): readonly Solid[];
218
+
219
+ /** Separates filled 2D islands into sections, retaining each island's holes; empty gives []. */
220
+ export declare function components(section: Section): readonly Section[];
221
+
222
+ /** Combines disjoint components without resolving overlap. */
223
+ export declare function compose(solids: readonly Solid[]): Solid;
224
+
225
+ /** A lazy session-owned reader. Calling it tracks its output in the current computation. */
226
+ export declare interface Computed<T> {
227
+ /** Compile-time ownership brand; readers are created by the engine's context helper. */
228
+ readonly [computedBrand]: "Computed";
229
+ /** Reads immutable data or a deferred recipe; evaluation is synchronous and cached. */
230
+ (): T;
231
+ }
232
+
233
+ declare const computedBrand: unique symbol;
234
+
235
+ /** A value supplied immediately or by a lazy computed reader. */
236
+ export declare type ComputedValue<T> = T | Computed<T>;
237
+
238
+ /**
239
+ * A closed two-dimensional boundary whose first point is not repeated at the end.
240
+ *
241
+ * Polygon exteriors are counter-clockwise and holes are clockwise. Algorithms
242
+ * may reject duplicate adjacent points or fewer than three effective vertices.
243
+ */
244
+ export declare type Contour = readonly Vector2[];
245
+
246
+ /** One sampled component retaining contour identities and logical point correspondence. */
247
+ export declare interface CorrespondingComponent {
248
+ /** Stable canonical lowercase identity; unique within the containing topology or output. */
249
+ readonly id: string;
250
+ /** Counterclockwise outer contour. */
251
+ readonly outer: CorrespondingContour;
252
+ /** Clockwise hole contours belonging to this component. */
253
+ readonly holes: readonly CorrespondingContour[];
254
+ }
255
+
256
+ /** A sampled contour retaining logical slots, including intentionally collapsed spans. */
257
+ export declare interface CorrespondingContour {
258
+ /** Stable canonical lowercase identity; unique within the containing topology or output. */
259
+ readonly id: string;
260
+ /** Ordered sampled points in millimetres; closing vertices are implicit. */
261
+ readonly points: Contour;
262
+ /** One span identity per point; indices correspond between every matched family member. */
263
+ readonly spans: readonly string[];
264
+ }
265
+
266
+ /** Shared logical contour sampling suitable for a loft or hollow sweep. */
267
+ export declare interface CorrespondingProfile {
268
+ /** Ordered components with explicit contour identities. */
269
+ readonly components: readonly CorrespondingComponent[];
270
+ }
271
+
272
+ /** One already matched profile at an explicit height or right-handed spatial frame. */
273
+ export declare type CorrespondingProfileStation = LoftPlacement & {
274
+ /** Already corresponding filled contours with authoritative landmark slots. */
275
+ readonly profile: CorrespondingProfile;
276
+ };
277
+
278
+ /** Caller-defined periodic axial/radial profile in millimetres. */
279
+ declare interface CustomThreadProfileSpec extends ThreadProfileBaseSpec {
280
+ /** Selects a caller-defined periodic profile. */
281
+ readonly kind: "custom";
282
+ /**
283
+ * Open path spanning exactly `[-pitch/2, pitch/2]`, with both endpoints on the minor envelope,
284
+ * one connected ridge, one contiguous crest, and radial zero at the major envelope.
285
+ */
286
+ readonly points: readonly Vector2[];
287
+ }
288
+
289
+ /**
290
+ * +Z cylinder or frustum. Face sizing compensates polygon faceting.
291
+ *
292
+ * @example Cylinder
293
+ * ```ts
294
+ * cylinder({ height: 20, radius: 10 });
295
+ * ```
296
+ *
297
+ * @example Cone
298
+ * ```ts
299
+ * cylinder({ height: 20, radius: [10, 0] });
300
+ * ```
301
+ */
302
+ export declare function cylinder(options: CylinderOptions): Solid;
303
+
304
+ /**
305
+ * Dimensions, placement, independent end finishing, and tessellation for a Z-axis cylinder or frustum.
306
+ */
307
+ export declare type CylinderOptions = CircularPrimitiveOptions &
308
+ RadialSizingOptions &
309
+ PrimitivePlacement & {
310
+ /**
311
+ * Centers the solid on the Z origin when `true`; otherwise its bottom is at `Z = 0`.
312
+ * @defaultValue `true`
313
+ */
314
+ readonly center?: boolean;
315
+ /** Independent end treatments; first setback is cap inset and second follows the sloped side. */
316
+ readonly ends?: EndTreatments;
317
+ /** Total height along +Z in millimetres. */
318
+ readonly height: number;
319
+ } & (
320
+ | {
321
+ /** Positive uniform radius or nonnegative `[bottom, top]` radii in millimetres; one must be positive. */
322
+ readonly radius: number | readonly [bottom: number, top: number];
323
+ /** Full diameter is unavailable when radius is supplied. */
324
+ readonly diameter?: never;
325
+ }
326
+ | {
327
+ /** Positive uniform diameter or nonnegative `[bottom, top]` diameters in millimetres; one must be positive. */
328
+ readonly diameter: number | readonly [bottom: number, top: number];
329
+ /** Radius is unavailable when diameter is supplied. */
330
+ readonly radius?: never;
331
+ }
332
+ );
333
+
334
+ /** Typed parameter association for an assertion or warning. */
335
+ export declare interface DiagnosticOptions<P> {
336
+ /** Existing top-level parameter key. */
337
+ readonly parameterId?: Extract<keyof P, string> | undefined;
338
+ }
339
+
340
+ /**
341
+ * Measures the minimum separation between two nonempty solids in millimetres.
342
+ *
343
+ * Uses actual geometry, not bounding-box separation or distance between object origins.
344
+ * Contact or overlapping material returns zero, including one solid inside another.
345
+ * The kernel's search range is managed internally; the result is not capped at a caller limit.
346
+ * Empty, expired or foreign-build handles reject. Results follow native numeric precision.
347
+ *
348
+ * @example Measure the gap between two blocks
349
+ * ```ts
350
+ * const left = box({ size: 10 });
351
+ * const right = box({ size: 10 }).translate([13, 0, 0]);
352
+ * const gap = distance(left, right); // 3 mm
353
+ * ```
354
+ */
355
+ export declare function distance(solid: Solid, other: Solid): number;
356
+
357
+ /**
358
+ * Uniform finishing vocabulary shared by applicable solid edges and profile corners.
359
+ */
360
+ export declare type EdgeTreatment =
361
+ | ChamferedEdgeTreatment
362
+ | RoundedEdgeTreatment
363
+ | SmoothEdgeTreatment
364
+ | ProfiledEdgeTreatment;
365
+
366
+ /**
367
+ * Centered elliptical section.
368
+ *
369
+ * @example Ellipse by full dimensions
370
+ * ```ts
371
+ * ellipse({ size: [30, 20] });
372
+ * ```
373
+ */
374
+ export declare function ellipse(options: EllipseOptions): Section;
375
+
376
+ /**
377
+ * Ellipse dimensions with exactly one XY radii or full-size tuple and explicit sampling.
378
+ */
379
+ export declare type EllipseContourOptions = CircularPrimitiveOptions &
380
+ (
381
+ | {
382
+ /** Positive XY radii in millimetres; mutually exclusive with size. */
383
+ readonly radius: Vector2;
384
+ /** Full XY extents are unavailable when radius is supplied. */
385
+ readonly size?: never;
386
+ }
387
+ | {
388
+ /** Positive full XY extents in millimetres; mutually exclusive with radius. */
389
+ readonly size: Vector2;
390
+ /** XY radii are unavailable when size is supplied. */
391
+ readonly radius?: never;
392
+ }
393
+ );
394
+
395
+ /**
396
+ * Ellipse dimensions in local XY, with exactly one radii or full-size tuple.
397
+ */
398
+ export declare type EllipseOptions = EllipseContourOptions & PrimitivePlacement;
399
+
400
+ /**
401
+ * Independent inward finishing on primitive or straight convex extrusion ends.
402
+ * Zero amounts leave the end untreated, including when all ends are disabled.
403
+ */
404
+ export declare interface EndTreatments {
405
+ /** Bottom cap and adjoining side; omitted leaves the end untreated. */
406
+ readonly bottom?: EdgeTreatment;
407
+ /** Top cap and adjoining side; omitted leaves the end untreated. */
408
+ readonly top?: EdgeTreatment;
409
+ }
410
+
411
+ /**
412
+ * Extrudes explicit corresponding contours along +Z with degree twist and top scaling.
413
+ * Filled Sections use `section.extrude(options)`.
414
+ *
415
+ * @example Extrude
416
+ * ```ts
417
+ * import { extrude, matchProfiles } from "@metamesh/modeling";
418
+ * import { rectangleProfile } from "@metamesh/modeling/geometry";
419
+ *
420
+ * const [profile] = matchProfiles([rectangleProfile({ size: [30, 20] })]);
421
+ * extrude(profile!, { height: 8 });
422
+ * ```
423
+ */
424
+ export declare function extrude(
425
+ shape: CorrespondingProfile,
426
+ options: ExtrudeOptions,
427
+ ): Solid;
428
+
429
+ /**
430
+ * Dimensions and sampling shared by native and pure +Z extrusion.
431
+ */
432
+ export declare interface ExtrudeOptions extends ExtrusionSamplingOptions {
433
+ /** Positive extrusion height in millimetres. */
434
+ readonly height: number;
435
+ /** Center the extrusion on Z; otherwise its bottom is at zero. Defaults to false. */
436
+ readonly center?: boolean;
437
+ /** Independent inward end treatments on straight convex single-contour extrusions. */
438
+ readonly ends?: EndTreatments;
439
+ }
440
+
441
+ /** Shared sampling controls for a twisted or scaled linear extrusion. */
442
+ declare interface ExtrusionSamplingOptions {
443
+ /** Exact number of intermediate profiles, nonnegative; overrides physical sampling. */
444
+ readonly divisions?: number;
445
+ /** Explicit output and sampling allocation ceilings. */
446
+ readonly limits?: Partial<ModelingLimits>;
447
+ /** Operation-level physical policy over the nearest model scope. */
448
+ readonly resolution?: GeometryResolution;
449
+ /** Finite uniform or XY scale of the top profile; defaults to one. */
450
+ readonly scaleTop?: number | Vector2;
451
+ /** Finite rotation of the top profile about +Z, in degrees; defaults to zero. */
452
+ readonly twistDegrees?: number;
453
+ }
454
+
455
+ /** Finalized manufacturing snapshot. Its arrays are independent of all native values. */
456
+ export declare interface FinalizedModel {
457
+ /** Ordered finalized manufacturing parts with copied transferable arrays. */
458
+ readonly parts: readonly FinalizedPart[];
459
+ /** Axis-aligned XYZ bounds in millimetres. */
460
+ readonly bounds: Bounds3;
461
+ /** Aggregate counts, unique backing storage, volume, and execution timings. */
462
+ readonly stats: {
463
+ /** Aggregate position-buffer vertex count. */
464
+ readonly vertices: number;
465
+ /** Aggregate indexed triangle count. */
466
+ readonly triangles: number;
467
+ /** Signed enclosed volume of all selected parts in cubic millimetres. */
468
+ readonly volumeMm3: number;
469
+ /** Unique transferable backing-buffer bytes, counted once across all parts. */
470
+ readonly bytes: number;
471
+ /** Synchronous callback duration in milliseconds. */
472
+ readonly buildMs: number;
473
+ /** Manufacturing validation and buffer finalization duration in milliseconds. */
474
+ readonly finalizationMs: number;
475
+ /** Total callback and finalization duration in milliseconds. */
476
+ readonly generationMs: number;
477
+ };
478
+ }
479
+
480
+ /** Copied manufacturing part with facts computed from the finalized mesh. */
481
+ export declare interface FinalizedPart extends TriangleMesh {
482
+ /** Stable canonical lowercase identity; unique within the containing topology or output. */
483
+ readonly id: string;
484
+ /** Optional six-digit hex RGB display color. */
485
+ readonly color?: string;
486
+ /** Fresh validated facts for these exact finalized buffers. */
487
+ readonly measurements: TriangleMeshAnalysis;
488
+ }
489
+
490
+ /** A right-handed orthonormal coordinate frame expressed in world coordinates. */
491
+ export declare interface Frame3 {
492
+ /** World-space origin of the local frame. */
493
+ readonly origin: Vector3;
494
+ /** Unit vector defining the local +X axis. */
495
+ readonly xAxis: Vector3;
496
+ /** Unit vector defining the local +Y axis. */
497
+ readonly yAxis: Vector3;
498
+ /** Unit vector defining the local +Z axis. */
499
+ readonly zAxis: Vector3;
500
+ }
501
+
502
+ /** Imports explicit region topology once. */
503
+ export declare function fromRegion(region: Region): Section;
504
+
505
+ /**
506
+ * Defines a typed model without executing it. Use `computed` only for work worth reusing.
507
+ *
508
+ * @example A simple model
509
+ * ```ts
510
+ * const model = generate<{ height: number }>(({ params, part, assert }) => {
511
+ * assert(params.height > 0, "Height must be positive.");
512
+ * return part("body", box({ size: [10, 10, params.height] }));
513
+ * });
514
+ * ```
515
+ */
516
+ export declare function generate<P, S = Record<never, never>>(
517
+ callback: GenerateCallback<P, S>,
518
+ ): ModelProgram<P, S>;
519
+
520
+ /** Pure synchronous callback returning one declared part or an array; caches are optional. */
521
+ export declare type GenerateCallback<P, S = Record<never, never>> = (
522
+ context: GenerateContext<P, S>,
523
+ ) => GeneratedPart | readonly GeneratedPart[];
524
+
525
+ /** The sole synchronous authoring context, supplied independently of Studio. */
526
+ export declare interface GenerateContext<P, S = Record<never, never>> {
527
+ /** Frozen ordinary parameter values; synchronous top-level reads are tracked. */
528
+ readonly params: Readonly<P>;
529
+ /** Host-prepared readonly synchronous capabilities, fixed for the session. */
530
+ readonly services: Readonly<S>;
531
+ /**
532
+ * Registers a lazy pure calculation and automatically tracks parameter and computed-reader reads.
533
+ * Optional dependencies add changing outer captures; entries compare with Object.is. Objects and
534
+ * arrays must be deeply immutable. An empty list still tracks reads inside the callback.
535
+ */
536
+ readonly computed: <T>(
537
+ id: string,
538
+ callback: () => T,
539
+ dependencies?: readonly unknown[],
540
+ ) => Computed<T>;
541
+ /** Declares a semantic part with identity placement, or explicit placement and appearance. */
542
+ readonly part: {
543
+ (id: string, geometry: ComputedValue<PartGeometry>): GeneratedPart;
544
+ (id: string, options: PartOptions): GeneratedPart;
545
+ };
546
+ /** Immediately aborts on false; geometry observations in the condition run first. */
547
+ readonly assert: {
548
+ (condition: false, message: string, options?: DiagnosticOptions<P>): never;
549
+ (condition: boolean, message: string, options?: DiagnosticOptions<P>): void;
550
+ };
551
+ /** Records a nonblocking issue; call only in the outer generation callback. */
552
+ readonly warn: (message: string, options?: DiagnosticOptions<P>) => void;
553
+ }
554
+
555
+ /** One declared output part. Construct with the context's `part` helper. */
556
+ export declare interface GeneratedPart extends PartOptions {
557
+ /** Unique canonical lowercase hyphen-separated identity, at most 64 characters. */
558
+ readonly id: string;
559
+ }
560
+
561
+ /** Structured user-facing issue associated with the attempted revision. */
562
+ export declare interface GenerationDiagnostic {
563
+ /** An error aborts generation; a warning allows generation to continue. */
564
+ readonly severity: "error" | "warning";
565
+ /** Human-readable corrective guidance. */
566
+ readonly message: string;
567
+ /** Optional control identity, validated against the supplied parameters. */
568
+ readonly parameterId?: string | undefined;
569
+ }
570
+
571
+ /** A user-correctable assertion failure. Successful computation caches never retain failures. */
572
+ export declare class GenerationError extends Error {
573
+ /** Issues reached in normal JavaScript order, ending with the first failed assertion. */
574
+ readonly diagnostics: readonly GenerationDiagnostic[];
575
+ /** Captures immutable diagnostics; unexpected author errors retain their original type. */
576
+ constructor(diagnostics: readonly GenerationDiagnostic[]);
577
+ }
578
+
579
+ /**
580
+ * Tessellation policy for sampled geometry measured in millimetres.
581
+ */
582
+ export declare interface GeometryResolution {
583
+ /** Optional exact full-circle segment count, of at least three, bounded by the selected circular ceiling. */
584
+ readonly circularSegments?: number;
585
+ /** Maximum radial chord error in millimetres; defaults to 0.05. */
586
+ readonly maxChordError?: number;
587
+ /** Optional maximum sampled edge length in millimetres. */
588
+ readonly maxSegmentLength?: number;
589
+ /** Upper safety bound for a full circle; defaults to the selected maxCircularSegments (512 by default). */
590
+ readonly maximumSegments?: number;
591
+ /** Lower full-circle segment count; defaults to 16 or a lower selected circular ceiling. */
592
+ readonly minimumSegments?: number;
593
+ }
594
+
595
+ /** Explicit allocation ceilings for pure sampling and host-owned modeling operations. */
596
+ export declare interface GeometrySamplingLimits {
597
+ /** Maximum points in one sampled path or placement/frame result. */
598
+ readonly maxPathPoints: number;
599
+ /** Maximum aggregate points in one sampled profile or Section. */
600
+ readonly maxProfilePoints: number;
601
+ /** Maximum points in one profile swept along a path. */
602
+ readonly maxSweepProfilePoints: number;
603
+ /** Maximum segments around one complete circle. */
604
+ readonly maxCircularSegments: number;
605
+ }
606
+
607
+ /** Optional overrides for MetaMesh's geometry comparison policy. */
608
+ export declare interface GeometryToleranceOptions {
609
+ /** Absolute distance floor in model units. Must be finite and greater than zero. */
610
+ readonly absolute?: number;
611
+ /** Angular comparison threshold in radians. Must be finite and greater than zero. */
612
+ readonly angular?: number;
613
+ /** Dimensionless scale multiplier. Must be finite and non-negative. */
614
+ readonly relative?: number;
615
+ }
616
+
617
+ /**
618
+ * XY or XYZ copies, optionally centered or placed in an explicit frame.
619
+ *
620
+ * @example Centered XY grid
621
+ * ```ts
622
+ * gridPattern(box({ size: 4 }), { count: [3, 2], spacing: [10, 10], center: true });
623
+ * ```
624
+ */
625
+ export declare function gridPattern(
626
+ source: PatternSource,
627
+ options: GridPatternOptions,
628
+ ): readonly Solid[];
629
+
630
+ /** Repeats a filled Section on a grid; placements must preserve its XY plane. */
631
+ export declare function gridPattern(
632
+ source: PatternSource<Section>,
633
+ options: GridPatternOptions,
634
+ ): readonly Section[];
635
+
636
+ /**
637
+ * XY or XYZ grid with X varying fastest. The first item starts at the local origin.
638
+ */
639
+ export declare type GridPatternOptions = {
640
+ /** Center the complete distribution around its local origin; defaults to false. */
641
+ readonly center?: boolean;
642
+ /** Optional right-handed local axes and origin for the grid. */
643
+ readonly frame?: Frame3;
644
+ } & (
645
+ | {
646
+ /** Positive integer counts on X and Y. */
647
+ readonly count: Vector2;
648
+ /** Signed millimetres between adjacent copies on X and Y. */
649
+ readonly spacing: Vector2;
650
+ }
651
+ | {
652
+ /** Positive integer counts on X, Y and Z. */
653
+ readonly count: Vector3;
654
+ /** Signed millimetres between adjacent copies on X, Y and Z. */
655
+ readonly spacing: Vector3;
656
+ }
657
+ );
658
+
659
+ /**
660
+ * Closed rectilinear top above a flat base, with uniform or explicit XY coordinates.
661
+ * Samples each grid height once; center-error triangulation also samples each cell centre.
662
+ *
663
+ * @example Heightfield
664
+ * ```ts
665
+ * heightfield({
666
+ * size: [30, 20], segments: [24, 16],
667
+ * height: ([x, y]) => 3 + Math.cos(x / 5) * Math.cos(y / 5),
668
+ * });
669
+ * ```
670
+ */
671
+ export declare function heightfield(options: HeightfieldOptions): Solid;
672
+
673
+ /**
674
+ * A closed rectilinear heightfield above a flat base, with uniform or explicit XY samples in millimetres.
675
+ *
676
+ * Uniform sampling requires positive `size: [width, depth]` and positive integer `segments: [x, y]`.
677
+ * Optional `origin` sets the lower-left XY corner; omitting it centres the footprint on XY.
678
+ * Alternatively, supply `coordinates: { x, y }` with at least two strictly increasing finite
679
+ * absolute samples per axis, distinct in Float32. This infers the footprint and interval counts;
680
+ * `size`, `segments`, and `origin` cannot be combined with explicit coordinates.
681
+ */
682
+ export declare type HeightfieldOptions = {
683
+ /** Absolute top Z at the supplied XY point. Every sample must be above baseZ. */
684
+ readonly height: (point: Vector2) => number;
685
+ /** Flat bottom Z. Defaults to zero. */
686
+ readonly baseZ?: number;
687
+ /**
688
+ * Top-cell diagonal policy. Defaults to fixed (lower-left to upper-right).
689
+ * min-edge selects the shorter 3D diagonal; center-error selects the diagonal whose endpoint
690
+ * average is closest to one extra height sample at the physical cell centre. Ties use fixed.
691
+ * All policies retain two triangles per cell; neither estimates error elsewhere in the cell.
692
+ */
693
+ readonly triangulation?: "fixed" | "min-edge" | "center-error";
694
+ } & (
695
+ | {
696
+ /** Positive XY footprint for uniform sampling. */
697
+ readonly size: Vector2;
698
+ /** Exact positive integer X/Y interval counts. */
699
+ readonly segments: readonly [x: number, y: number];
700
+ /** Lower-left footprint XY. Omitted centers the footprint on XY. */
701
+ readonly origin?: Vector2;
702
+ /** Explicit coordinates cannot be combined with uniform sampling. */
703
+ readonly coordinates?: never;
704
+ }
705
+ | {
706
+ /**
707
+ * Absolute XY coordinates, each with at least two strictly increasing finite values that
708
+ * remain distinct in Float32. Uneven spacing permits caller-owned local refinement.
709
+ */
710
+ readonly coordinates: {
711
+ /** Absolute X samples in ascending order. */
712
+ readonly x: readonly number[];
713
+ /** Absolute Y samples in ascending order. */
714
+ readonly y: readonly number[];
715
+ };
716
+ /** The footprint is inferred from explicit coordinates. */
717
+ readonly size?: never;
718
+ /** Interval counts are inferred from explicit coordinates. */
719
+ readonly segments?: never;
720
+ /** Explicit coordinates already include their origin. */
721
+ readonly origin?: never;
722
+ }
723
+ );
724
+
725
+ /** Runtime-neutral options for the dedicated helical ridge mesher. */
726
+ export declare interface HelicalThreadRidgeMeshOptions {
727
+ /**
728
+ * Optional bottom/top ridge-end treatments. Standalone ridges honor the requested boundaries;
729
+ * BOSL2-style non-cut lead-in scaling is available on complete thread solids.
730
+ */
731
+ readonly ends?: ThreadEndTreatmentOptions;
732
+ /** Helix direction. Default: `right`. */
733
+ readonly handedness?: ThreadHandedness;
734
+ /** Total threaded axial length in millimetres. */
735
+ readonly length: number;
736
+ /** Explicit output and circular allocation ceilings. */
737
+ readonly limits?: Partial<ModelingLimits>;
738
+ /** Nominal major diameter before any caller-owned fit compensation. */
739
+ readonly majorDiameter: number;
740
+ /** Angular offset of the first start in degrees. Default: `0`. */
741
+ readonly phaseDegrees?: number;
742
+ /** Validated periodic profile repeated around the shaft. */
743
+ readonly profile: ThreadProfile;
744
+ /** Optional circular-resolution policy. */
745
+ readonly resolution?: GeometryResolution;
746
+ /** Number of evenly phased starts. Default: `1`. */
747
+ readonly starts?: number;
748
+ /** Optional numerical tolerance overrides. */
749
+ readonly tolerance?: GeometryToleranceOptions;
750
+ }
751
+
752
+ /** Conservative allocation facts resolved before constructing a direct thread solid mesh. */
753
+ export declare interface HelicalThreadSolidMeshPreflight {
754
+ /** Uniform axial intervals required only by a requested physical segment-length limit. */
755
+ readonly axialIntervals: number;
756
+ /** Start-aligned full-circle segment count used by the surface mesh. */
757
+ readonly circularSegments: number;
758
+ /** Conservative surface-row count across profile breaks, ends, and bevel stations. */
759
+ readonly estimatedRows: number;
760
+ /** Conservative triangle count used by the selected output allocation policy. */
761
+ readonly estimatedTriangles: number;
762
+ }
763
+
764
+ /**
765
+ * Convex hull of points or solids.
766
+ *
767
+ * @example Hull
768
+ * ```ts
769
+ * const left = sphere({ radius: 5 }).translate([-10, 0, 0]);
770
+ * const right = sphere({ radius: 5 }).translate([10, 0, 0]);
771
+ * hull({ solids: [left, right] });
772
+ * ```
773
+ */
774
+ export declare function hull(options: HullOptions): Solid;
775
+
776
+ /** Convex filled XY hull of finite points or same-session sections. */
777
+ export declare function hull(options: SectionHullOptions): Section;
778
+
779
+ /** Hull inputs are either finite points or same-session solids. */
780
+ export declare type HullOptions =
781
+ | {
782
+ /** Finite millimetre XYZ points to include in the convex hull. */
783
+ readonly points: readonly Vector3[];
784
+ /** Point input excludes solid input. */
785
+ readonly solids?: never;
786
+ }
787
+ | {
788
+ /** Same-build solids to include in the convex hull. */
789
+ readonly solids: readonly Solid[];
790
+ /** Solid input excludes point input. */
791
+ readonly points?: never;
792
+ };
793
+
794
+ /** Owned immutable numeric data. Use copy() to obtain mutable storage for numerical work. */
795
+ export declare interface ImmutableBuffer<T extends NumericArray> {
796
+ /** Opaque element-storage brand; construct buffers with immutableBuffer(). */
797
+ readonly [immutableBufferBrand]: T;
798
+ /** Number of numeric elements, independent of their byte width. */
799
+ readonly length: number;
800
+ /** Reads an integer offset; negative offsets count from the end. Invalid offsets return undefined. */
801
+ at(this: void, index: number): number | undefined;
802
+ /** Returns a fresh mutable array of the original numeric type; never exposes cached storage. */
803
+ copy(this: void): T;
804
+ }
805
+
806
+ /**
807
+ * Copies numeric data once into private storage. This pure helper needs no active generation.
808
+ * @example
809
+ * ```ts
810
+ * import { immutableBuffer } from "@metamesh/modeling";
811
+ * const heights = immutableBuffer(new Float32Array([2, 4, 6]));
812
+ * const count = heights.length;
813
+ * const first = heights.at(0);
814
+ * const editable = heights.copy();
815
+ * editable[0] = 8; // heights still contains 2, 4, 6.
816
+ * ```
817
+ */
818
+ export declare function immutableBuffer<T extends NumericArray>(
819
+ source: T,
820
+ ): ImmutableBuffer<T>;
821
+
822
+ declare const immutableBufferBrand: unique symbol;
823
+
824
+ /**
825
+ * Copies mesh buffers into immutable data; geometric validation still occurs when modeling or finalizing.
826
+ * @example
827
+ * ```ts
828
+ * import { generate, immutableMesh } from "@metamesh/modeling";
829
+ * import { heightfieldMesh } from "@metamesh/modeling/geometry";
830
+ * const model = generate(({ computed, part }) => {
831
+ * const surface = computed("surface", () => immutableMesh(heightfieldMesh({
832
+ * size: [10, 10], segments: [8, 8], height: () => 2,
833
+ * })));
834
+ * return [part("surface", surface)];
835
+ * });
836
+ * ```
837
+ */
838
+ export declare function immutableMesh(
839
+ mesh: TriangleMesh,
840
+ ): ImmutableTriangleMesh;
841
+
842
+ /** Immutable local XYZ positions and triangle indices, suitable for a computed value or part. */
843
+ export declare interface ImmutableTriangleMesh {
844
+ /** Packed XYZ coordinates in millimetres. */
845
+ readonly positions: ImmutableBuffer<Float32Array>;
846
+ /** Zero-based vertex indices, three per triangle. */
847
+ readonly indices: ImmutableBuffer<Uint32Array>;
848
+ }
849
+
850
+ /** Bounded positive-inside implicit field constructor. */
851
+ export declare function implicit(options: ImplicitOptions): Solid;
852
+
853
+ /** Positive-inside sampling, bounded to 4M native BCC grid slots and 8M field calls. */
854
+ export declare interface ImplicitOptions {
855
+ /** Positive-inside scalar field evaluated at finite XYZ points. */
856
+ readonly field: (point: Vector3) => number;
857
+ /** Axis-aligned XYZ bounds in millimetres. */
858
+ readonly bounds: Bounds3;
859
+ /** Positive sampling edge length in millimetres. */
860
+ readonly edgeLength: number;
861
+ /** Field isosurface value; defaults to zero. */
862
+ readonly level?: number;
863
+ /** Positive native geometric tolerance in millimetres; omitted uses interpolated grid crossings. */
864
+ readonly tolerance?: number;
865
+ }
866
+
867
+ /**
868
+ * Copies lightweight section measurements.
869
+ *
870
+ * @example Check filled area
871
+ * ```ts
872
+ * const facts = inspectSection(rectangle({ size: [20, 10] }));
873
+ * facts.area; // 200 mm²
874
+ * ```
875
+ */
876
+ export declare function inspectSection(section: Section): SectionInspection;
877
+
878
+ /**
879
+ * Reads immutable native facts once per solid; temporary components are owned by the build.
880
+ *
881
+ * @example Check dimensions and volume
882
+ * ```ts
883
+ * const facts = inspectSolid(box({ size: [30, 20, 6] }));
884
+ * facts.volume; // 3600 mm³
885
+ * ```
886
+ */
887
+ export declare function inspectSolid(solid: Solid): SolidInspection;
888
+
889
+ /**
890
+ * Compensated internal threaded cutter.
891
+ *
892
+ * @example Internal thread
893
+ * ```ts
894
+ * import { cylinder, internalThreadCutter } from "@metamesh/modeling";
895
+ * import { createThreadProfile } from "@metamesh/modeling/geometry";
896
+ * const profile = createThreadProfile({ kind: "triangular", pitch: 1.75 });
897
+ * const body = cylinder({ diameter: 20, height: 12, center: false });
898
+ * const cutter = internalThreadCutter({ nominalMajorDiameter: 12, length: 12, profile });
899
+ * body.subtract([cutter]);
900
+ * ```
901
+ */
902
+ export declare function internalThreadCutter(
903
+ options: InternalThreadCutterOptions,
904
+ ): Solid;
905
+
906
+ /** Options for a compensated internal-thread subtraction tool along +Z. */
907
+ export declare interface InternalThreadCutterOptions
908
+ extends
909
+ Omit<HelicalThreadRidgeMeshOptions, "majorDiameter">,
910
+ ThreadBevelOptions {
911
+ /** Printable fit or caller-calibrated allowances. Default: `normal`. */
912
+ readonly fit?: PrintableThreadFit | PrintableThreadFitPolicy;
913
+ /** Nominal major diameter before female compensation and faceting correction. */
914
+ readonly nominalMajorDiameter: number;
915
+ }
916
+
917
+ /**
918
+ * Robust intersection.
919
+ *
920
+ * @example Intersect
921
+ * ```ts
922
+ * intersect([box({ size: 20 }), sphere({ radius: 12 })]);
923
+ * ```
924
+ */
925
+ export declare function intersect(solids: readonly Solid[]): Solid;
926
+
927
+ /** Native filled section intersection; dimensions cannot be mixed. */
928
+ export declare function intersect(sections: readonly Section[]): Section;
929
+
930
+ /**
931
+ * Checks whether a same-session solid or filled section contains no geometry.
932
+ *
933
+ * Accepts a 3D Solid or 2D Section handle, not a finalized model or raw triangle mesh.
934
+ * Useful after a Boolean operation whose inputs may not overlap; no mesh is extracted.
935
+ *
936
+ * @example Check a missed intersection
937
+ * ```ts
938
+ * const body = box({ size: 10 });
939
+ * const distant = box({ size: 10 }).translate([30, 0, 0]);
940
+ * const empty = intersect([body, distant]);
941
+ * const missed = isEmpty(empty); // true
942
+ * ```
943
+ */
944
+ export declare function isEmpty(shape: Solid | Section): boolean;
945
+
946
+ /**
947
+ * Repeats one solid along a normalized direction.
948
+ *
949
+ * @example Three copies along X
950
+ * ```ts
951
+ * linearPattern(box({ size: 4 }), { count: 3, spacing: 10 });
952
+ * ```
953
+ */
954
+ export declare function linearPattern(
955
+ source: PatternSource,
956
+ options: LinearPatternOptions,
957
+ ): readonly Solid[];
958
+
959
+ /** Repeats a filled Section; every placement must preserve its XY plane. */
960
+ export declare function linearPattern(
961
+ source: PatternSource<Section>,
962
+ options: LinearPatternOptions,
963
+ ): readonly Section[];
964
+
965
+ /**
966
+ * Equal linear intervals determined by exactly two of count, spacing and total length.
967
+ */
968
+ export declare type LinearPatternOptions = {
969
+ /** Direction of repetition; magnitude is ignored. Defaults to +X. */
970
+ readonly direction?: Vector3;
971
+ } & (
972
+ | {
973
+ /** Positive copy count, including the original. */
974
+ readonly count: number;
975
+ /** Signed nonzero millimetres between adjacent copies. */
976
+ readonly spacing: number;
977
+ /** Determined by count and spacing. */
978
+ readonly length?: never;
979
+ }
980
+ | {
981
+ /** Positive copy count, including the original. */
982
+ readonly count: number;
983
+ /** Signed millimetres from first to last copy; zero only for one copy. */
984
+ readonly length: number;
985
+ /** Determined by count and length. */
986
+ readonly spacing?: never;
987
+ }
988
+ | {
989
+ /** Signed nonzero millimetres between adjacent copies. */
990
+ readonly spacing: number;
991
+ /** Signed first-to-last millimetres; a nonnegative whole multiple of spacing. */
992
+ readonly length: number;
993
+ /** Determined by spacing and length. */
994
+ readonly count?: never;
995
+ }
996
+ );
997
+
998
+ /**
999
+ * Lofts primitive Sections at z heights or frames; arbitrary Sections and loops require an explicit correspondence method.
1000
+ *
1001
+ * @example Loft
1002
+ * ```ts
1003
+ * loft([
1004
+ * { profile: circle({ diameter: 16 }), z: 0 },
1005
+ * { profile: rectangle({ size: [30, 20], treatment: { kind: "round", radius: 3 } }), z: 30 },
1006
+ * ]);
1007
+ * ```
1008
+ */
1009
+ export declare function loft(
1010
+ stations: readonly LoftStation[],
1011
+ options?: LoftOptions,
1012
+ ): Solid;
1013
+
1014
+ /** Lofts explicit corresponding contours, including holes and collapsed logical slots. */
1015
+ export declare function loft(
1016
+ stations: readonly CorrespondingProfileStation[],
1017
+ options?: LoftOptions,
1018
+ ): Solid;
1019
+
1020
+ /**
1021
+ * Associates ordered loft contours without inferring component identities or repairing topology.
1022
+ *
1023
+ * - `direct` preserves seams and subdivides edges to a common count without dropping vertices.
1024
+ * - `reindex` applies direct subdivision, then selects the next contour's cyclic phase with the
1025
+ * least total world-space connection length.
1026
+ * - `fast-distance` preserves supplied seams and minimizes connection length over ordered closed
1027
+ * vertex associations, repeating vertices for triangular fans.
1028
+ * - `distance` runs the same ordered optimization over every cyclic phase of the next contour.
1029
+ *
1030
+ * Components and holes are paired by their existing order. Use identified profiles when semantic
1031
+ * correspondence must remain authoritative.
1032
+ */
1033
+ export declare type LoftCorrespondence =
1034
+ "direct" | "reindex" | "fast-distance" | "distance";
1035
+
1036
+ /**
1037
+ * Shared controls for native and pure lofts. Point data and arbitrary Sections require explicit correspondence.
1038
+ */
1039
+ export declare interface LoftOptions {
1040
+ /** One method or one per consecutive station gap. Omitted preserves known landmarks, including circle/ellipse-to-rectangle corners, or maps other unlike primitive seams directly. */
1041
+ readonly correspondence?: LoftCorrespondence | readonly LoftCorrespondence[];
1042
+ /** Extra points follow edge length or distribute equally across existing segments. Defaults to perimeter for direct/reindex, or segments when any distance method is selected; distance methods require segments. */
1043
+ readonly distribution?: "perimeter" | "segments";
1044
+ /** Positive integer point-density multiplier, uniformly or per input profile. Original vertices are retained. Defaults to one. */
1045
+ readonly refine?: number | readonly number[];
1046
+ /** Nonnegative count of world-linearly interpolated profiles, uniformly or per gap. Defaults to zero. */
1047
+ readonly slices?: number | readonly number[];
1048
+ /** Physical curve policy for retained primitives, and maximum edge length for point data. Exact primitive curve counts take precedence. */
1049
+ readonly resolution?: GeometryResolution;
1050
+ /** Explicit output and sampling budgets; native operations may only lower host ceilings. */
1051
+ readonly limits?: Partial<ModelingLimits>;
1052
+ }
1053
+
1054
+ /**
1055
+ * A horizontal XY station height, or an explicit right-handed spatial frame, never both.
1056
+ */
1057
+ export declare type LoftPlacement =
1058
+ | {
1059
+ /** Horizontal XY station height in millimetres. */
1060
+ readonly z: number;
1061
+ /** Excluded when a horizontal height is supplied. */
1062
+ readonly frame?: never;
1063
+ }
1064
+ | {
1065
+ /** Right-handed orthonormal station frame in world coordinates. */
1066
+ readonly frame: Frame3;
1067
+ /** Excluded when an explicit spatial frame is supplied. */
1068
+ readonly z?: never;
1069
+ };
1070
+
1071
+ /**
1072
+ * A Section or point loop at an explicit height or frame.
1073
+ */
1074
+ export declare type LoftStation = LoftPlacement & {
1075
+ /** Same-build filled Section or ordered XY boundary point data. */
1076
+ readonly profile: Section | Contour;
1077
+ };
1078
+
1079
+ /** Explicit family matching on a shared physical span grid using session or operation resolution. */
1080
+ export declare function matchProfiles(
1081
+ profiles: readonly Profile[],
1082
+ options?: MatchProfilesOptions,
1083
+ ): readonly CorrespondingProfile[];
1084
+
1085
+ /** Explicit family sampling settings; omitted values use physical package defaults. */
1086
+ export declare interface MatchProfilesOptions {
1087
+ /** Local physical sampling policy; exact interval counts take precedence. */
1088
+ readonly resolution?: GeometryResolution;
1089
+ /** Explicit per-profile and circular ceilings; the family also has a one-million-slot work bound. */
1090
+ readonly limits?: Partial<GeometrySamplingLimits>;
1091
+ }
1092
+
1093
+ /** Three-dimensional Minkowski sum. */
1094
+ export declare function minkowskiSum(a: Solid, b: Solid): Solid;
1095
+
1096
+ /** Aggregate manufacturing output ceilings selected by a trusted host. */
1097
+ export declare interface ModelingLimits extends GeometrySamplingLimits {
1098
+ /** Maximum number of named finalized parts. */
1099
+ readonly maxParts: number;
1100
+ /** Maximum aggregate output vertex count. */
1101
+ readonly maxVertices: number;
1102
+ /** Maximum aggregate output triangle count. */
1103
+ readonly maxTriangles: number;
1104
+ /** Maximum unique transferable output backing-buffer bytes. */
1105
+ readonly maxBytes: number;
1106
+ }
1107
+
1108
+ /** Stateless portable program descriptor. Execution and caches belong to an engine session. */
1109
+ export declare interface ModelProgram<P, S = Record<never, never>> {
1110
+ /** Exact generation protocol discriminator. */
1111
+ readonly kind: "metamesh-model";
1112
+ /** Typed synchronous declaration callback. */
1113
+ readonly generate: GenerateCallback<P, S>;
1114
+ }
1115
+
1116
+ /** Numeric storage supported by immutable generation buffers. */
1117
+ export declare type NumericArray =
1118
+ Float32Array | Float64Array | Uint32Array | Uint8Array | Int32Array;
1119
+
1120
+ /** Manufacturing geometry; filled sections are intermediate construction values. */
1121
+ export declare type PartGeometry = Solid | TriangleMesh | ImmutableTriangleMesh;
1122
+
1123
+ /** Appearance and rigid placement of a finished local manufacturing part. */
1124
+ export declare interface PartOptions {
1125
+ /** Local geometry or a lazy reader; native objects never cross a revision. */
1126
+ readonly geometry: ComputedValue<PartGeometry>;
1127
+ /** XYZ translation in millimetres, applied after rotation; defaults to zero. */
1128
+ readonly position?: ComputedValue<Vector3>;
1129
+ /** Fixed global X, Y, Z rotations in degrees; defaults to zero. */
1130
+ readonly rotation?: ComputedValue<Vector3>;
1131
+ /** Optional six-digit hexadecimal semantic part color. */
1132
+ readonly color?: string;
1133
+ }
1134
+
1135
+ /**
1136
+ * Supplies a profile-X orientation guide for each original normalized sweep station.
1137
+ *
1138
+ * @param point - Current XYZ path point in model units.
1139
+ * @param index - Zero-based index of `point` in the normalized authored sweep path.
1140
+ * @returns A finite guide vector that is not parallel to the local path tangent.
1141
+ */
1142
+ export declare type PathNormalGuide = (
1143
+ point: Vector3,
1144
+ index: number,
1145
+ ) => Vector3;
1146
+
1147
+ /**
1148
+ * Physical arc-length copies along a sampled path, with optional tangent orientation.
1149
+ *
1150
+ * @example Copies along a bent path
1151
+ * ```ts
1152
+ * pathPattern(box({ size: 4 }), [[0, 0, 0], [20, 0, 0], [20, 20, 0]], { count: 5 });
1153
+ * ```
1154
+ */
1155
+ export declare function pathPattern(
1156
+ source: PatternSource,
1157
+ path: readonly Vector3[],
1158
+ options: PathPatternOptions,
1159
+ ): readonly Solid[];
1160
+
1161
+ /**
1162
+ * Repeats a filled Section along a sampled XY path at Z=0. Fixed orientation preserves XY;
1163
+ * tangent orientation maps +Z to the tangent and rejects when that leaves the plane.
1164
+ */
1165
+ export declare function pathPattern(
1166
+ source: PatternSource<Section>,
1167
+ path: readonly Vector3[],
1168
+ options: PathPatternOptions,
1169
+ ): readonly Section[];
1170
+
1171
+ /** Equal physical arc-length placements along an open or implicitly closed sampled path. */
1172
+ export declare interface PathPatternOptions {
1173
+ /** Positive number of copies; open paths include both endpoints when greater than one. */
1174
+ readonly count: number;
1175
+ /** Include the closing edge without duplicating the seam; defaults to false. */
1176
+ readonly closed?: boolean;
1177
+ /** Preserve the source orientation, or align its +Z to the path tangent; defaults to fixed. */
1178
+ readonly orientation?: "fixed" | "tangent";
1179
+ }
1180
+
1181
+ /**
1182
+ * One same-session shape, or a synchronous factory called once per copy in index order.
1183
+ */
1184
+ export declare type PatternSource<T extends Solid | Section = Solid> =
1185
+ T | ((index: number) => T);
1186
+
1187
+ /** A world-space cutting plane, retaining the half-space in the normal's direction. */
1188
+ export declare interface PlaneOptions {
1189
+ /** Finite nonzero plane normal; magnitude does not affect the plane. */
1190
+ readonly normal: Vector3;
1191
+ /** Signed millimetre distance from the origin along the unit normal. Defaults to zero. */
1192
+ readonly offset?: number;
1193
+ }
1194
+
1195
+ /**
1196
+ * One bounded two-dimensional polygon.
1197
+ *
1198
+ * `outer` is counter-clockwise and each hole is clockwise. Boundary arrays omit
1199
+ * their duplicated closing point. Holes must lie inside `outer` and must not
1200
+ * intersect each other or the exterior.
1201
+ */
1202
+ export declare interface Polygon {
1203
+ /** Clockwise interior boundaries, each omitting its duplicated closing point. */
1204
+ readonly holes: readonly Contour[];
1205
+ /** Counter-clockwise exterior boundary, omitting its duplicated closing point. */
1206
+ readonly outer: Contour;
1207
+ }
1208
+
1209
+ /**
1210
+ * Fills one closed millimetre XY outline, explicit outer/hole topology, or compound contours.
1211
+ * Closing edges are implicit. Compound contours use nonzero fill unless selected otherwise.
1212
+ * Explicit topology must be simple and disjoint; compound winding may resolve overlaps.
1213
+ *
1214
+ * @example Extrude a triangular plate
1215
+ * ```ts
1216
+ * polygon([[0, 0], [20, 0], [10, 12]]).extrude({ height: 3 });
1217
+ * ```
1218
+ */
1219
+ export declare function polygon(input: Contour | PolygonOptions): Section;
1220
+
1221
+ /** Explicit polygon topology or compound contours; all closing edges are implicit. */
1222
+ export declare type PolygonOptions =
1223
+ | {
1224
+ /** One simple exterior boundary, normalized to counterclockwise winding. */
1225
+ readonly outer: Contour;
1226
+ /** Disjoint simple holes inside the exterior; normalized to clockwise winding. */
1227
+ readonly holes?: readonly Contour[];
1228
+ /** Explicit topology excludes compound contours. */
1229
+ readonly contours?: never;
1230
+ /** Explicit topology determines fill without a winding rule. */
1231
+ readonly fillRule?: never;
1232
+ }
1233
+ | {
1234
+ /** Compound boundaries; may overlap or contain holes according to the fill rule. */
1235
+ readonly contours: readonly Contour[];
1236
+ /** Winding interpretation; defaults to nonzero. An empty list creates an empty Section. */
1237
+ readonly fillRule?: "nonzero" | "evenodd";
1238
+ /** Compound contours exclude explicit topology. */
1239
+ readonly outer?: never;
1240
+ /** Compound contours determine their own holes. */
1241
+ readonly holes?: never;
1242
+ };
1243
+
1244
+ /** Allocation-free internal-thread facts. */
1245
+ export declare function preflightInternalThreadCutter(
1246
+ options: InternalThreadCutterOptions,
1247
+ ): HelicalThreadSolidMeshPreflight;
1248
+
1249
+ /** Allocation-free nut/cutter facts. */
1250
+ export declare function preflightThreadedNut(
1251
+ options: ThreadedNutOptions,
1252
+ ): ThreadedNutPreflight;
1253
+
1254
+ /** Allocation-free external-thread facts. */
1255
+ export declare function preflightThreadedRod(
1256
+ options: ThreadedRodOptions,
1257
+ ): HelicalThreadSolidMeshPreflight;
1258
+
1259
+ /** Placement shared by solid and filled-section factories. */
1260
+ export declare interface PrimitivePlacement {
1261
+ /** Applied after local construction; Section placement must preserve the XY plane. */
1262
+ readonly placement?: PrimitivePlacementOptions;
1263
+ }
1264
+
1265
+ /** Maps an explicit or named shape-local attachment anchor onto a world-space anchor. */
1266
+ export declare interface PrimitivePlacementOptions {
1267
+ /** Shape-local source frame or a named primitive anchor such as bottom. */
1268
+ readonly source: Anchor3 | string;
1269
+ /** World-space target frame in millimetres. */
1270
+ readonly target: Anchor3;
1271
+ /** Align outward directions face-to-face or in parallel. Defaults to opposed. */
1272
+ readonly alignment?: "opposed" | "same";
1273
+ /** Finite separation along the target direction in millimetres. Defaults to zero. */
1274
+ readonly gap?: number;
1275
+ /** Finite additional roll around the attached direction in degrees. Defaults to zero. */
1276
+ readonly spinDegrees?: number;
1277
+ /** Explicit numeric comparison overrides for anchor normalization. */
1278
+ readonly tolerance?: GeometryToleranceOptions;
1279
+ }
1280
+
1281
+ /**
1282
+ * Named baseline fit policies for calibrated FDM-style printed threads.
1283
+ */
1284
+ export declare type PrintableThreadFit = "tight" | "normal" | "loose";
1285
+
1286
+ /**
1287
+ * Explicit radial and axial allowances for a mating printed thread pair.
1288
+ *
1289
+ * Male and female radial values are applied independently, so their sum is the
1290
+ * assembled radial clearance. Values are millimetres and intentionally do not
1291
+ * encode printer, material, or process calibration.
1292
+ */
1293
+ export declare interface PrintableThreadFitPolicy {
1294
+ /** Nominal axial backlash available between opposing flanks. */
1295
+ readonly axialBacklash: number;
1296
+ /** Radial increase applied to an internal thread envelope. */
1297
+ readonly femaleRadialOutset: number;
1298
+ /** Radial reduction applied to an external thread envelope. */
1299
+ readonly maleRadialInset: number;
1300
+ }
1301
+
1302
+ /** An explicit component/contour/span topology, before shared family sampling. */
1303
+ export declare interface Profile {
1304
+ /** Ordered components with explicit contour identities. */
1305
+ readonly components: readonly ProfileComponent2[];
1306
+ }
1307
+
1308
+ /** One component and its explicitly identified holes. */
1309
+ export declare interface ProfileComponent2 {
1310
+ /** Stable canonical lowercase identity; unique within the containing topology or output. */
1311
+ readonly id: string;
1312
+ /** Counterclockwise outer contour. */
1313
+ readonly outer: ProfileContour2;
1314
+ /** Clockwise hole contours belonging to this component. */
1315
+ readonly holes: readonly ProfileContour2[];
1316
+ }
1317
+
1318
+ /** Ordered, closed spans. Outer winding is CCW and hole winding is CW. */
1319
+ export declare interface ProfileContour2 {
1320
+ /** Stable canonical lowercase identity; unique within the containing topology or output. */
1321
+ readonly id: string;
1322
+ /** Ordered identified spans; the last endpoint meets the first start. */
1323
+ readonly spans: readonly ProfileSpan2[];
1324
+ }
1325
+
1326
+ /** A deliberately sampled, inward-only corner profile with exact polyline geometry. */
1327
+ export declare interface ProfiledEdgeTreatment {
1328
+ /** Selects an explicit corner profile; no analytic curve is inferred from its samples. */
1329
+ readonly kind: "profile";
1330
+ /**
1331
+ * Millimetre setbacks on adjoining surfaces, from [positive, 0] to [0, positive].
1332
+ * First coordinates decrease and second coordinates increase. Cylinder/extrusion ends use
1333
+ * cap inset first, side setback second; planar corners use incoming then outgoing edges.
1334
+ */
1335
+ readonly profile: readonly Vector2[];
1336
+ }
1337
+
1338
+ /** An identified line, circular arc, or cubic Bézier between corresponding landmarks. */
1339
+ export declare type ProfileSpan2 = {
1340
+ /** Stable canonical lowercase identity; unique within the containing topology or output. */
1341
+ readonly id: string;
1342
+ /** Optional exact span interval count; the family uses the largest requested count. */
1343
+ readonly segments?: number;
1344
+ /** Optional span-local physical sampling over the family's resolution; exact intervals take precedence. */
1345
+ readonly resolution?: GeometryResolution;
1346
+ } & (
1347
+ | {
1348
+ /** Selects a straight span. */
1349
+ readonly kind: "line";
1350
+ /** Start point in millimetres. */
1351
+ readonly start: Vector2;
1352
+ /** End point in millimetres. */
1353
+ readonly end: Vector2;
1354
+ }
1355
+ | {
1356
+ /** Selects the geometric curve or span family. */
1357
+ readonly kind: "arc";
1358
+ /** Center point in millimetres. */
1359
+ readonly center: Vector2;
1360
+ /** Circular radius in millimetres. */
1361
+ readonly radius: number;
1362
+ /** Initial counterclockwise angle in degrees. */
1363
+ readonly startDegrees: number;
1364
+ /** Signed counterclockwise angular sweep in degrees. */
1365
+ readonly sweepDegrees: number;
1366
+ }
1367
+ | {
1368
+ /** Selects a cubic Bézier span with the same coordinates as CubicBezierCurve2. */
1369
+ readonly kind: "cubic";
1370
+ /** Start point in millimetres. */
1371
+ readonly start: Vector2;
1372
+ /** First control point in millimetres. */
1373
+ readonly control1: Vector2;
1374
+ /** Second control point in millimetres. */
1375
+ readonly control2: Vector2;
1376
+ /** End point in millimetres. */
1377
+ readonly end: Vector2;
1378
+ }
1379
+ );
1380
+
1381
+ /**
1382
+ * Repeats one solid about an axis.
1383
+ *
1384
+ * @example Six copies around Z
1385
+ * ```ts
1386
+ * const pin = cylinder({ height: 6, radius: 2 }).translate([12, 0, 0]);
1387
+ * radialPattern(pin, { count: 6, axis: [0, 0, 1], angleDegrees: 60 });
1388
+ * ```
1389
+ */
1390
+ export declare function radialPattern(
1391
+ source: PatternSource,
1392
+ options: RadialPatternOptions,
1393
+ ): readonly Solid[];
1394
+
1395
+ /** Repeats a filled Section about an axis; placements must preserve its XY plane. */
1396
+ export declare function radialPattern(
1397
+ source: PatternSource<Section>,
1398
+ options: RadialPatternOptions,
1399
+ ): readonly Section[];
1400
+
1401
+ /**
1402
+ * Options for repeating one solid around an axis through a center point.
1403
+ */
1404
+ export declare interface RadialPatternOptions {
1405
+ /** Number of solids to return, including the original. */
1406
+ readonly count: number;
1407
+ /** Axis of the right-handed rotation. Its magnitude is ignored. */
1408
+ readonly axis: Vector3;
1409
+ /** Signed rotation from one copy to the next, in degrees. */
1410
+ readonly angleDegrees: number;
1411
+ /** Rotation center in world coordinates. Defaults to the origin. */
1412
+ readonly center?: Vector3;
1413
+ }
1414
+
1415
+ /**
1416
+ * Radial dimensions refer to polygon vertices or compensate faceting to meet polygon faces.
1417
+ */
1418
+ export declare type RadialSizing = "vertex" | "face";
1419
+
1420
+ /**
1421
+ * Nominal radial sizing shared by circular and regular polygon construction.
1422
+ */
1423
+ export declare interface RadialSizingOptions {
1424
+ /** Explicit sampling ceilings; bound modeling operations may only lower the host policy. */
1425
+ readonly limits?: Partial<GeometrySamplingLimits>;
1426
+ /** Vertex sizing is inscribed; face sizing circumscribes the nominal radius. Defaults to vertex. */
1427
+ readonly sizing?: RadialSizing;
1428
+ }
1429
+
1430
+ /** Copies intersections along the finite directed origin-to-endpoint segment. */
1431
+ export declare function rayCast(
1432
+ solid: Solid,
1433
+ origin: Vector3,
1434
+ endpoint: Vector3,
1435
+ ): readonly SolidRayHit[];
1436
+
1437
+ /**
1438
+ * Filled rectangular section with uniform or independently treated corners.
1439
+ *
1440
+ * @example Round the corners
1441
+ * ```ts
1442
+ * rectangle({ size: [30, 20], treatment: { kind: "round", radius: 3 } });
1443
+ * ```
1444
+ */
1445
+ export declare function rectangle(options: RectangleOptions): Section;
1446
+
1447
+ /**
1448
+ * Shared rectangle dimensions, origin and uniform or per-corner treatment.
1449
+ */
1450
+ export declare interface RectangleContourOptions {
1451
+ /** Positive uniform size or explicit XY extents in millimetres. */
1452
+ readonly size: number | Vector2;
1453
+ /** Center on XY; otherwise the minimum corner is the origin. Defaults to true. */
1454
+ readonly center?: boolean;
1455
+ /** Uniform treatment or four corner treatments. Exact round segments describe a complete circle and must divide by four. */
1456
+ readonly treatment?: EdgeTreatment | RectangleCornerTreatments;
1457
+ /** Explicit sampling ceiling for the complete output profile. */
1458
+ readonly limits?: Partial<GeometrySamplingLimits>;
1459
+ }
1460
+
1461
+ /** A rectangle corner, including an explicitly untreated corner in a treatment tuple. */
1462
+ export declare type RectangleCornerTreatment =
1463
+ | EdgeTreatment
1464
+ | {
1465
+ /** Leaves this corner untreated. */
1466
+ readonly kind: "square";
1467
+ };
1468
+
1469
+ /** Corner treatments ordered top-right, top-left, bottom-left, bottom-right. */
1470
+ export declare type RectangleCornerTreatments = readonly [
1471
+ topRight: RectangleCornerTreatment,
1472
+ topLeft: RectangleCornerTreatment,
1473
+ bottomLeft: RectangleCornerTreatment,
1474
+ bottomRight: RectangleCornerTreatment,
1475
+ ];
1476
+
1477
+ /**
1478
+ * Rectangle dimensions, placement and uniform or per-corner treatment.
1479
+ */
1480
+ export declare interface RectangleOptions
1481
+ extends RectangleContourOptions, PrimitivePlacement {}
1482
+
1483
+ /** A two-dimensional region represented by disjoint filled polygons. */
1484
+ export declare type Region = readonly Polygon[];
1485
+
1486
+ /** Clipper2 join styles accepted by robust region offsets. */
1487
+ export declare type RegionOffsetJoin = "miter" | "round" | "square";
1488
+
1489
+ /** Options controlling robust Clipper2 region offsets. */
1490
+ export declare interface RegionOffsetOptions {
1491
+ /** Number of segments per full circle for round joins. */
1492
+ readonly circularSegments?: number;
1493
+ /** Corner treatment; defaults to `round`. */
1494
+ readonly join?: RegionOffsetJoin;
1495
+ /** Maximum miter extension in offset-distance multiples; at least two. */
1496
+ readonly miterLimit?: number;
1497
+ /** Operation-level physical tessellation policy over the active model-wide policy. */
1498
+ readonly resolution?: GeometryResolution;
1499
+ }
1500
+
1501
+ /**
1502
+ * Regular polygon with a vertex on +X.
1503
+ *
1504
+ * @example Hexagonal section
1505
+ * ```ts
1506
+ * regularPolygon({ radius: 10, sides: 6, sizing: "face" });
1507
+ * ```
1508
+ */
1509
+ export declare function regularPolygon(options: RegularPolygonOptions): Section;
1510
+
1511
+ /**
1512
+ * Regular polygon dimensions, radial convention and degree rotation.
1513
+ */
1514
+ export declare type RegularPolygonOptions = RadialSizingOptions &
1515
+ PrimitivePlacement & {
1516
+ /** Positive nominal radius in millimetres, interpreted according to sizing. */
1517
+ readonly radius: number;
1518
+ /** Exact integer side count from three through 100000. */
1519
+ readonly sides: number;
1520
+ /** Counterclockwise rotation in degrees; defaults to zero with a vertex on +X. */
1521
+ readonly rotationDegrees?: number;
1522
+ };
1523
+
1524
+ /**
1525
+ * Revolves explicit corresponding radial/Z contours around +Z, with caps for partial sweeps.
1526
+ * Filled Sections use `section.revolve(options)`.
1527
+ *
1528
+ * @example Revolve
1529
+ * ```ts
1530
+ * import { matchProfiles, revolve } from "@metamesh/modeling";
1531
+ * import { rectangleProfile } from "@metamesh/modeling/geometry";
1532
+ *
1533
+ * // Contour coordinates are [radius, Z].
1534
+ * const [profile] = matchProfiles([rectangleProfile({ size: [4, 16], center: false })]);
1535
+ * revolve(profile!, { revolveDegrees: 270 });
1536
+ * ```
1537
+ */
1538
+ export declare function revolve(
1539
+ shape: CorrespondingProfile,
1540
+ options?: RevolveOptions,
1541
+ ): Solid;
1542
+
1543
+ /**
1544
+ * Circumferential sampling and degree sweep shared by pure and filled revolution.
1545
+ */
1546
+ export declare interface RevolveOptions extends CircularPrimitiveOptions {
1547
+ /**
1548
+ * Positive angular sweep no greater than 360 degrees; partial revolutions have end caps.
1549
+ * Segment counts describe a complete circle and scale to this angular span. Native filled
1550
+ * revolutions require at least three sweep intervals: adaptive sampling refines to that floor,
1551
+ * while exact counts that imply fewer intervals reject. Pure revolveMesh supports one interval.
1552
+ */
1553
+ readonly revolveDegrees?: number;
1554
+ /** Explicit output and sampling allocation ceilings. */
1555
+ readonly limits?: Partial<ModelingLimits>;
1556
+ }
1557
+
1558
+ /**
1559
+ * A circular edge or corner roundover with explicit physical sampling.
1560
+ */
1561
+ export declare interface RoundedEdgeTreatment extends CircularPrimitiveOptions {
1562
+ /** Selects circular corners or spherical all-edge roundovers. */
1563
+ readonly kind: "round";
1564
+ /** Nonnegative millimetre radius; zero leaves the edge or corner untreated. Positive values must fit adjoining dimensions. */
1565
+ readonly radius: number;
1566
+ }
1567
+
1568
+ /**
1569
+ * Immutable deferred filled XY section recipe belonging to exactly one model session.
1570
+ * Methods run during synchronous generation and preserve their receiver.
1571
+ * Distances use millimetres; rotations are counterclockwise degrees about the origin.
1572
+ * Construction uses the session resolution unless the operation supplies explicit options.
1573
+ *
1574
+ * @example Extrude an outline with a border
1575
+ * ```ts
1576
+ * const body = rectangle({ size: [20, 12] })
1577
+ * .subtract([rectangle({ size: [16, 8] })])
1578
+ * .offset(0.5)
1579
+ * .extrude({ height: 4 });
1580
+ * ```
1581
+ */
1582
+ export declare interface Section {
1583
+ /** Compile-time ownership brand for a same-session section. */
1584
+ readonly [sectionBrand]: "Section";
1585
+ /** Translates XY coordinates in millimetres. */
1586
+ translate(this: Section, offset: Vector2): Section;
1587
+ /** Rotates counterclockwise about the origin by a scalar angle in degrees. */
1588
+ rotate(this: Section, degrees: number): Section;
1589
+ /**
1590
+ * Nonsingular scaling about the origin.
1591
+ */
1592
+ scale(this: Section, factors: number | Vector2): Section;
1593
+ /** Reflection across an origin line/plane. */
1594
+ mirror(this: Section, normal: Vector2): Section;
1595
+ /** Row-major affine transform preserving dimensionality. */
1596
+ transform(this: Section, matrix: Transform2): Section;
1597
+ /** Native section difference; an empty cutter array preserves the source. */
1598
+ subtract(this: Section, cutters: readonly Section[]): Section;
1599
+ /**
1600
+ * Simplifies filled 2D contours using an explicit positive millimetre tolerance.
1601
+ *
1602
+ * Useful for dense imported outlines before extrusion. This changes the outline rather
1603
+ * than selecting a lower rendering quality; fine features may be removed.
1604
+ */
1605
+ simplify(this: Section, tolerance: number): Section;
1606
+ /**
1607
+ * Returns a new same-session handle with copied named anchors; existing names may be replaced.
1608
+ */
1609
+ withAnchors(
1610
+ this: Section,
1611
+ anchors: Readonly<Record<string, Anchor3>>,
1612
+ ): Section;
1613
+ /**
1614
+ * Native millimetre offset preserving holes.
1615
+ */
1616
+ offset(
1617
+ this: Section,
1618
+ distance: number,
1619
+ options?: RegionOffsetOptions,
1620
+ ): Section;
1621
+ /**
1622
+ * Extrudes along +Z with degree twist and top scaling.
1623
+ */
1624
+ extrude(this: Section, options: ExtrudeOptions): Solid;
1625
+ /**
1626
+ * Revolves a filled radial/Z shape around +Z, with caps for partial sweeps.
1627
+ */
1628
+ revolve(this: Section, options?: RevolveOptions): Solid;
1629
+ /**
1630
+ * Sweeps this filled section using the selected frame policy and degree twist.
1631
+ */
1632
+ sweep(this: Section, path: readonly Vector3[], options?: SweepOptions): Solid;
1633
+ }
1634
+
1635
+ declare const sectionBrand: unique symbol;
1636
+
1637
+ /** Planar convex hull inputs are finite XY points or same-session filled sections. */
1638
+ export declare type SectionHullOptions =
1639
+ | {
1640
+ /** At least three finite millimetre XY points spanning positive area. */
1641
+ readonly points: readonly Vector2[];
1642
+ /** Point input excludes section input. */
1643
+ readonly sections?: never;
1644
+ }
1645
+ | {
1646
+ /** One through 1000 same-session sections to include in the convex hull. */
1647
+ readonly sections: readonly Section[];
1648
+ /** Section input excludes point input. */
1649
+ readonly points?: never;
1650
+ };
1651
+
1652
+ /**
1653
+ * Immutable native filled section facts in millimetres and square millimetres.
1654
+ * Repeated inspections of the same native shape share these facts within one revision.
1655
+ */
1656
+ export declare interface SectionInspection {
1657
+ /** Whether this filled section has no area or boundary. */
1658
+ readonly isEmpty: boolean;
1659
+ /** Filled section area in square millimetres. */
1660
+ readonly area: number;
1661
+ /** Number of extracted outer and hole contours. */
1662
+ readonly contours: number;
1663
+ /** Inclusive maximum coordinates in millimetres. */
1664
+ readonly max: Vector2;
1665
+ /** Inclusive minimum coordinates in millimetres. */
1666
+ readonly min: Vector2;
1667
+ /** Number of disconnected filled section components. */
1668
+ readonly parts: number;
1669
+ /** Number of native section vertices. */
1670
+ readonly vertices: number;
1671
+ }
1672
+
1673
+ /** A cubic corner transition with zero curvature at its straight tangent joins. */
1674
+ export declare interface SmoothEdgeTreatment {
1675
+ /** Selects continuous-curvature cubic rounding, rather than a circular radius. */
1676
+ readonly kind: "smooth";
1677
+ /** Millimetre setbacks, equal or [first, second]; zero or [0, 0] leaves the edge untreated, otherwise both must be positive. */
1678
+ readonly distance: number | readonly [first: number, second: number];
1679
+ /** Exact cubic interval count, positive; overrides physical sampling. */
1680
+ readonly segments?: number;
1681
+ /** Physical chord/edge-length sampling; circularSegments does not describe a cubic. */
1682
+ readonly resolution?: GeometryResolution;
1683
+ /** Explicit sampling ceilings, bounded by the host policy. */
1684
+ readonly limits?: Partial<GeometrySamplingLimits>;
1685
+ }
1686
+
1687
+ /**
1688
+ * Immutable deferred solid recipe belonging to exactly one model session.
1689
+ * Methods run during synchronous generation, preserve their receiver, and use millimetres and degrees.
1690
+ * A no-op may reuse the receiver; final part placement belongs in `part` options.
1691
+ *
1692
+ * @example Shape a body with a through bore
1693
+ * ```ts
1694
+ * const body = box({ size: [30, 20, 6] })
1695
+ * .subtract([cylinder({ height: 8, radius: 3 })])
1696
+ * .rotate([0, 0, 45]);
1697
+ * ```
1698
+ */
1699
+ export declare interface Solid {
1700
+ /** Compile-time ownership brand for a same-session solid. */
1701
+ readonly [solidBrand]: "Solid";
1702
+ /**
1703
+ * Translates XYZ coordinates in millimetres.
1704
+ */
1705
+ translate(this: Solid, offset: Vector3): Solid;
1706
+ /**
1707
+ * Rotates about the origin using XYZ Euler angles in degrees.
1708
+ */
1709
+ rotate(this: Solid, degrees: Vector3): Solid;
1710
+ /**
1711
+ * Nonsingular scaling about the origin.
1712
+ */
1713
+ scale(this: Solid, factors: number | Vector3): Solid;
1714
+ /**
1715
+ * Reflection across an origin line/plane.
1716
+ */
1717
+ mirror(this: Solid, normal: Vector3): Solid;
1718
+ /** Row-major affine transform preserving dimensionality. */
1719
+ transform(this: Solid, matrix: Transform3): Solid;
1720
+ /**
1721
+ * Robust difference; an empty cutter array preserves the source.
1722
+ */
1723
+ subtract(this: Solid, cutters: readonly Solid[]): Solid;
1724
+ /**
1725
+ * Simplifies a solid using an explicit positive millimetre tolerance.
1726
+ *
1727
+ * Removes redundant vertices while keeping surfaces within the greater of this tolerance
1728
+ * and the solid's existing native tolerance. Choose it from the detail you can afford to lose.
1729
+ */
1730
+ simplify(this: Solid, tolerance: number): Solid;
1731
+ /**
1732
+ * Returns a new same-session handle with copied named anchors; existing names may be replaced.
1733
+ */
1734
+ withAnchors(this: Solid, anchors: Readonly<Record<string, Anchor3>>): Solid;
1735
+ /**
1736
+ * Places an explicit or named source anchor against an explicit target anchor.
1737
+ */
1738
+ attach(
1739
+ this: Solid,
1740
+ source: Anchor3 | string,
1741
+ target: Anchor3,
1742
+ options?: AttachOptions,
1743
+ ): Solid;
1744
+ /** Replaces native tolerance on an immutable copy; zero selects the kernel minimum. */
1745
+ setTolerance(this: Solid, tolerance: number): Solid;
1746
+ /** Projects this solid into a filled XY section. */
1747
+ projectSection(this: Solid): Section;
1748
+ /** Takes a filled horizontal slice at Z millimetres. */
1749
+ sliceSection(this: Solid, z: number): Section;
1750
+ }
1751
+
1752
+ declare const solidBrand: unique symbol;
1753
+
1754
+ /**
1755
+ * Imports a bounded closed indexed mesh.
1756
+ *
1757
+ * @example Mesh import
1758
+ * ```ts
1759
+ * import { solidFromMesh } from "@metamesh/modeling";
1760
+ * import { extrudeMesh, rectangleContour } from "@metamesh/modeling/geometry";
1761
+ *
1762
+ * const mesh = extrudeMesh(rectangleContour({ size: [20, 12] }), { height: 6 });
1763
+ * solidFromMesh(mesh);
1764
+ * ```
1765
+ */
1766
+ export declare function solidFromMesh(
1767
+ mesh: TriangleMesh | ImmutableTriangleMesh,
1768
+ ): Solid;
1769
+
1770
+ /**
1771
+ * Immutable solid bounds, emptiness, component count, volume, surface area and native tolerance.
1772
+ * Repeated inspections of the same native shape share these facts within one revision.
1773
+ */
1774
+ export declare interface SolidInspection {
1775
+ /** Whether this native solid contains no material. */
1776
+ readonly isEmpty: boolean;
1777
+ /** Inclusive maximum coordinates in millimetres. */
1778
+ readonly max: Vector3;
1779
+ /** Inclusive minimum coordinates in millimetres. */
1780
+ readonly min: Vector3;
1781
+ /** Number of connected surface shells; inward cavity shells count separately. */
1782
+ readonly parts: number;
1783
+ /** Enclosed native solid volume in cubic millimetres. */
1784
+ readonly volume: number;
1785
+ /** Total native surface area in square millimetres. */
1786
+ readonly surfaceArea: number;
1787
+ /** Effective native geometric tolerance in millimetres. */
1788
+ readonly tolerance: number;
1789
+ }
1790
+
1791
+ /** Copied surface intersection from a finite directed segment. Distance is in millimetres. */
1792
+ export declare interface SolidRayHit {
1793
+ /** Copied numeric native face identity. */
1794
+ readonly faceId: number;
1795
+ /** Distance from the ray origin in millimetres. */
1796
+ readonly distance: number;
1797
+ /** Intersection position in millimetres. */
1798
+ readonly position: Vector3;
1799
+ /** Outward unit surface normal at the intersection. */
1800
+ readonly normal: Vector3;
1801
+ }
1802
+
1803
+ /**
1804
+ * Origin-centered sphere.
1805
+ *
1806
+ * @example Sphere
1807
+ * ```ts
1808
+ * sphere({ diameter: 20 });
1809
+ * ```
1810
+ */
1811
+ export declare function sphere(options: SphereOptions): Solid;
1812
+
1813
+ /**
1814
+ * Exactly one radius or diameter, placement, and tessellation for an origin-centered sphere.
1815
+ */
1816
+ export declare type SphereOptions = CircularPrimitiveOptions &
1817
+ PrimitivePlacement &
1818
+ (
1819
+ | {
1820
+ /** Positive radius in millimetres; mutually exclusive with diameter. */
1821
+ readonly radius: number;
1822
+ /** Full diameter is unavailable when radius is supplied. */
1823
+ readonly diameter?: never;
1824
+ }
1825
+ | {
1826
+ /** Positive full diameter in millimetres; mutually exclusive with radius. */
1827
+ readonly diameter: number;
1828
+ /** Radius is unavailable when diameter is supplied. */
1829
+ readonly radius?: never;
1830
+ }
1831
+ );
1832
+
1833
+ /**
1834
+ * Splits a solid into [inside the cutter, outside the cutter].
1835
+ *
1836
+ * The first result is the intersection; the second is the subtraction. The cutter itself
1837
+ * is not returned. Either result may be empty or contain multiple disconnected components.
1838
+ *
1839
+ * @example Keep the plug and the surrounding body
1840
+ * ```ts
1841
+ * const body = box({ size: [30, 20, 8] });
1842
+ * const cutter = cylinder({ height: 10, diameter: 8 });
1843
+ * const [plug, remainder] = split(body, cutter);
1844
+ * // Move the plug beside the body to show both results.
1845
+ * union([plug.translate([0, -20, 0]), remainder]);
1846
+ * ```
1847
+ */
1848
+ export declare function split(
1849
+ solid: Solid,
1850
+ cutter: Solid,
1851
+ ): readonly [Solid, Solid];
1852
+
1853
+ /**
1854
+ * Splits a solid into [positive-normal side, negative side] at a world-space plane.
1855
+ *
1856
+ * The nonzero normal is normalized; offset is the signed distance from the origin in
1857
+ * millimetres, defaulting to zero. Both cut faces are closed. Select either tuple result
1858
+ * to retain one side; either result may be empty.
1859
+ *
1860
+ * @example Separate two halves at X = 0
1861
+ * ```ts
1862
+ * const body = box({ size: [30, 20, 8] });
1863
+ * const [right, left] = splitByPlane(body, { normal: [1, 0, 0] });
1864
+ * // The gap is only for display; the cut itself removes no material.
1865
+ * union([right.translate([4, 0, 0]), left.translate([-4, 0, 0])]);
1866
+ * ```
1867
+ *
1868
+ * @example Keep only the positive half
1869
+ * ```ts
1870
+ * const [right] = splitByPlane(box({ size: [30, 20, 8] }), { normal: [1, 0, 0] });
1871
+ * right;
1872
+ * ```
1873
+ */
1874
+ export declare function splitByPlane(
1875
+ solid: Solid,
1876
+ plane: PlaneOptions,
1877
+ ): readonly [Solid, Solid];
1878
+
1879
+ /** Square profile with equal crest and root widths. */
1880
+ declare interface SquareThreadProfileSpec extends ThreadProfileBaseSpec {
1881
+ /** Selects the square profile family. */
1882
+ readonly kind: "square";
1883
+ /**
1884
+ * Radial depth in millimetres.
1885
+ * @defaultValue `pitch / 2`
1886
+ */
1887
+ readonly depth?: number;
1888
+ }
1889
+
1890
+ /**
1891
+ * Alternating outer/inner star vertices.
1892
+ *
1893
+ * @example Five-point section
1894
+ * ```ts
1895
+ * star({ outerRadius: 12, innerRadius: 6, points: 5 });
1896
+ * ```
1897
+ */
1898
+ export declare function star(options: StarOptions): Section;
1899
+
1900
+ /**
1901
+ * Alternating outer and inner vertices, centered on the XY origin.
1902
+ */
1903
+ export declare interface StarOptions extends PrimitivePlacement {
1904
+ /** Explicit sampling ceilings, bounded by the host policy. */
1905
+ readonly limits?: Partial<GeometrySamplingLimits>;
1906
+ /** Positive outer vertex radius in millimetres. */
1907
+ readonly outerRadius: number;
1908
+ /** Positive inner vertex radius, smaller than the outer radius. */
1909
+ readonly innerRadius: number;
1910
+ /** Integer outer point count from three through 50000. */
1911
+ readonly points: number;
1912
+ /** Initial counterclockwise rotation in degrees; defaults to zero. */
1913
+ readonly rotationDegrees?: number;
1914
+ }
1915
+
1916
+ /** Placement of painted SVG geometry after SVG Y-axis inversion. */
1917
+ export declare type SvgOrigin = "center" | "document";
1918
+
1919
+ /**
1920
+ * Imports bounded filled SVG path data.
1921
+ *
1922
+ * @example Fill an SVG path in millimetres
1923
+ * ```ts
1924
+ * svgPathSection("M0 0H20V12H0Z", { origin: "center", scale: 1 });
1925
+ * ```
1926
+ */
1927
+ export declare function svgPathSection(
1928
+ path: string,
1929
+ options?: SvgPathSectionOptions,
1930
+ ): Section;
1931
+
1932
+ /** Bounded filled SVG path sampling. Path scale converts user units to millimetres. */
1933
+ export declare interface SvgPathSectionOptions {
1934
+ /** Local allocation ceilings may only lower the configured engine policy. */
1935
+ readonly limits?: Partial<GeometrySamplingLimits>;
1936
+ /** Nonzero or even-odd filled-contour rule; defaults to nonzero. */
1937
+ readonly fillRule?: "evenodd" | "nonzero";
1938
+ /** Local physical sampling policy; exact interval counts take precedence. */
1939
+ readonly resolution?: GeometryResolution;
1940
+ /** Center the painted bounds or preserve original path coordinates. */
1941
+ readonly origin?: SvgOrigin;
1942
+ /** Positive uniform factor converting SVG user units to millimetres; defaults to one. */
1943
+ readonly scale?: number;
1944
+ }
1945
+
1946
+ /**
1947
+ * Imports bounded painted SVG document geometry.
1948
+ *
1949
+ * @example Import a physical SVG rectangle
1950
+ * ```ts
1951
+ * svgSection(
1952
+ * '<svg xmlns="http://www.w3.org/2000/svg" width="30mm" height="20mm" viewBox="0 0 30 20"><rect width="30" height="20"/></svg>',
1953
+ * { origin: "center" },
1954
+ * );
1955
+ * ```
1956
+ */
1957
+ export declare function svgSection(
1958
+ svg: string,
1959
+ options?: SvgSectionOptions,
1960
+ ): Section;
1961
+
1962
+ /**
1963
+ * Bounded SVG document sampling. Center origin uses the final painted bounds.
1964
+ */
1965
+ export declare interface SvgSectionOptions {
1966
+ /** Local allocation ceilings may only lower the configured engine policy. */
1967
+ readonly limits?: Partial<GeometrySamplingLimits>;
1968
+ /** Exact circular tessellation count overriding physical sampling. */
1969
+ readonly circularSegments?: number;
1970
+ /** Local physical sampling policy; exact interval counts take precedence. */
1971
+ readonly resolution?: GeometryResolution;
1972
+ /** Place the painted bounds around the origin or preserve document coordinates. */
1973
+ readonly origin?: SvgOrigin;
1974
+ }
1975
+
1976
+ /**
1977
+ * Sweeps explicit corresponding contours using the selected frame policy.
1978
+ * Filled Sections use `section.sweep(path, options)`.
1979
+ *
1980
+ * @example Sweep
1981
+ * ```ts
1982
+ * import { matchProfiles, sweep } from "@metamesh/modeling";
1983
+ * import { rectangleProfile } from "@metamesh/modeling/geometry";
1984
+ *
1985
+ * const [profile] = matchProfiles([rectangleProfile({ size: [6, 3] })]);
1986
+ * sweep(profile!, [[0, 0, 0], [0, 0, 15], [10, 0, 25]], {
1987
+ * orientation: { kind: "transport", initialNormal: [0, 1, 0] },
1988
+ * });
1989
+ * ```
1990
+ */
1991
+ export declare function sweep(
1992
+ shape: CorrespondingProfile,
1993
+ path: readonly Vector3[],
1994
+ options?: SweepOptions,
1995
+ ): Solid;
1996
+
1997
+ /**
1998
+ * Controls shared by pure mesh construction and filled modeling sweeps.
1999
+ */
2000
+ export declare interface SweepOptions {
2001
+ /** Join the path's last station to its first. Open paths retain watertight end caps. */
2002
+ readonly closed?: boolean;
2003
+ /** Explicit output and sampling allocation ceilings. */
2004
+ readonly limits?: Partial<ModelingLimits>;
2005
+ /** Explicit frame policy; default transport minimizes rotations, initially projecting +X then +Y then +Z. */
2006
+ readonly orientation?: SweepOrientation;
2007
+ /** Physical sampling of nonzero twist; inserted stations retain authored station controls. */
2008
+ readonly resolution?: GeometryResolution;
2009
+ /** Total additional profile rotation in degrees, with progression selected by twistBy. */
2010
+ readonly twistDegrees?: number;
2011
+ /** Twist advances by physical path length (default), or normalized authored station position, including a closed seam gap. */
2012
+ readonly twistBy?: "length" | "stations";
2013
+ /** Positive uniform/XY scale, or one XY pair per path station. Defaults to one. */
2014
+ readonly scale?: number | Vector2 | readonly Vector2[];
2015
+ /** Corresponding point-index advance at a rotationally equivalent closed seam. */
2016
+ readonly seamProfileOffset?: number;
2017
+ }
2018
+
2019
+ /**
2020
+ * Explicit profile-X frame policy; all normals are directed, and selected singular policies reject.
2021
+ */
2022
+ export declare type SweepOrientation =
2023
+ | {
2024
+ /** Minimizes frame rotation by parallel transport. */
2025
+ readonly kind: "transport";
2026
+ /** Initial profile +X guide, projected perpendicular to the first tangent. */
2027
+ readonly initialNormal?: Vector3;
2028
+ }
2029
+ | {
2030
+ /** Projects one fixed world-space normal at every path station. */
2031
+ readonly kind: "fixed-normal";
2032
+ /** Directed profile +X guide; must not be parallel to any local tangent. */
2033
+ readonly normal: Vector3;
2034
+ }
2035
+ | {
2036
+ /** Uses an explicitly directed normal callback at each original normalized station. */
2037
+ readonly kind: "guide";
2038
+ /** Finite profile +X guide callback, evaluated once per original path station. */
2039
+ readonly normal: PathNormalGuide;
2040
+ }
2041
+ | {
2042
+ /** Uses sampled curvature normals; zero-curvature stations reject. */
2043
+ readonly kind: "frenet";
2044
+ };
2045
+
2046
+ /**
2047
+ * Consumes a previously prepared layout; never shapes or fetches a font.
2048
+ *
2049
+ * @example Use a prepared text layout
2050
+ * ```ts
2051
+ * // Prepare the exact font and layout before entering build.
2052
+ * function labelSection(layout: VectorTextLayout) {
2053
+ * return textSection(layout);
2054
+ * }
2055
+ * ```
2056
+ */
2057
+ export declare function textSection(
2058
+ layout: VectorTextLayout,
2059
+ options?: TextSectionOptions,
2060
+ ): Section;
2061
+
2062
+ /**
2063
+ * Physical curve sampling applied to already prepared vector text.
2064
+ */
2065
+ export declare interface TextSectionOptions {
2066
+ /** Local allocation ceilings may only lower the configured engine policy. */
2067
+ readonly limits?: Partial<GeometrySamplingLimits>;
2068
+ /** Local physical sampling policy; exact interval counts take precedence. */
2069
+ readonly resolution?: GeometryResolution;
2070
+ }
2071
+
2072
+ /** End bevel controls shared by threaded rods and cutters. */
2073
+ declare interface ThreadBevelOptions {
2074
+ /** Apply a 45-degree bevel at Z=0. */
2075
+ readonly bevelBottom?: boolean;
2076
+ /**
2077
+ * Axial bevel extent in millimetres. Active blunt ends default to one sixth of the compensated
2078
+ * male minor radius or female major radius; other ends default to the profile depth.
2079
+ */
2080
+ readonly bevelSize?: number;
2081
+ /** Apply a 45-degree bevel at Z=length. */
2082
+ readonly bevelTop?: boolean;
2083
+ }
2084
+
2085
+ /**
2086
+ * Compensated threaded nut.
2087
+ *
2088
+ * @example Threaded nut
2089
+ * ```ts
2090
+ * import { threadedNut } from "@metamesh/modeling";
2091
+ * import { createThreadProfile } from "@metamesh/modeling/geometry";
2092
+ *
2093
+ * const profile = createThreadProfile({ kind: "triangular", pitch: 1.75 });
2094
+ * threadedNut({ nominalMajorDiameter: 12, thickness: 8, width: 20, shape: "hex", profile, fit: "normal" });
2095
+ * ```
2096
+ */
2097
+ export declare function threadedNut(options: ThreadedNutOptions): Solid;
2098
+
2099
+ /** Nut-edge bevel selection. */
2100
+ export declare type ThreadedNutBevel =
2101
+ "automatic" | "both" | "inside" | "none" | "outside";
2102
+
2103
+ /**
2104
+ * Options for a compensated nut with an internal thread.
2105
+ */
2106
+ export declare interface ThreadedNutOptions extends Omit<
2107
+ InternalThreadCutterOptions,
2108
+ "bevelBottom" | "bevelSize" | "bevelTop" | "length"
2109
+ > {
2110
+ /** Nut body bevel selection. Default: `automatic`. */
2111
+ readonly bevel?: ThreadedNutBevel;
2112
+ /** Optional physical policy for a round body, independent of the thread's matched facet grid. */
2113
+ readonly bodyResolution?: GeometryResolution;
2114
+ /** 45-degree body chamfer extent. Default: `min(profile.depth, thickness/4)`. */
2115
+ readonly chamferSize?: number;
2116
+ /** Leave the bottom outside edge flat for build-plate adhesion. Default: `false`. */
2117
+ readonly flushBuildPlateBottom?: boolean;
2118
+ /** Nut body shape. */
2119
+ readonly shape: ThreadedNutShape;
2120
+ /** Nut thickness along +Z in millimetres. */
2121
+ readonly thickness: number;
2122
+ /** Across-flats width for hex/square or diameter for round, in millimetres. */
2123
+ readonly width: number;
2124
+ }
2125
+
2126
+ /** Allocation-free body, cutter, and end-face facts resolved for a threaded nut. */
2127
+ export declare interface ThreadedNutPreflight {
2128
+ /** Polygon segment count used by the nut body. */
2129
+ readonly bodySegments: number;
2130
+ /** Shared 45-degree chamfer size applied to the selected body and cutter edges. */
2131
+ readonly chamferSize: number;
2132
+ /** Maximum compensated cutter radius at either requested face. */
2133
+ readonly cutterFaceRadius: number;
2134
+ /** Minimum nut-body inradius across the requested top and bottom faces. */
2135
+ readonly minimumBodyFaceInradius: number;
2136
+ /** Smallest radial wall left between the body and cutter at either requested face. */
2137
+ readonly minimumFaceWall: number;
2138
+ /** Conservative allocation facts for the exact extended internal-thread cutter mesh. */
2139
+ readonly thread: HelicalThreadSolidMeshPreflight;
2140
+ /** Start-aligned circular facet count used by the compensated thread cutter. */
2141
+ readonly threadCircularSegments: number;
2142
+ }
2143
+
2144
+ /**
2145
+ * Supported printable nut body shapes.
2146
+ */
2147
+ export declare type ThreadedNutShape = "hex" | "round" | "square";
2148
+
2149
+ /**
2150
+ * Compensated external threaded rod.
2151
+ *
2152
+ * @example Threaded rod
2153
+ * ```ts
2154
+ * import { threadedRod } from "@metamesh/modeling";
2155
+ * import { createThreadProfile } from "@metamesh/modeling/geometry";
2156
+ *
2157
+ * const profile = createThreadProfile({ kind: "triangular", pitch: 1.75 });
2158
+ * threadedRod({ nominalMajorDiameter: 12, length: 24, profile, fit: "normal" });
2159
+ * ```
2160
+ */
2161
+ export declare function threadedRod(options: ThreadedRodOptions): Solid;
2162
+
2163
+ /**
2164
+ * Options for a compensated external threaded rod along +Z.
2165
+ */
2166
+ export declare interface ThreadedRodOptions
2167
+ extends
2168
+ Omit<HelicalThreadRidgeMeshOptions, "majorDiameter">,
2169
+ ThreadBevelOptions {
2170
+ /** Printable fit or caller-calibrated allowances. Default: `normal`. */
2171
+ readonly fit?: PrintableThreadFit | PrintableThreadFitPolicy;
2172
+ /** Nominal major diameter before male compensation. */
2173
+ readonly nominalMajorDiameter: number;
2174
+ }
2175
+
2176
+ /** End shape of a generated helical ridge. */
2177
+ export declare type ThreadEndStyle = "blunt" | "standard" | "tapered";
2178
+
2179
+ /** Axial end controls for a generated ridge. */
2180
+ export declare interface ThreadEndTreatmentOptions {
2181
+ /**
2182
+ * Ridge shape at the lower working boundary. `blunt` ends at full profile height, `standard`
2183
+ * clips the periodic profile at the face, and `tapered` ramps out from the minor envelope.
2184
+ * @defaultValue `"blunt"`
2185
+ */
2186
+ readonly bottom?: ThreadEndStyle;
2187
+ /**
2188
+ * Non-negative unthreaded envelope length reserved at each non-standard end, in millimetres.
2189
+ * Active blunt bevels may raise this reservation to the effective bevel size.
2190
+ * @defaultValue `0`
2191
+ */
2192
+ readonly endLength?: number;
2193
+ /**
2194
+ * Radial envelope toward which a blunt lead-in collapses.
2195
+ * @defaultValue `"minor"`
2196
+ */
2197
+ readonly leadInEnvelope?: ThreadLeadInEnvelope;
2198
+ /**
2199
+ * Physical circumferential lead-in length in millimetres.
2200
+ * @defaultValue The profile depth.
2201
+ */
2202
+ readonly leadInLength?: number;
2203
+ /**
2204
+ * Cross-section scaling curve used by blunt ends. `cut` switches abruptly to the full profile.
2205
+ * @defaultValue `"cut"`
2206
+ */
2207
+ readonly leadInShape?: ThreadLeadInShape;
2208
+ /**
2209
+ * Ridge shape at the upper working boundary. `blunt` ends at full profile height, `standard`
2210
+ * clips the periodic profile at the face, and `tapered` ramps into the minor envelope.
2211
+ * @defaultValue `"blunt"`
2212
+ */
2213
+ readonly top?: ThreadEndStyle;
2214
+ }
2215
+
2216
+ /**
2217
+ * Direction in which a conventional helical thread advances around +Z.
2218
+ */
2219
+ export declare type ThreadHandedness = "left" | "right";
2220
+
2221
+ /** Radial envelope toward which a blunt lead-in collapses. */
2222
+ export declare type ThreadLeadInEnvelope = "major" | "minor";
2223
+
2224
+ /** BOSL2-compatible cross-section scaling curve for a blunt thread lead-in. */
2225
+ export declare type ThreadLeadInShape = "cut" | "linear" | "smooth" | "sqrt";
2226
+
2227
+ /**
2228
+ * A validated immutable periodic thread profile in `[axial, radial]` millimetres.
2229
+ */
2230
+ export declare interface ThreadProfile {
2231
+ /** Axial width of the flat at the major envelope. */
2232
+ readonly crestFlatWidth: number;
2233
+ /** Radial distance from the major envelope to the root. */
2234
+ readonly depth: number;
2235
+ /** Profile family that produced this validated profile. */
2236
+ readonly kind: ThreadProfileSpec["kind"];
2237
+ /** Adjacent axial thread spacing in millimetres. */
2238
+ readonly pitch: number;
2239
+ /** Immutable open `[axial, radial]` path spanning one pitch. */
2240
+ readonly points: readonly Vector2[];
2241
+ /** Axial width of the flat at the minor envelope. */
2242
+ readonly rootFlatWidth: number;
2243
+ }
2244
+
2245
+ /** Fields shared by all thread profile specifications. */
2246
+ declare interface ThreadProfileBaseSpec {
2247
+ /** Adjacent axial thread spacing in millimetres. */
2248
+ readonly pitch: number;
2249
+ /** Optional numerical tolerance overrides. */
2250
+ readonly tolerance?: GeometryToleranceOptions;
2251
+ }
2252
+
2253
+ /**
2254
+ * Supported built-in and caller-defined thread profiles.
2255
+ */
2256
+ declare type ThreadProfileSpec =
2257
+ | AcmeThreadProfileSpec
2258
+ | ButtressThreadProfileSpec
2259
+ | CustomThreadProfileSpec
2260
+ | SquareThreadProfileSpec
2261
+ | TrapezoidalThreadProfileSpec
2262
+ | TriangularThreadProfileSpec;
2263
+
2264
+ /** Helical ridge mesh construction. */
2265
+ export declare function threadRidge(options: ThreadRidgeOptions): Solid;
2266
+
2267
+ /** Parameters for a helical ridge before solid construction. */
2268
+ export declare type ThreadRidgeOptions = HelicalThreadRidgeMeshOptions;
2269
+
2270
+ /** Explicit copied topology inspection; not needed for section operations. */
2271
+ export declare function toRegion(section: Section): Region;
2272
+
2273
+ /**
2274
+ * Torus around +Z.
2275
+ *
2276
+ * @example Torus
2277
+ * ```ts
2278
+ * torus({ majorRadius: 12, minorRadius: 3 });
2279
+ * ```
2280
+ */
2281
+ export declare function torus(options: TorusOptions): Solid;
2282
+
2283
+ /**
2284
+ * Dimensions and independent ring/profile tessellation for a torus around the Z axis.
2285
+ */
2286
+ export declare interface TorusOptions extends PrimitivePlacement {
2287
+ /** Explicit sampling ceilings, bounded by the host policy. */
2288
+ readonly limits?: Partial<GeometrySamplingLimits>;
2289
+ /** Radius from the Z axis to the profile center, in millimetres; greater than `minorRadius`. */
2290
+ readonly majorRadius: number;
2291
+ /** Exact segment count around the Z axis; omitted uses adaptive resolution. */
2292
+ readonly majorSegments?: number;
2293
+ /** Radius of the swept circular profile in millimetres. */
2294
+ readonly minorRadius: number;
2295
+ /** Exact segment count around the swept profile; omitted uses adaptive resolution. */
2296
+ readonly minorSegments?: number;
2297
+ /** Operation-level physical tessellation policy over the active model-wide policy. */
2298
+ readonly resolution?: GeometryResolution;
2299
+ }
2300
+
2301
+ /** Copies a handle to manufacturing mesh buffers. */
2302
+ export declare function toTriangleMesh(solid: Solid): TriangleMesh;
2303
+
2304
+ /** Row-major affine XY matrix. Translation occupies m02/m12; final row is [0, 0, 1]. */
2305
+ export declare type Transform2 = readonly [
2306
+ m00: number,
2307
+ m01: number,
2308
+ m02: number,
2309
+ m10: number,
2310
+ m11: number,
2311
+ m12: number,
2312
+ m20: number,
2313
+ m21: number,
2314
+ m22: number,
2315
+ ];
2316
+
2317
+ /**
2318
+ * A row-major affine 4x4 matrix applied to column vectors.
2319
+ *
2320
+ * Translation occupies indices 3, 7, and 11. The final row must be
2321
+ * `[0, 0, 0, 1]` within the active geometry tolerance.
2322
+ */
2323
+ export declare type Transform3 = readonly [
2324
+ m00: number,
2325
+ m01: number,
2326
+ m02: number,
2327
+ m03: number,
2328
+ m10: number,
2329
+ m11: number,
2330
+ m12: number,
2331
+ m13: number,
2332
+ m20: number,
2333
+ m21: number,
2334
+ m22: number,
2335
+ m23: number,
2336
+ m30: number,
2337
+ m31: number,
2338
+ m32: number,
2339
+ m33: number,
2340
+ ];
2341
+
2342
+ /** Trapezoidal thread profile with a configurable included angle. */
2343
+ declare interface TrapezoidalThreadProfileSpec extends ThreadProfileBaseSpec {
2344
+ /** Selects the trapezoidal profile family. */
2345
+ readonly kind: "trapezoidal";
2346
+ /**
2347
+ * Radial depth in millimetres.
2348
+ * @defaultValue `pitch / 2`
2349
+ */
2350
+ readonly depth?: number;
2351
+ /**
2352
+ * Included flank angle in degrees. Use `90` for printable 45-degree slopes.
2353
+ * @defaultValue `30`
2354
+ */
2355
+ readonly threadAngle?: number;
2356
+ }
2357
+
2358
+ /**
2359
+ * A topology-preserving indexed triangle mesh with XYZ vertex positions.
2360
+ */
2361
+ export declare interface TriangleMesh {
2362
+ /** Three unsigned vertex indices per triangle. */
2363
+ readonly indices: Uint32Array;
2364
+ /** Flat XYZ coordinates, three finite values per vertex. */
2365
+ readonly positions: Float32Array;
2366
+ }
2367
+
2368
+ /**
2369
+ * Measurements and optional edge-connected topology from one validated mesh traversal.
2370
+ */
2371
+ export declare interface TriangleMeshAnalysis extends TriangleMeshMeasurements {
2372
+ /** Number of referenced edge-connected components when `includeTopology` is requested. */
2373
+ readonly connectedComponentCount?: number;
2374
+ /** Number of distinct indexed undirected edges when `includeTopology` is requested. */
2375
+ readonly edgeCount?: number;
2376
+ }
2377
+
2378
+ /**
2379
+ * Geometric measurements derived from a validated, non-empty triangle mesh.
2380
+ */
2381
+ export declare interface TriangleMeshMeasurements {
2382
+ /** Axis-aligned bounds. */
2383
+ readonly bounds: Bounds3;
2384
+ /** Signed enclosed volume; positive values correspond to outward winding. */
2385
+ readonly signedVolume: number;
2386
+ /** Sum of all triangle areas in squared model units. */
2387
+ readonly surfaceArea: number;
2388
+ /** Number of indexed triangles. */
2389
+ readonly triangleCount: number;
2390
+ /** Number of distinct entries in the position buffer. */
2391
+ readonly vertexCount: number;
2392
+ }
2393
+
2394
+ /**
2395
+ * ISO/UTS-like 60-degree truncated triangular profile.
2396
+ */
2397
+ declare interface TriangularThreadProfileSpec extends ThreadProfileBaseSpec {
2398
+ /** Selects the 60-degree triangular profile family. */
2399
+ readonly kind: "triangular";
2400
+ /**
2401
+ * Crest width divided by pitch.
2402
+ * @defaultValue `1 / 8`
2403
+ */
2404
+ readonly crestFlatRatio?: number;
2405
+ /**
2406
+ * Root width divided by pitch.
2407
+ * @defaultValue `1 / 4`
2408
+ */
2409
+ readonly rootFlatRatio?: number;
2410
+ }
2411
+
2412
+ /**
2413
+ * Hollow +Z tube.
2414
+ *
2415
+ * @example Tube
2416
+ * ```ts
2417
+ * tube({ height: 20, outerRadius: 10, innerRadius: 6 });
2418
+ * ```
2419
+ */
2420
+ export declare function tube(options: TubeOptions): Solid;
2421
+
2422
+ /**
2423
+ * Dimensions, placement, and tessellation for a hollow Z-axis tube.
2424
+ */
2425
+ export declare interface TubeOptions
2426
+ extends CircularPrimitiveOptions, PrimitivePlacement {
2427
+ /**
2428
+ * Centers the tube on the Z origin when `true`; otherwise its bottom is at `Z = 0`.
2429
+ * @defaultValue `true`
2430
+ */
2431
+ readonly center?: boolean;
2432
+ /** Total height along Z in millimetres. */
2433
+ readonly height: number;
2434
+ /** Positive inner radius in millimetres. */
2435
+ readonly innerRadius: number;
2436
+ /** Outer radius in millimetres; greater than {@link TubeOptions.innerRadius}. */
2437
+ readonly outerRadius: number;
2438
+ }
2439
+
2440
+ /**
2441
+ * Robust union.
2442
+ *
2443
+ * @example Union
2444
+ * ```ts
2445
+ * const block = box({ size: 20 });
2446
+ * const cap = sphere({ radius: 10 }).translate([0, 0, 10]);
2447
+ * union([block, cap]);
2448
+ * ```
2449
+ */
2450
+ export declare function union(solids: readonly Solid[]): Solid;
2451
+
2452
+ /** Native filled section union; dimensions cannot be mixed. */
2453
+ export declare function union(sections: readonly Section[]): Section;
2454
+
2455
+ /** A two-dimensional Cartesian vector or point. */
2456
+ export declare type Vector2 = readonly [x: number, y: number];
2457
+
2458
+ /** A three-dimensional Cartesian vector or point. */
2459
+ export declare type Vector3 = readonly [x: number, y: number, z: number];
2460
+
2461
+ /**
2462
+ * Immutable vector layout with no browser, font parser, or kernel ownership.
2463
+ */
2464
+ export declare interface VectorTextLayout {
2465
+ /** Nonzero-filled path data in millimetres, positive Y upward; empty for text with no ink. */
2466
+ readonly paths: readonly string[];
2467
+ /** Exact measurements of these paths and their logical text layout. */
2468
+ readonly metrics: VectorTextMetrics;
2469
+ }
2470
+
2471
+ /** Text measurements from the same immutable layout that supplies geometry and SVG outlines. */
2472
+ export declare interface VectorTextMetrics {
2473
+ /** Visible curve bounds after alignment, or null when the text has no ink. */
2474
+ readonly bounds: Bounds2 | null;
2475
+ /** Unaligned logical advance and negative baseline displacement in mm; arcs retain [arc length, 0]. */
2476
+ readonly advance: readonly [number, number];
2477
+ /** Maximum logical line advance in millimetres, including spaces; arc length on circular baselines. */
2478
+ readonly logicalWidth: number;
2479
+ /** Selected font's ascender distance above a baseline in millimetres, independent of the text. */
2480
+ readonly ascent: number;
2481
+ /** Selected font's descender distance below a baseline in millimetres, a non-negative value. */
2482
+ readonly descent: number;
2483
+ /** Actual distance between baselines in millimetres. */
2484
+ readonly lineHeight: number;
2485
+ /** Number of lines, including empty and trailing lines; empty text occupies one line. */
2486
+ readonly lineCount: number;
2487
+ }
2488
+
2489
+ export {};