forgecad 0.9.13 → 0.9.15

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 (216) hide show
  1. package/LICENSE +6 -4
  2. package/README.md +8 -4
  3. package/dist/assets/{AdminPage-DramHHDf.js → AdminPage-CDyGUinA.js} +2 -2
  4. package/dist/assets/{BenchmarkPage-Bjgkh5m9.js → BenchmarkPage-DfPMY_-d.js} +4 -15
  5. package/dist/assets/{BlogPage-n_HGP3Qm.js → BlogPage-kF0fkdJT.js} +2 -2
  6. package/dist/assets/{DocsPage-WCIkPmzC.js → DocsPage-B954L3YN.js} +9 -3
  7. package/dist/assets/EditorApp-Beb-IZ0y.js +14014 -0
  8. package/dist/assets/{EditorApp-BAnckbsk.css → EditorApp-CuDLxKqL.css} +698 -0
  9. package/dist/assets/{EmbedViewer-DEZKqdfW.js → EmbedViewer-C77B-TrF.js} +3 -3
  10. package/dist/assets/{LandingPageProofDriven-CeRIctuj.js → LandingPageProofDriven-Cr6fXMDj.js} +35 -37
  11. package/dist/assets/LegalPage-BRlScr9A.css +91 -0
  12. package/dist/assets/LegalPage-Dzklqmmg.js +39 -0
  13. package/dist/assets/{PricingPage-BMedqFef.css → PricingPage-BPF6HKyO.css} +25 -0
  14. package/dist/assets/{PricingPage-rIRa8p4Y.js → PricingPage-zWXkvlwl.js} +19 -19
  15. package/dist/assets/{SettingsPage-BqCUvEXM.js → SettingsPage-Bz0of4KQ.js} +2 -2
  16. package/dist/assets/app-CE3sYcV7.css +3890 -0
  17. package/dist/assets/{app-BUZqJvSO.js → app-D3kDkggg.js} +2305 -960
  18. package/dist/assets/cli/{render-lhGxj50Y.js → render-DSY3mMQa.js} +423 -30
  19. package/dist/assets/{constructionHistoryWorker-ipD1jcIv.js → constructionHistoryWorker-gpDo-uH2.js} +927 -243
  20. package/dist/assets/{evalWorker-CHXSe_-u.js → evalWorker-CU0Ke6DP.js} +7799 -4163
  21. package/dist/assets/{forgecad_geometry-BVnIeXMG.js → forgecad_geometry-Dgceylq9.js} +43 -1
  22. package/dist/assets/{forgecad_geometry_bg-DufhhCBV.wasm → forgecad_geometry_bg-dD4RNQF1.wasm} +0 -0
  23. package/dist/assets/{inspectWorker-DeRnMVv1.js → inspectWorker-COyp8XXA.js} +927 -243
  24. package/dist/assets/{javascript-70-4uGcz.js → javascript-1kQXfVaz.js} +1 -1
  25. package/dist/assets/landing-proof-driven-DiGqdtWa.js +18 -0
  26. package/dist/assets/{landing-proof-driven-oFYW6mjz.css → landing-proof-driven-ORyigZ6p.css} +13 -7
  27. package/dist/assets/legalContent-ZfFGMmi4.js +251 -0
  28. package/dist/assets/{manifold-D1LZIHqn.js → manifold-BRI5prcH.js} +1 -1
  29. package/dist/assets/{manifold-C2fwoTgd.js → manifold-C-3h2M7p.js} +2 -2
  30. package/dist/assets/{manifold-BTkzxi9V.js → manifold-DNkrUWpA.js} +1 -1
  31. package/dist/assets/{reportWorker-Cq1qGmg0.js → reportWorker-CdBz5bNg.js} +7537 -10856
  32. package/dist/assets/{scalar-sampling-budget-D9Qv_UlJ.js → scalar-sampling-budget-wJF98aY9.js} +6943 -4345
  33. package/dist/assets/{scanProxyWorker-Bs2TDgLw.js → scanProxyWorker-B-9VbLIs.js} +32 -1
  34. package/dist/assets/{renderSceneState-Dr0xPq1A.js → targets-B9sGB5nB.js} +27 -1
  35. package/dist/assets/{vendor-react-Da3A2QmU.js → vendor-react-6j1Kke-Y.js} +6 -5
  36. package/dist/cli/render.html +1 -1
  37. package/dist/docs/index.html +2 -2
  38. package/dist/docs-raw/AI/ai-native-cad.md +50 -0
  39. package/dist/docs-raw/AI/usage.md +9 -17
  40. package/dist/docs-raw/CLI.md +71 -21
  41. package/dist/docs-raw/component-model.md +27 -11
  42. package/dist/docs-raw/generated/assembly.md +301 -212
  43. package/dist/docs-raw/generated/concepts.md +238 -240
  44. package/dist/docs-raw/generated/core.md +283 -6
  45. package/dist/docs-raw/generated/curves.md +274 -361
  46. package/dist/docs-raw/generated/lib.md +7 -1
  47. package/dist/docs-raw/generated/output.md +19 -4
  48. package/dist/docs-raw/generated/runtime-names.md +41 -0
  49. package/dist/docs-raw/generated/sdf.md +31 -0
  50. package/dist/docs-raw/generated/sheet-metal.md +9 -0
  51. package/dist/docs-raw/generated/sketch.md +44 -1
  52. package/dist/docs-raw/generated/viewport.md +14 -6
  53. package/dist/docs-raw/guides/coordinate-system.md +20 -16
  54. package/dist/docs-raw/guides/geometry-conventions.md +2 -2
  55. package/dist/docs-raw/guides/inspection-bundles.md +2 -1
  56. package/dist/docs-raw/guides/joint-design.md +24 -0
  57. package/dist/docs-raw/guides/positioning.md +13 -3
  58. package/dist/docs-raw/legal/privacy.md +63 -0
  59. package/dist/docs-raw/legal/software-license.md +55 -0
  60. package/dist/docs-raw/legal/terms.md +87 -0
  61. package/dist/docs-raw/skills/forgecad-3d-reconstruction.md +3 -3
  62. package/dist/docs-raw/skills/forgecad-blockout-model.md +1 -1
  63. package/dist/docs-raw/skills/forgecad-component-model.md +11 -2
  64. package/dist/docs-raw/skills/forgecad-high-level-spec.md +1 -1
  65. package/dist/docs-raw/skills/forgecad-image-replicator.md +8 -8
  66. package/dist/docs-raw/skills/forgecad-lld.md +1 -1
  67. package/dist/docs-raw/skills/forgecad-make-a-model.md +4 -4
  68. package/dist/docs-raw/skills/forgecad-model-grader.md +2 -2
  69. package/dist/docs-raw/skills/forgecad-prepare-prompt.md +2 -2
  70. package/dist/docs-raw/skills/forgecad-project.md +1 -1
  71. package/dist/docs-raw/skills/forgecad-reconstruction-benchmark.md +4 -4
  72. package/dist/docs-raw/skills/forgecad-render-inspect.md +4 -2
  73. package/dist/docs-raw/skills/forgecad-visual-spec.md +1 -1
  74. package/dist/docs-raw/skills/forgecad.md +4 -3
  75. package/dist/index.html +40 -12
  76. package/dist/llms.txt +8 -0
  77. package/dist/site.webmanifest +1 -1
  78. package/dist/sitemap.xml +49 -13
  79. package/dist-cli/{check-compiler-LOXCPEOI.js → check-compiler-SDX5QIXI.js} +1 -2
  80. package/dist-cli/{check-query-propagation-BAKNVWXR.js → check-query-propagation-EAYEFT77.js} +1 -2
  81. package/dist-cli/{chunk-RY43WF46.js → chunk-N4O47JLF.js} +13772 -9938
  82. package/dist-cli/forgecad.js +2387 -899
  83. package/dist-cli/{forgecad_geometry-GYVNKPIE.js → forgecad_geometry-QOQIIP53.js} +42 -1
  84. package/dist-cli/forgecad_geometry_bg.wasm +0 -0
  85. package/dist-cli/{solver-46FFSK2U.js → solver-OK4HECRH.js} +0 -1
  86. package/dist-skill/CONTEXT.md +1120 -724
  87. package/dist-skill/SKILL.md +3 -2
  88. package/dist-skill/docs/API/core/concepts.md +64 -1
  89. package/dist-skill/docs/CLI.md +71 -21
  90. package/dist-skill/docs/generated/assembly.md +277 -229
  91. package/dist-skill/docs/generated/core.md +283 -6
  92. package/dist-skill/docs/generated/curves.md +272 -362
  93. package/dist-skill/docs/generated/lib.md +7 -1
  94. package/dist-skill/docs/generated/output.md +19 -4
  95. package/dist-skill/docs/generated/runtime-names.md +41 -0
  96. package/dist-skill/docs/generated/sdf.md +31 -0
  97. package/dist-skill/docs/generated/sheet-metal.md +9 -0
  98. package/dist-skill/docs/generated/sketch.md +44 -2
  99. package/dist-skill/docs/generated/viewport.md +5 -90
  100. package/dist-skill/docs/guides/coordinate-system.md +20 -16
  101. package/dist-skill/docs/guides/geometry-conventions.md +2 -2
  102. package/dist-skill/docs/guides/inspection-bundles.md +2 -1
  103. package/dist-skill/docs/guides/joint-design.md +24 -0
  104. package/dist-skill/docs/guides/positioning.md +13 -3
  105. package/dist-skill/library/forgecad-3d-reconstruction/SKILL.md +2 -2
  106. package/dist-skill/library/forgecad-component-model/SKILL.md +10 -1
  107. package/dist-skill/library/forgecad-image-replicator/SKILL.md +6 -6
  108. package/dist-skill/library/forgecad-image-replicator/scripts/compare_images.py +166 -0
  109. package/dist-skill/library/forgecad-make-a-model/SKILL.md +3 -3
  110. package/dist-skill/library/forgecad-model-grader/SKILL.md +1 -1
  111. package/dist-skill/library/forgecad-prepare-prompt/SKILL.md +1 -1
  112. package/dist-skill/library/forgecad-reconstruction-benchmark/SKILL.md +3 -3
  113. package/dist-skill/library/forgecad-render-inspect/SKILL.md +3 -1
  114. package/examples/api/assembly-kinematics-foundation.forge.js +65 -0
  115. package/examples/api/assembly-kinematics-four-bar.forge.js +115 -0
  116. package/examples/api/assembly-kinematics-limb.forge.js +116 -0
  117. package/examples/api/connector-frame-rig-chain.forge.js +102 -0
  118. package/examples/api/exact-sheet-shell-assembly.forge.js +0 -2
  119. package/examples/api/exact-surface-studio.forge.js +6 -8
  120. package/examples/api/helix-basics.forge.js +6 -6
  121. package/examples/api/lean-foundations/README.md +12 -0
  122. package/examples/api/lean-foundations/curve-blend-exact.forge.js +22 -0
  123. package/examples/api/lean-foundations/curve-fit-interpolation.forge.js +18 -0
  124. package/examples/api/lean-foundations/curve-helix-canonicalization.forge.js +27 -0
  125. package/examples/api/lean-foundations/curve-route-canonicalization.forge.js +16 -0
  126. package/examples/api/lean-foundations/curve-trim-reverse.forge.js +24 -0
  127. package/examples/api/lean-foundations/exact-curve-arc.forge.js +36 -0
  128. package/examples/api/mixed-edge-finishes-proof.forge.js +8 -11
  129. package/examples/api/route3d-elbow.forge.js +68 -0
  130. package/examples/api/transition-curves.forge.js +44 -15
  131. package/examples/api/y-blend-corner-showcase.forge.js +0 -2
  132. package/examples/generative/coral-vase.forge.js +1 -1
  133. package/examples/nurbs-tube.forge.js +1 -1
  134. package/package.json +14 -18
  135. package/dist/assets/EditorApp-CP9Za6tm.js +0 -13630
  136. package/dist/assets/app-CsHnaBWt.css +0 -1789
  137. package/dist/docs-raw/API/README.md +0 -16
  138. package/dist/docs-raw/API/core/concepts.md +0 -118
  139. package/dist/docs-raw/INDEX.md +0 -138
  140. package/dist/docs-raw/RELEASING.md +0 -87
  141. package/dist/docs-raw/agent-native-api.md +0 -27
  142. package/dist/docs-raw/beta-deployment.md +0 -304
  143. package/dist/docs-raw/beta-operations.md +0 -325
  144. package/dist/docs-raw/blueprint-first.md +0 -145
  145. package/dist/docs-raw/cli-monetization.md +0 -112
  146. package/dist/docs-raw/coding-best-practices.md +0 -120
  147. package/dist/docs-raw/coding.md +0 -340
  148. package/dist/docs-raw/deployment.md +0 -374
  149. package/dist/docs-raw/guides/skill-maintenance.md +0 -161
  150. package/dist/docs-raw/guides/surface-members.md +0 -82
  151. package/dist/docs-raw/internals/backend-vocabulary.md +0 -35
  152. package/dist/docs-raw/internals/compiler.md +0 -307
  153. package/dist/docs-raw/internals/constraint-solver-quality.md +0 -161
  154. package/dist/docs-raw/internals/constraint-solver.md +0 -176
  155. package/dist/docs-raw/internals/shape-from-slices.md +0 -152
  156. package/dist/docs-raw/internals/sketch-2d-pipeline.md +0 -108
  157. package/dist/docs-raw/platform/admin.md +0 -45
  158. package/dist/docs-raw/platform/architecture.md +0 -82
  159. package/dist/docs-raw/platform/auth.md +0 -139
  160. package/dist/docs-raw/platform/email.md +0 -67
  161. package/dist/docs-raw/platform/google-oauth-setup.md +0 -88
  162. package/dist/docs-raw/platform/observability.md +0 -197
  163. package/dist/docs-raw/platform/projects.md +0 -111
  164. package/dist/docs-raw/platform/sharing.md +0 -90
  165. package/dist/docs-raw/product/README.md +0 -39
  166. package/dist/docs-raw/product/api-as-product-language.md +0 -13
  167. package/dist/docs-raw/product/business-model.md +0 -15
  168. package/dist/docs-raw/product/competitive-positioning.md +0 -17
  169. package/dist/docs-raw/product/creative-manufacturing.md +0 -15
  170. package/dist/docs-raw/product/founder-story.md +0 -11
  171. package/dist/docs-raw/product/manufacturing-workflows.md +0 -15
  172. package/dist/docs-raw/product/onboarding-first-experience.md +0 -256
  173. package/dist/docs-raw/product/product-loop.md +0 -17
  174. package/dist/docs-raw/product/strategic-decisions.md +0 -22
  175. package/dist/docs-raw/product/user-outreach-email-templates.md +0 -161
  176. package/dist/docs-raw/product/user-segments.md +0 -15
  177. package/dist/docs-raw/product/vision.md +0 -26
  178. package/dist/docs-raw/rl-environments.md +0 -508
  179. package/dist/docs-raw/runbook.md +0 -611
  180. package/dist-cli/check-compiler-LOXCPEOI.js.map +0 -1
  181. package/dist-cli/check-query-propagation-BAKNVWXR.js.map +0 -1
  182. package/dist-cli/chunk-RY43WF46.js.map +0 -1
  183. package/dist-cli/forgecad.js.map +0 -1
  184. package/dist-cli/forgecad_geometry-GYVNKPIE.js.map +0 -1
  185. package/dist-cli/solver-46FFSK2U.js.map +0 -1
  186. package/dist-skill/SKILL-dev.md +0 -145
  187. package/dist-skill/docs-dev/API/core/concepts.md +0 -118
  188. package/dist-skill/docs-dev/CLI.md +0 -647
  189. package/dist-skill/docs-dev/agent-native-api.md +0 -27
  190. package/dist-skill/docs-dev/blueprint-first.md +0 -145
  191. package/dist-skill/docs-dev/coding-best-practices.md +0 -120
  192. package/dist-skill/docs-dev/coding.md +0 -340
  193. package/dist-skill/docs-dev/component-model.md +0 -164
  194. package/dist-skill/docs-dev/generated/assembly.md +0 -794
  195. package/dist-skill/docs-dev/generated/core.md +0 -2117
  196. package/dist-skill/docs-dev/generated/curves.md +0 -2583
  197. package/dist-skill/docs-dev/generated/lib.md +0 -169
  198. package/dist-skill/docs-dev/generated/output.md +0 -247
  199. package/dist-skill/docs-dev/generated/sdf.md +0 -446
  200. package/dist-skill/docs-dev/generated/sheet-metal.md +0 -504
  201. package/dist-skill/docs-dev/generated/sketch.md +0 -1811
  202. package/dist-skill/docs-dev/generated/viewport.md +0 -585
  203. package/dist-skill/docs-dev/generated/wood.md +0 -108
  204. package/dist-skill/docs-dev/guides/coordinate-system.md +0 -46
  205. package/dist-skill/docs-dev/guides/geometry-conventions.md +0 -52
  206. package/dist-skill/docs-dev/guides/inspection-bundles.md +0 -485
  207. package/dist-skill/docs-dev/guides/joint-design.md +0 -78
  208. package/dist-skill/docs-dev/guides/modeling-recipes.md +0 -78
  209. package/dist-skill/docs-dev/guides/positioning.md +0 -161
  210. package/dist-skill/docs-dev/guides/skill-maintenance.md +0 -161
  211. package/dist-skill/docs-dev/internals/backend-vocabulary.md +0 -35
  212. package/dist-skill/docs-dev/internals/compiler.md +0 -307
  213. package/dist-skill/docs-dev/internals/constraint-solver-quality.md +0 -161
  214. package/dist-skill/docs-dev/internals/constraint-solver.md +0 -176
  215. package/dist-skill/docs-dev/internals/sketch-2d-pipeline.md +0 -108
  216. package/dist-skill/library/forgecad-image-replicator/scripts/compare_images.mjs +0 -289
@@ -1,446 +0,0 @@
1
- ---
2
- skill-group: sdf
3
- skill-order: 100
4
- ---
5
-
6
- # SDF Modeling
7
-
8
- Signed Distance Field modeling for organic forms, smooth booleans, TPMS lattices, and deformations. SDFs are inherently implicit fields, not B-rep/exact geometry; use them with caution when precision or exact export matters. Return raw `SdfShape` values directly for native preview; use `toShape(...)` when materializing SDF trees for CAD/export workflows.
9
-
10
- ## Contents
11
-
12
- - [SDF Materialization](#sdf-materialization) — `toShape`, `combine`
13
- - [SdfShape](#sdfshape)
14
- - [sdf](#sdf)
15
- - [Sculpt](#sculpt)
16
-
17
- ## Functions
18
-
19
- ### SDF Materialization
20
-
21
- #### `toShape()` — Materialize one SDF leaf or all SDF leaves in a renderable tree.
22
-
23
- Raw `SdfShape` values become mesh-backed [`Shape`](/docs/core#shape)s. Plain objects and arrays preserve their renderable children as a [`ShapeGroup`](/docs/core#shapegroup) when more than one leaf is found. Non-renderable metadata is ignored for materialization and remains available to callers through normal [`require()`](/docs/core#require) return values.
24
-
25
- ```ts
26
- toShape(value: unknown, options?: SdfToShapeOptions): ToShapeTreeResult
27
- ```
28
-
29
- **`SdfToShapeOptions`**
30
-
31
- | Option | Type | Description |
32
- |--------|------|-------------|
33
- | `edgeLength?` | `number` | Target mesh edge length. Smaller = finer mesh. Overrides quality-derived resolution. |
34
- | `bounds?` | `{ min: Vec3; max: Vec3; }` | Override auto-computed bounds. Strongly recommended for infinite/repeated fields. |
35
- | `quality?` | `SdfMeshingQuality` | Coarse quality preset. Default: 'preview'. |
36
- | `tolerance?` | `number` | Preferred absolute surface tolerance in millimeters. |
37
- | `minFeatureSize?` | `number` | Smallest feature that should survive meshing, in millimeters. |
38
- | `simplify?` | `boolean \| "safe"` | Simplification control. `false` disables, `true` and `'safe'` use topology-validated simplification. |
39
- | `maxTriangles?` | `number` | Optional post-extraction triangle budget. |
40
- | `maxGridPoints?` | `number` | Optional pre-extraction grid-point budget. Default is browser-safe. |
41
- | `minEdgeLength?` | `number` | Lower clamp for resolved edge length. Default: 0.15mm. |
42
- | `diagnostics?` | `boolean` | Log resolved meshing settings and backend extraction timings. |
43
-
44
- #### `combine()` — Collapse a tree of SDF leaves into one continuous SDF field.
45
-
46
- This intentionally discards per-leaf color/material identity because the result is one scalar field. Use plain object returns for multi-material SDF preview, and use `combine(...)` only when you want one implicit body.
47
-
48
- ```ts
49
- combine(value: unknown, options?: CombineOptions): SdfShape
50
- ```
51
-
52
- `CombineOptions`: `{ op?: "union" | "intersection" }`
53
-
54
- ---
55
-
56
- ## Classes
57
-
58
- ### `SdfShape`
59
-
60
- An immutable SDF expression. Supports SDF-specific operations (smooth booleans, domain warps, etc.), can be returned directly for native preview, and converts to a ForgeCAD Shape via `.toShape()` when materialization is needed.
61
-
62
- #### `colorHex()` — Display color carried by this implicit leaf.
63
-
64
- ```ts
65
- get colorHex(): string | undefined
66
- ```
67
-
68
- #### `materialProps()` — Display material carried by this implicit leaf.
69
-
70
- ```ts
71
- get materialProps(): ShapeMaterialProps | undefined
72
- ```
73
-
74
- #### `explicitBounds()` — Explicit bounds carried by this implicit leaf, if any.
75
-
76
- ```ts
77
- get explicitBounds(): SdfBounds | undefined
78
- ```
79
-
80
- #### `clone()` — Clone this SDF expression and its visual metadata.
81
-
82
- ```ts
83
- clone(): SdfShape
84
- ```
85
-
86
- #### `toShape()` — Mesh this SDF into a ForgeCAD Shape through ForgeCAD's Surface Nets pipeline. Once converted, the result is a regular Shape — booleans, transforms, export all work.
87
-
88
- ```ts
89
- toShape(options?: SdfToShapeOptions): Shape
90
- ```
91
-
92
- #### `color()` — Set the display color for this implicit leaf.
93
-
94
- ```ts
95
- color(value: string | undefined): SdfShape
96
- ```
97
-
98
- #### `material()` — Set PBR display material properties for this implicit leaf.
99
-
100
- ```ts
101
- material(props: ShapeMaterialProps): SdfShape
102
- ```
103
-
104
- #### `bounds()` — Set explicit preview/meshing bounds for this implicit leaf.
105
-
106
- ```ts
107
- bounds(bounds: SdfBounds | [ Vec3, Vec3 ]): SdfShape
108
- ```
109
-
110
- #### `at()` — Sculpt-style alias for translate().
111
-
112
- ```ts
113
- at(x: number, y: number, z: number): SdfShape
114
- ```
115
-
116
- #### `move()` — Sculpt-style alias for translate().
117
-
118
- ```ts
119
- move(x: number, y: number, z: number): SdfShape
120
- ```
121
-
122
- #### `spin()` — Sculpt-style alias for rotateZ().
123
-
124
- ```ts
125
- spin(angleDeg: number): SdfShape
126
- ```
127
-
128
- #### `tilt()` — Sculpt-style tilt around X, Y, Z, or a custom axis.
129
-
130
- ```ts
131
- tilt(angleDeg: number, axis?: "x" | "y" | "z" | Vec3): SdfShape
132
- ```
133
-
134
- #### `round()` — Sculpt-style rounded-box helper. Currently applies directly to primitive SDF boxes.
135
-
136
- ```ts
137
- round(radius: number): SdfShape
138
- ```
139
-
140
- #### `blend()` — Sculpt-style smooth blend with another implicit shape.
141
-
142
- ```ts
143
- blend(other: SdfShape, options?: number | { radius?: number; }): SdfShape
144
- ```
145
-
146
- #### `goop()` — Sculpt-style alias for blend().
147
-
148
- ```ts
149
- goop(other: SdfShape, options?: number | { radius?: number; }): SdfShape
150
- ```
151
-
152
- #### `carve()` — Sculpt-style smooth carve/subtract.
153
-
154
- ```ts
155
- carve(other: SdfShape, options?: number | { radius?: number; }): SdfShape
156
- ```
157
-
158
- #### `keep()` — Sculpt-style smooth intersection/keep operation.
159
-
160
- ```ts
161
- keep(other: SdfShape, options?: number | { radius?: number; }): SdfShape
162
- ```
163
-
164
- #### `polish()` — Apply a Sculpt material preset or direct material props.
165
-
166
- ```ts
167
- polish(input?: SculptPolishInput): SdfShape
168
- ```
169
-
170
- #### [`union()`](/docs/core#union) — SDF union (sharp).
171
-
172
- ```ts
173
- union(...others: SdfShape[]): SdfShape
174
- ```
175
-
176
- #### `subtract()` — SDF difference (sharp) — subtracts others from this.
177
-
178
- ```ts
179
- subtract(...others: SdfShape[]): SdfShape
180
- ```
181
-
182
- #### `intersect()` — SDF intersection (sharp).
183
-
184
- ```ts
185
- intersect(...others: SdfShape[]): SdfShape
186
- ```
187
-
188
- #### `clipBox()` — Clip this SDF to an explicit box-shaped design space.
189
-
190
- ```ts
191
- clipBox(x: number, y: number, z: number): SdfShape
192
- ```
193
-
194
- #### `fillWith()` — Keep only the material where this shape overlaps another SDF pattern.
195
-
196
- ```ts
197
- fillWith(pattern: SdfShape): SdfShape
198
- ```
199
-
200
- #### `fillWithGyroid()` — Keep only the gyroid lattice inside this shape.
201
-
202
- ```ts
203
- fillWithGyroid(options: TpmsOptions): SdfShape
204
- ```
205
-
206
- #### `fillWithSchwarzP()` — Keep only the Schwarz-P lattice inside this shape.
207
-
208
- ```ts
209
- fillWithSchwarzP(options: TpmsOptions): SdfShape
210
- ```
211
-
212
- #### `fillWithDiamond()` — Keep only the diamond TPMS lattice inside this shape.
213
-
214
- ```ts
215
- fillWithDiamond(options: TpmsOptions): SdfShape
216
- ```
217
-
218
- #### `fillWithLidinoid()` — Keep only the lidinoid TPMS lattice inside this shape.
219
-
220
- ```ts
221
- fillWithLidinoid(options: TpmsOptions): SdfShape
222
- ```
223
-
224
- #### `smoothUnion()` — Smooth union — blends shapes together with a smooth radius.
225
-
226
- ```ts
227
- smoothUnion(other: SdfShape, radius: number): SdfShape
228
- ```
229
-
230
- #### `smoothSubtract()` — Smooth difference — smoothly carves other from this.
231
-
232
- ```ts
233
- smoothSubtract(other: SdfShape, radius: number): SdfShape
234
- ```
235
-
236
- #### `smoothIntersect()` — Smooth intersection — smoothly intersects.
237
-
238
- ```ts
239
- smoothIntersect(other: SdfShape, radius: number): SdfShape
240
- ```
241
-
242
- #### `morph()` — Morph between this shape and another. t=0 → this, t=1 → other.
243
-
244
- ```ts
245
- morph(other: SdfShape, t: number): SdfShape
246
- ```
247
-
248
- #### `translate()` — Translate this SDF by the given offsets in millimeters.
249
-
250
- ```ts
251
- translate(x: number, y: number, z: number): SdfShape
252
- ```
253
-
254
- #### `rotate()` — Rotate around an arbitrary axis through the origin.
255
-
256
- ```ts
257
- rotate(axis: [ number, number, number ], angleDeg: number): SdfShape
258
- ```
259
-
260
- #### `rotateX()` — Rotate around the X axis by the given angle in degrees.
261
-
262
- ```ts
263
- rotateX(angleDeg: number): SdfShape
264
- ```
265
-
266
- #### `rotateY()` — Rotate around the Y axis by the given angle in degrees.
267
-
268
- ```ts
269
- rotateY(angleDeg: number): SdfShape
270
- ```
271
-
272
- #### `rotateZ()` — Rotate around the Z axis by the given angle in degrees.
273
-
274
- ```ts
275
- rotateZ(angleDeg: number): SdfShape
276
- ```
277
-
278
- #### `scale()` — Uniformly scale this SDF around the origin.
279
-
280
- ```ts
281
- scale(factor: number): SdfShape
282
- ```
283
-
284
- #### `twist()` — Twist around the Z axis.
285
-
286
- ```ts
287
- twist(degreesPerUnit: number): SdfShape
288
- ```
289
-
290
- #### `bend()` — Bend around the Z axis with given radius.
291
-
292
- ```ts
293
- bend(radius: number): SdfShape
294
- ```
295
-
296
- #### `repeat()` — Repeat in space. Spacing of 0 on an axis means no repetition. Count of 0 = infinite.
297
-
298
- ```ts
299
- repeat(spacing: Vec3, count?: Vec3): SdfShape
300
- ```
301
-
302
- #### `circularArray()` — Arrange this SDF in a circular array around the Z axis.
303
-
304
- The source shape is translated by `offset` in +X before arraying. This uses angular domain folding, so evaluation stays O(1): the source SDF is sampled twice no matter how many copies are requested.
305
-
306
- ```ts
307
- circularArray(count: number, offset?: number): SdfShape
308
- ```
309
-
310
- #### `shell()` — Hollow out, keeping only a shell of given thickness.
311
-
312
- ```ts
313
- shell(thickness: number): SdfShape
314
- ```
315
-
316
- #### `displace()` — Displace the surface by a function of position, or by a pattern SdfShape.
317
-
318
- ```js
319
- // Function displacement
320
- shape.displace((x, y, z) => Math.sin(x) * 0.5)
321
-
322
- // Pattern displacement from a 3D SDF field
323
- shape.displace(sdf.knurl({ pitch: 2, depth: 0.3 }))
324
- ```
325
-
326
- ```ts
327
- displace(fn: ((x: number, y: number, z: number) => number) | SdfShape, constants?: Record<string, number>): SdfShape
328
- ```
329
-
330
- #### `surfaceDisplace()` — Displace the surface using a 2D pattern in surface-local UV coordinates.
331
-
332
- Automatically detects the shape's UV parametrization (sphere, cylinder, torus) from the SDF tree. Falls back to triplanar mapping for arbitrary shapes.
333
-
334
- UV coordinates are in **surface millimeters** — patterns defined with `spacing: 3` always produce 3mm spacing, regardless of shape size.
335
-
336
- Prefer `sdf.pattern2d()` or built-in surface patterns when the relief should stay on the native shader and meshing path. Callback functions are supported for experimentation, but they are opaque to the typed pattern optimizer.
337
-
338
- ```js
339
- // Native typed pattern — auto-detects sphere UV
340
- const p = sdf.pattern2d()
341
- const ribs = p.stripes({ spacing: 3, width: 0.8, depth: 0.35 })
342
- .add(p.sineWave({ direction: [0, 1], wavelength: 14, amplitude: 0.08 }))
343
-
344
- sdf.sphere(27).shell(3)
345
- .surfaceDisplace(ribs)
346
- .toShape()
347
-
348
- // Custom 2D pattern via function
349
- shape.surfaceDisplace((u, v) => -Math.sin(u * 2) * 0.3)
350
- ```
351
-
352
- ```ts
353
- surfaceDisplace(pattern: SurfacePattern | ((u: number, v: number) => number), options?: SurfaceDisplaceOptions): SdfShape
354
- ```
355
-
356
- #### `onion()` — Create concentric onion layers.
357
-
358
- ```ts
359
- onion(layers: number, thickness: number): SdfShape
360
- ```
361
-
362
- ---
363
-
364
- ## Constants
365
-
366
- ### `sdf`
367
-
368
- SDF modeling — signed distance field primitives, smooth booleans, TPMS lattices, domain warps, and surface patterns.
369
-
370
- Return `SdfShape` values directly from a ForgeCAD script for native raymarch preview. Plain objects and arrays of SDF leaves are renderable too, so object keys become named preview parts.
371
-
372
- Call `.toShape()` or `toShape(...)` only when you need a mesh-backed ForgeCAD Shape for export, mesh booleans, or mixed SDF/manifold projects. All shapes live as a lazy expression tree until that materialization boundary.
373
-
374
- SDF is inherently implicit and sampled, not B-rep/exact geometry. Use it with caution when precision, tolerances, or exact export matter.
375
-
376
- ```js
377
- return sdf.smoothUnion(sdf.sphere(10), sdf.box(15, 15, 15), { radius: 3 })
378
- .color('#4488cc');
379
- ```
380
-
381
- ```js
382
- return {
383
- shell: sdf.sphere(20).shell(2).color('#9be7ff'),
384
- core: sdf.gyroid({ cellSize: 6, wallThickness: 0.8 })
385
- .intersect(sdf.sphere(18))
386
- .color('#ffcf5a'),
387
- };
388
- ```
389
-
390
- - `sphere(radius: number): SdfShape` — Create an SDF sphere centered at the origin.
391
- - `box(x: number, y: number, z: number): SdfShape` — Create an SDF box centered at the origin with given full dimensions (not half-extents).
392
- - `cylinder(height: number, radius: number): SdfShape` — Create an SDF cylinder centered at the origin, axis along Z.
393
- - `torus(majorRadius: number, minorRadius: number): SdfShape` — Create an SDF torus centered at the origin, lying in the XY plane.
394
- - `capsule(height: number, radius: number): SdfShape` — Create an SDF capsule centered at the origin, axis along Z.
395
- - `cone(height: number, radius: number): SdfShape` — Create an SDF cone with base at z=0 and tip at z=height.
396
- - `smoothUnion(a: SdfShape, b: SdfShape, options: { radius: number; }): SdfShape` — Smooth union — blends shapes together with a smooth transition radius.
397
- - `smoothDifference(a: SdfShape, b: SdfShape, options: { radius: number; }): SdfShape` — Smooth difference — smoothly subtracts b from a.
398
- - `smoothIntersection(a: SdfShape, b: SdfShape, options: { radius: number; }): SdfShape` — Smooth intersection — smoothly intersects a and b.
399
- - `morph(a: SdfShape, b: SdfShape, t: number): SdfShape` — Morph between two SDF shapes. t=0 → a, t=1 → b.
400
- - `blend(a: SdfShape, b: SdfShape, fn: (x: number, y: number, z: number) => number, options?: BlendOptions): SdfShape` — Spatially blend between two SDF patterns. The blend function receives (x, y, z) and returns 0..1: 0 = fully pattern `a`, 1 = fully pattern `b`.
401
- - `gyroid(options: TpmsOptions): SdfShape` — Gyroid TPMS lattice — the most common lattice for additive manufacturing.
402
- - `schwarzP(options: TpmsOptions): SdfShape` — Schwarz-P TPMS lattice — isotropic pore structure.
403
- - `diamond(options: TpmsOptions): SdfShape` — Diamond TPMS lattice — stiffest TPMS structure.
404
- - `lidinoid(options: TpmsOptions): SdfShape` — Lidinoid TPMS lattice — visually distinct from gyroid, popular in research and art.
405
- - `tpmsBlock(options: TpmsBlockOptions): SdfShape` — TPMS block preset clipped to an explicit design space.
406
- - `withinBox(shape: SdfShape, options: { size: Vec3; }): SdfShape` — Clip an SDF shape to a box-shaped design space.
407
- - `noise(options?: NoiseOptions): SdfShape` — 3D Simplex noise field — produces organic, natural-looking displacements.
408
- - `voronoi(options?: VoronoiOptions): SdfShape` — 3D Voronoi pattern — organic cellular structures like bone, coral, or soap bubbles.
409
- - `honeycomb(options?: HoneycombOptions): SdfShape` — Honeycomb (hexagonal) lattice pattern. Intersect with your shape to apply.
410
- - `waves(options?: WavesOptions): SdfShape` — Sinusoidal wave ridges — parallel ridges along an axis.
411
- - `knurl(options?: KnurlOptions): SdfShape` — Knurl pattern — crossed helical grooves for grips and handles.
412
- - `perforated(options?: PerforatedOptions): SdfShape` — Perforated plate pattern — regular array of cylindrical holes.
413
- - `scales(options?: ScalesOptions): SdfShape` — Fish/dragon scale pattern — overlapping circular scales in hex-packed rows.
414
- - `brick(options?: BrickOptions): SdfShape` — Brick/stone wall pattern — running bond with mortar grooves.
415
- - `weave(options?: WeaveOptions): SdfShape` — Grid lattice pattern — two families of infinite slabs crossing at 90°.
416
- - `basketWeave(options?: BasketWeaveOptions): SurfacePattern` — Basket weave surface pattern — threads with over-under crossings in UV space. Returns a SurfacePattern for use with `.surfaceDisplace()`.
417
- - `pattern2d(): Pattern2DBuilder` — Create typed, composable 2D surface patterns for `.surfaceDisplace()`.
418
- - `twist(shape: SdfShape, degreesPerUnit: number): SdfShape` — Twist an SDF shape around the Z axis.
419
- - `bend(shape: SdfShape, radius: number): SdfShape` — Bend an SDF shape around the Z axis.
420
- - `repeat(shape: SdfShape, spacing: Vec3, count?: Vec3): SdfShape` — Repeat an SDF shape in space.
421
- - `circularArray(shape: SdfShape, count: number, offset?: number): SdfShape` — Arrange an SDF shape in a circular array around the Z axis with O(1) folded-domain evaluation.
422
- - `SurfacePattern: typeof SurfacePattern` — A 2D surface pattern — a heightmap function for use with `.surfaceDisplace()`.
423
- - `fromFunction(fn: SdfFunctionSource, options: SdfFunctionOptions): SdfShape` — Create a custom SDF from one expression; shader-safe expressions raymarch directly.
424
- - `Sculpt: { sphere: (radius: number) => SdfShape; box: (x: number, y: number, z: number, options?: SculptBoxOptions) => SdfShape; cylinder: (height: number, radius: number) => SdfShape; disk: (radius: number, thickness?: number) => SdfShape; circle: (radius: number, thickness?: number) => SdfShape; capsule: (height: number, radius: number) => SdfShape; torus: (majorRadius: number, minorRadius: number) => SdfShape; cone: (height: number, radius: number) => SdfShape; tube: (points: SculptPointList, options?: SculptTubeOptions) => SdfShape; curve: (points: SculptPointList, options?: SculptTubeOptions) => SdfShape; path: (points: SculptPointList, options?: SculptTubeOptions) => SdfShape; blend: (first?: SculptBlendInput | SculptBlendOptions, optionsOrShape?: SculptBlendInput | SculptBlendOptions, ...rest: (SculptBlendInput | SculptBlendOptions)[]) => SdfShape; union: (first?: SculptBlendInput, ...rest: SculptBlendInput[]) => SdfShape; carve: (base: SdfShape, cutters: SculptBlendInput, options?: SculptBlendOptions) => SdfShape; keep: (first?: SculptBlendInput | SculptBlendOptions, optionsOrShape?: SculptBlendInput | SculptBlendOptions, ...rest: (SculptBlendInput | SculptBlendOptions)[]) => SdfShape; polish: (shape: SdfShape, input?: SculptPolishInput) => SdfShape; material: (input?: SculptPolishInput) => ShapeMaterialProps & { color?: string; }; look: (preset?: SculptLookPreset) => SceneOptions; knownMaterials: typeof knownSculptMaterialPresets; }` — Sculpt-like facade: friendly liquid-modeling verbs backed by the same SDF kernel.
425
-
426
- ### `Sculpt`
427
-
428
- - `sphere(radius: number): SdfShape` — Create a liquid SDF sphere centered at the origin.
429
- - `box(x: number, y: number, z: number, options?: SculptBoxOptions): SdfShape` — Create a liquid SDF box; pass `{ radius }` for a rounded box.
430
- - `cylinder(height: number, radius: number): SdfShape` — Create a liquid SDF cylinder centered at the origin, axis along Z.
431
- - `disk(radius: number, thickness?: number): SdfShape` — Create a thin circular disk centered at the origin, axis along Z. Useful as a circular cutter or insert.
432
- - `circle(radius: number, thickness?: number): SdfShape` — Alias for `Sculpt.disk()`.
433
- - `capsule(height: number, radius: number): SdfShape` — Create a liquid SDF capsule centered at the origin, axis along Z.
434
- - `torus(majorRadius: number, minorRadius: number): SdfShape` — Create a liquid SDF torus lying in the XY plane.
435
- - `cone(height: number, radius: number): SdfShape` — Create a liquid SDF cone.
436
- - `tube(points: SculptPointList, options?: SculptTubeOptions): SdfShape` — Create a smooth tube through a list of 3D points.
437
- - `curve(points: SculptPointList, options?: SculptTubeOptions): SdfShape` — Create a smooth variable-thickness sweep through 3D control points.
438
- - `path(points: SculptPointList, options?: SculptTubeOptions): SdfShape` — Alias for `Sculpt.tube()`; points may use [x, y, z, radius] for variable thickness.
439
- - `blend(first?: SculptBlendArg, optionsOrShape?: SculptBlendArg, ...rest: SculptBlendArg[]): SdfShape` — Smoothly blend one or more SDF shapes into a continuous body.
440
- - `union(first?: SculptBlendInput, ...rest: SculptBlendInput[]): SdfShape` — Sharply union one or more SDF shapes.
441
- - `carve(base: SdfShape, cutters: SculptBlendInput, options?: SculptBlendOptions): SdfShape` — Smoothly subtract one or more cutter shapes from a base shape.
442
- - `keep(first?: SculptBlendArg, optionsOrShape?: SculptBlendArg, ...rest: SculptBlendArg[]): SdfShape` — Smoothly intersect one or more SDF shapes.
443
- - `polish(shape: SdfShape, input?: SculptPolishInput): SdfShape` — Apply a Sculpt material preset or direct material properties.
444
- - `material(input?: SculptPolishInput): ShapeMaterialProps & { color?: string; }` — Resolve a Sculpt material preset to ForgeCAD material properties.
445
- - `look(preset?: SculptLookPreset): SceneOptions` — Return a polished scene preset tuned for liquid SDF preview.
446
- - `knownMaterials(): SculptMaterialPreset[]` — List the built-in Sculpt material preset names.