@snaptrude/plugin-core 0.2.9 → 0.5.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 (269) hide show
  1. package/AGENTS.md +128 -50
  2. package/CHANGELOG.md +52 -6
  3. package/api-manifest.full.json +3999 -0
  4. package/api-manifest.json +3845 -0
  5. package/dist/api/core/buildings.d.ts +427 -0
  6. package/dist/api/core/buildings.d.ts.map +1 -0
  7. package/dist/api/core/comment/index.d.ts +230 -0
  8. package/dist/api/core/comment/index.d.ts.map +1 -0
  9. package/dist/api/core/geom/create/index.d.ts +247 -0
  10. package/dist/api/core/geom/create/index.d.ts.map +1 -0
  11. package/dist/api/core/geom/delete/index.d.ts +72 -0
  12. package/dist/api/core/geom/delete/index.d.ts.map +1 -0
  13. package/dist/api/core/geom/index.d.ts +24 -23
  14. package/dist/api/core/geom/index.d.ts.map +1 -1
  15. package/dist/api/core/geom/query/arc.d.ts +169 -0
  16. package/dist/api/core/geom/query/arc.d.ts.map +1 -0
  17. package/dist/api/core/geom/query/brep.d.ts +402 -0
  18. package/dist/api/core/geom/query/brep.d.ts.map +1 -0
  19. package/dist/api/core/geom/query/circle.d.ts +378 -0
  20. package/dist/api/core/geom/query/circle.d.ts.map +1 -0
  21. package/dist/api/core/geom/query/contour.d.ts +450 -0
  22. package/dist/api/core/geom/query/contour.d.ts.map +1 -0
  23. package/dist/api/core/geom/query/curve.d.ts +918 -0
  24. package/dist/api/core/geom/query/curve.d.ts.map +1 -0
  25. package/dist/api/core/geom/query/edge.d.ts +128 -0
  26. package/dist/api/core/geom/query/edge.d.ts.map +1 -0
  27. package/dist/api/core/geom/query/face.d.ts +363 -0
  28. package/dist/api/core/geom/query/face.d.ts.map +1 -0
  29. package/dist/api/core/geom/query/halfedge.d.ts +206 -0
  30. package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
  31. package/dist/api/core/geom/query/index.d.ts +61 -0
  32. package/dist/api/core/geom/query/index.d.ts.map +1 -0
  33. package/dist/api/core/geom/query/profile.d.ts +410 -0
  34. package/dist/api/core/geom/query/profile.d.ts.map +1 -0
  35. package/dist/api/core/geom/query/vertex.d.ts +187 -0
  36. package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
  37. package/dist/api/core/geom/update/contour.d.ts +272 -0
  38. package/dist/api/core/geom/update/contour.d.ts.map +1 -0
  39. package/dist/api/core/geom/update/curve.d.ts +180 -0
  40. package/dist/api/core/geom/update/curve.d.ts.map +1 -0
  41. package/dist/api/core/geom/update/index.d.ts +27 -0
  42. package/dist/api/core/geom/update/index.d.ts.map +1 -0
  43. package/dist/api/core/geom/update/profile.d.ts +329 -0
  44. package/dist/api/core/geom/update/profile.d.ts.map +1 -0
  45. package/dist/api/core/groups.d.ts +485 -0
  46. package/dist/api/core/groups.d.ts.map +1 -0
  47. package/dist/api/core/history/index.d.ts +78 -0
  48. package/dist/api/core/history/index.d.ts.map +1 -0
  49. package/dist/api/core/index.d.ts +46 -1
  50. package/dist/api/core/index.d.ts.map +1 -1
  51. package/dist/api/core/layers.d.ts +402 -0
  52. package/dist/api/core/layers.d.ts.map +1 -0
  53. package/dist/api/core/math/quat.d.ts +111 -128
  54. package/dist/api/core/math/quat.d.ts.map +1 -1
  55. package/dist/api/core/math/vec3.d.ts +120 -102
  56. package/dist/api/core/math/vec3.d.ts.map +1 -1
  57. package/dist/api/core/project/index.d.ts +399 -0
  58. package/dist/api/core/project/index.d.ts.map +1 -0
  59. package/dist/api/core/tags.d.ts +755 -0
  60. package/dist/api/core/tags.d.ts.map +1 -0
  61. package/dist/api/core/units/index.d.ts +175 -0
  62. package/dist/api/core/units/index.d.ts.map +1 -0
  63. package/dist/api/core/zoom/index.d.ts +45 -0
  64. package/dist/api/core/zoom/index.d.ts.map +1 -0
  65. package/dist/api/design/boolean/index.d.ts +168 -0
  66. package/dist/api/design/boolean/index.d.ts.map +1 -0
  67. package/dist/api/design/create/index.d.ts +828 -0
  68. package/dist/api/design/create/index.d.ts.map +1 -0
  69. package/dist/api/design/delete/index.d.ts +63 -0
  70. package/dist/api/design/delete/index.d.ts.map +1 -0
  71. package/dist/api/design/doors/index.d.ts +268 -0
  72. package/dist/api/design/doors/index.d.ts.map +1 -0
  73. package/dist/api/design/edit/index.d.ts +49 -0
  74. package/dist/api/design/edit/index.d.ts.map +1 -0
  75. package/dist/api/design/erase/index.d.ts +160 -0
  76. package/dist/api/design/erase/index.d.ts.map +1 -0
  77. package/dist/api/design/furniture/index.d.ts +123 -0
  78. package/dist/api/design/furniture/index.d.ts.map +1 -0
  79. package/dist/api/design/index.d.ts +153 -0
  80. package/dist/api/design/index.d.ts.map +1 -0
  81. package/dist/api/design/lock.d.ts +41 -0
  82. package/dist/api/design/lock.d.ts.map +1 -0
  83. package/dist/api/design/materials/index.d.ts +297 -0
  84. package/dist/api/design/materials/index.d.ts.map +1 -0
  85. package/dist/api/design/query/geometry/index.d.ts +140 -0
  86. package/dist/api/design/query/geometry/index.d.ts.map +1 -0
  87. package/dist/api/design/query/index.d.ts +1011 -0
  88. package/dist/api/design/query/index.d.ts.map +1 -0
  89. package/dist/api/design/query/spaces.d.ts +221 -0
  90. package/dist/api/design/query/spaces.d.ts.map +1 -0
  91. package/dist/api/design/selection/index.d.ts +138 -0
  92. package/dist/api/design/selection/index.d.ts.map +1 -0
  93. package/dist/api/design/shared.d.ts +38 -0
  94. package/dist/api/design/shared.d.ts.map +1 -0
  95. package/dist/api/design/transform/index.d.ts +87 -0
  96. package/dist/api/design/transform/index.d.ts.map +1 -0
  97. package/dist/api/design/update/index.d.ts +178 -0
  98. package/dist/api/design/update/index.d.ts.map +1 -0
  99. package/dist/api/design/windows/index.d.ts +189 -0
  100. package/dist/api/design/windows/index.d.ts.map +1 -0
  101. package/dist/api/entity/buildableEnvelope.d.ts +51 -23
  102. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  103. package/dist/api/entity/department.d.ts +0 -98
  104. package/dist/api/entity/department.d.ts.map +1 -1
  105. package/dist/api/entity/index.d.ts +4 -9
  106. package/dist/api/entity/index.d.ts.map +1 -1
  107. package/dist/api/entity/referenceLine.d.ts +49 -106
  108. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  109. package/dist/api/entity/space.d.ts +76 -828
  110. package/dist/api/entity/space.d.ts.map +1 -1
  111. package/dist/api/entity/story.d.ts +47 -37
  112. package/dist/api/entity/story.d.ts.map +1 -1
  113. package/dist/api/index.d.ts +17 -17
  114. package/dist/api/index.d.ts.map +1 -1
  115. package/dist/api/presentation/aiInspiration.d.ts +440 -0
  116. package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
  117. package/dist/api/presentation/diagrams.d.ts +81 -0
  118. package/dist/api/presentation/diagrams.d.ts.map +1 -0
  119. package/dist/api/presentation/import.d.ts +113 -0
  120. package/dist/api/presentation/import.d.ts.map +1 -0
  121. package/dist/api/presentation/index.d.ts +46 -0
  122. package/dist/api/presentation/index.d.ts.map +1 -0
  123. package/dist/api/presentation/sheets.d.ts +176 -0
  124. package/dist/api/presentation/sheets.d.ts.map +1 -0
  125. package/dist/api/presentation/views.d.ts +296 -0
  126. package/dist/api/presentation/views.d.ts.map +1 -0
  127. package/dist/api/program/adjacency.d.ts +155 -0
  128. package/dist/api/program/adjacency.d.ts.map +1 -0
  129. package/dist/api/program/areas.d.ts +360 -0
  130. package/dist/api/program/areas.d.ts.map +1 -0
  131. package/dist/api/program/classification.d.ts +135 -0
  132. package/dist/api/program/classification.d.ts.map +1 -0
  133. package/dist/api/program/cores.d.ts +174 -0
  134. package/dist/api/program/cores.d.ts.map +1 -0
  135. package/dist/api/program/departments.d.ts +431 -0
  136. package/dist/api/program/departments.d.ts.map +1 -0
  137. package/dist/api/program/index.d.ts +69 -0
  138. package/dist/api/program/index.d.ts.map +1 -0
  139. package/dist/api/program/layout.d.ts +63 -0
  140. package/dist/api/program/layout.d.ts.map +1 -0
  141. package/dist/api/program/metrics.d.ts +108 -0
  142. package/dist/api/program/metrics.d.ts.map +1 -0
  143. package/dist/api/program/site.d.ts +367 -0
  144. package/dist/api/program/site.d.ts.map +1 -0
  145. package/dist/api/program/spreadsheet.d.ts +2041 -0
  146. package/dist/api/program/spreadsheet.d.ts.map +1 -0
  147. package/dist/handles.d.ts +138 -0
  148. package/dist/handles.d.ts.map +1 -0
  149. package/dist/host-utils.d.ts +7 -5
  150. package/dist/host-utils.d.ts.map +1 -1
  151. package/dist/index.cjs +3897 -1542
  152. package/dist/index.cjs.map +1 -1
  153. package/dist/index.d.ts +1 -0
  154. package/dist/index.d.ts.map +1 -1
  155. package/dist/index.js +3326 -1462
  156. package/dist/index.js.map +1 -1
  157. package/package.json +6 -2
  158. package/scripts/generate-manifest.mjs +193 -0
  159. package/scripts/generate-manifest.test.mjs +193 -0
  160. package/src/api/core/buildings.ts +485 -0
  161. package/src/api/core/comment/index.ts +258 -0
  162. package/src/api/core/geom/create/index.ts +293 -0
  163. package/src/api/core/geom/delete/index.ts +78 -0
  164. package/src/api/core/geom/index.ts +24 -23
  165. package/src/api/core/geom/query/arc.ts +169 -0
  166. package/src/api/core/geom/query/brep.ts +444 -0
  167. package/src/api/core/geom/query/circle.ts +404 -0
  168. package/src/api/core/geom/query/contour.ts +540 -0
  169. package/src/api/core/geom/query/curve.ts +1078 -0
  170. package/src/api/core/geom/query/edge.ts +130 -0
  171. package/src/api/core/geom/query/face.ts +403 -0
  172. package/src/api/core/geom/query/halfedge.ts +210 -0
  173. package/src/api/core/geom/query/index.ts +63 -0
  174. package/src/api/core/geom/query/profile.ts +473 -0
  175. package/src/api/core/geom/query/vertex.ts +205 -0
  176. package/src/api/core/geom/update/contour.ts +315 -0
  177. package/src/api/core/geom/update/curve.ts +209 -0
  178. package/src/api/core/geom/update/index.ts +29 -0
  179. package/src/api/core/geom/update/profile.ts +377 -0
  180. package/src/api/core/groups.ts +521 -0
  181. package/src/api/core/history/index.ts +84 -0
  182. package/src/api/core/index.ts +46 -1
  183. package/src/api/core/layers.ts +333 -0
  184. package/src/api/core/math/quat.ts +112 -235
  185. package/src/api/core/math/vec3.ts +124 -159
  186. package/src/api/core/project/index.ts +418 -0
  187. package/src/api/core/tags.ts +808 -0
  188. package/src/api/core/units/index.ts +164 -0
  189. package/src/api/core/zoom/index.ts +47 -0
  190. package/src/api/design/boolean/index.ts +179 -0
  191. package/src/api/design/create/index.ts +886 -0
  192. package/src/api/design/delete/index.ts +67 -0
  193. package/src/api/design/doors/index.ts +285 -0
  194. package/src/api/design/edit/index.ts +54 -0
  195. package/src/api/design/erase/index.ts +151 -0
  196. package/src/api/design/furniture/index.ts +130 -0
  197. package/src/api/design/index.ts +162 -0
  198. package/src/api/design/lock.ts +42 -0
  199. package/src/api/design/materials/index.ts +301 -0
  200. package/src/api/design/query/geometry/index.ts +166 -0
  201. package/src/api/design/query/index.ts +937 -0
  202. package/src/api/design/query/spaces.ts +132 -0
  203. package/src/api/design/selection/index.ts +144 -0
  204. package/src/api/design/shared.ts +40 -0
  205. package/src/api/design/transform/index.ts +93 -0
  206. package/src/api/design/update/index.ts +117 -0
  207. package/src/api/design/windows/index.ts +207 -0
  208. package/src/api/entity/buildableEnvelope.ts +64 -23
  209. package/src/api/entity/department.ts +0 -113
  210. package/src/api/entity/index.ts +4 -9
  211. package/src/api/entity/referenceLine.ts +50 -38
  212. package/src/api/entity/space.ts +84 -440
  213. package/src/api/entity/story.ts +53 -42
  214. package/src/api/index.ts +17 -17
  215. package/src/api/presentation/aiInspiration.ts +362 -0
  216. package/src/api/presentation/diagrams.ts +84 -0
  217. package/src/api/presentation/import.ts +112 -0
  218. package/src/api/presentation/index.ts +48 -0
  219. package/src/api/presentation/sheets.ts +198 -0
  220. package/src/api/presentation/views.ts +303 -0
  221. package/src/api/program/adjacency.ts +164 -0
  222. package/src/api/program/areas.ts +335 -0
  223. package/src/api/program/classification.ts +138 -0
  224. package/src/api/program/cores.ts +171 -0
  225. package/src/api/program/departments.ts +465 -0
  226. package/src/api/program/index.ts +71 -0
  227. package/src/api/program/layout.ts +68 -0
  228. package/src/api/program/metrics.ts +120 -0
  229. package/src/api/program/site.ts +326 -0
  230. package/src/api/program/spreadsheet.ts +2075 -0
  231. package/src/handles.ts +148 -0
  232. package/src/host-utils.ts +10 -6
  233. package/src/index.ts +1 -0
  234. package/dist/api/core/geom/arc.d.ts +0 -81
  235. package/dist/api/core/geom/arc.d.ts.map +0 -1
  236. package/dist/api/core/geom/curve.d.ts +0 -70
  237. package/dist/api/core/geom/curve.d.ts.map +0 -1
  238. package/dist/api/core/geom/line.d.ts +0 -56
  239. package/dist/api/core/geom/line.d.ts.map +0 -1
  240. package/dist/api/core/geom/profile.d.ts +0 -121
  241. package/dist/api/core/geom/profile.d.ts.map +0 -1
  242. package/dist/api/documentation/aiInspiration.d.ts +0 -2155
  243. package/dist/api/documentation/aiInspiration.d.ts.map +0 -1
  244. package/dist/api/documentation/index.d.ts +0 -13
  245. package/dist/api/documentation/index.d.ts.map +0 -1
  246. package/dist/api/tools/copy.d.ts +0 -59
  247. package/dist/api/tools/copy.d.ts.map +0 -1
  248. package/dist/api/tools/index.d.ts +0 -29
  249. package/dist/api/tools/index.d.ts.map +0 -1
  250. package/dist/api/tools/offset.d.ts +0 -43
  251. package/dist/api/tools/offset.d.ts.map +0 -1
  252. package/dist/api/tools/selection.d.ts +0 -48
  253. package/dist/api/tools/selection.d.ts.map +0 -1
  254. package/dist/api/tools/transform.d.ts +0 -114
  255. package/dist/api/tools/transform.d.ts.map +0 -1
  256. package/dist/api/units/index.d.ts +0 -163
  257. package/dist/api/units/index.d.ts.map +0 -1
  258. package/src/api/core/geom/arc.ts +0 -70
  259. package/src/api/core/geom/curve.ts +0 -41
  260. package/src/api/core/geom/line.ts +0 -53
  261. package/src/api/core/geom/profile.ts +0 -94
  262. package/src/api/documentation/aiInspiration.ts +0 -871
  263. package/src/api/documentation/index.ts +0 -15
  264. package/src/api/tools/copy.ts +0 -55
  265. package/src/api/tools/index.ts +0 -35
  266. package/src/api/tools/offset.ts +0 -43
  267. package/src/api/tools/selection.ts +0 -51
  268. package/src/api/tools/transform.ts +0 -117
  269. package/src/api/units/index.ts +0 -163
@@ -0,0 +1,315 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../../types"
3
+ import {
4
+ ContourHandle,
5
+ ProfileHandle,
6
+ Vec3Handle,
7
+ Vec3Components,
8
+ } from "../../../../handles"
9
+
10
+ /**
11
+ * Contour editing — produce NEW contours from an existing one (all-handle model, §11).
12
+ *
13
+ * A contour is an outer {@linkcode ProfileHandle} plus zero or more inner profiles
14
+ * that punch holes in it. Every method here is an immutable derive-new operation:
15
+ * it takes an opaque {@linkcode ContourHandle} (plus any extra inputs) and returns a
16
+ * fresh {@linkcode ContourHandle} for the resulting contour. The input contour is
17
+ * never mutated — the original handle keeps referring to the unchanged contour. Read
18
+ * the resulting geometry back as plain values with the query namespace.
19
+ *
20
+ * Accessed via `snaptrude.core.geom.update.contour`.
21
+ */
22
+ export abstract class PluginGeomUpdateContourApi {
23
+ constructor() {}
24
+
25
+ /**
26
+ * Offset a contour inward/outward by a signed distance. Immutable — returns a NEW
27
+ * contour and leaves the input unchanged.
28
+ *
29
+ * @param contour The contour to offset
30
+ * @param distance Signed offset distance (outward when positive, inward when negative)
31
+ * @returns The offset contour as a NEW {@linkcode ContourHandle}
32
+ *
33
+ * @examplePrompt Offset this boundary 500mm inward
34
+ * @examplePrompt Shrink this floor outline by half a metre all around
35
+ *
36
+ * # Example
37
+ * ```ts
38
+ * const rect = await snaptrude.core.geom.create.profileRect(10, 8)
39
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
40
+ * const inset = await snaptrude.core.geom.update.contour.offset(contour, -0.5)
41
+ * const area = await snaptrude.core.geom.query.contour.getArea(inset)
42
+ * ```
43
+ */
44
+ public abstract offset(
45
+ contour: ContourHandle,
46
+ distance: number,
47
+ ): PluginApiReturn<ContourHandle>
48
+
49
+ /**
50
+ * Translate a contour by a vector. Immutable — returns a NEW contour and leaves
51
+ * the input unchanged.
52
+ *
53
+ * @param contour The contour to move
54
+ * @param translation Translation vector to move the contour by
55
+ * @returns The moved contour as a NEW {@linkcode ContourHandle}
56
+ *
57
+ * @examplePrompt Move this shape 2 metres to the right
58
+ * @examplePrompt Shift this outline over by 5 feet
59
+ *
60
+ * # Example
61
+ * ```ts
62
+ * const rect = await snaptrude.core.geom.create.profileRect(6, 4)
63
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
64
+ * const shift = await snaptrude.core.math.vec3.new(2, 0, 0)
65
+ * const moved = await snaptrude.core.geom.update.contour.move(contour, shift)
66
+ * ```
67
+ */
68
+ public abstract move(
69
+ contour: ContourHandle,
70
+ translation: Vec3Handle,
71
+ ): PluginApiReturn<ContourHandle>
72
+
73
+ /**
74
+ * Rotate a contour about an axis through an optional pivot. Immutable — returns a
75
+ * NEW contour and leaves the input unchanged.
76
+ *
77
+ * @param contour The contour to rotate
78
+ * @param axis Rotation axis direction
79
+ * @param angle Rotation angle in radians
80
+ * @param pivot Optional pivot point to rotate about (defaults to the origin)
81
+ * @returns The rotated contour as a NEW {@linkcode ContourHandle}
82
+ *
83
+ * @examplePrompt Rotate this shape 45 degrees
84
+ * @examplePrompt Turn this outline 90 degrees about its corner
85
+ *
86
+ * # Example
87
+ * ```ts
88
+ * const rect = await snaptrude.core.geom.create.profileRect(6, 4)
89
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
90
+ * const axis = await snaptrude.core.math.vec3.new(0, 1, 0)
91
+ * const pivot = await snaptrude.core.math.vec3.new(3, 0, 2)
92
+ * const rotated = await snaptrude.core.geom.update.contour.rotate(contour, axis, Math.PI / 4, pivot)
93
+ * ```
94
+ */
95
+ public abstract rotate(
96
+ contour: ContourHandle,
97
+ axis: Vec3Handle,
98
+ angle: number,
99
+ pivot?: Vec3Handle,
100
+ ): PluginApiReturn<ContourHandle>
101
+
102
+ /**
103
+ * Scale a contour uniformly or per-axis about an optional pivot. Immutable —
104
+ * returns a NEW contour and leaves the input unchanged.
105
+ *
106
+ * @param contour The contour to scale
107
+ * @param factor Uniform scale factor, or per-axis factors
108
+ * @param pivot Optional pivot point to scale about (defaults to the origin)
109
+ * @returns The scaled contour as a NEW {@linkcode ContourHandle}
110
+ *
111
+ * @examplePrompt Scale this shape up by a factor of 2
112
+ * @examplePrompt Make this outline half its current size
113
+ *
114
+ * # Example
115
+ * ```ts
116
+ * const rect = await snaptrude.core.geom.create.profileRect(6, 4)
117
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
118
+ * const doubled = await snaptrude.core.geom.update.contour.scale(contour, 2)
119
+ * const stretched = await snaptrude.core.geom.update.contour.scale(contour, { x: 2, y: 1, z: 1 })
120
+ * ```
121
+ */
122
+ public abstract scale(
123
+ contour: ContourHandle,
124
+ factor: number | Vec3Components,
125
+ pivot?: Vec3Handle,
126
+ ): PluginApiReturn<ContourHandle>
127
+
128
+ /**
129
+ * Mirror a contour across a plane. Immutable — returns a NEW contour and leaves
130
+ * the input unchanged.
131
+ *
132
+ * @param contour The contour to mirror
133
+ * @param plane Mirror plane defined by a point on it and its normal
134
+ * @returns The mirrored contour as a NEW {@linkcode ContourHandle}
135
+ *
136
+ * @examplePrompt Mirror this shape across the gridline
137
+ * @examplePrompt Flip this outline to its mirror image
138
+ *
139
+ * # Example
140
+ * ```ts
141
+ * const rect = await snaptrude.core.geom.create.profileRect(6, 4)
142
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
143
+ * const point = await snaptrude.core.math.vec3.new(0, 0, 0)
144
+ * const normal = await snaptrude.core.math.vec3.new(1, 0, 0)
145
+ * const mirrored = await snaptrude.core.geom.update.contour.mirror(contour, { point, normal })
146
+ * ```
147
+ */
148
+ public abstract mirror(
149
+ contour: ContourHandle,
150
+ plane: { point: Vec3Handle; normal: Vec3Handle },
151
+ ): PluginApiReturn<ContourHandle>
152
+
153
+ /**
154
+ * Add a hole to a contour by appending an inner profile. Immutable — returns a NEW
155
+ * contour and leaves the input unchanged.
156
+ *
157
+ * @param contour The contour to add a hole to
158
+ * @param hole The inner profile to add as a hole
159
+ * @returns The contour with the added hole as a NEW {@linkcode ContourHandle}
160
+ *
161
+ * @examplePrompt Cut a hole in this shape
162
+ * @examplePrompt Punch an opening through this floor outline
163
+ *
164
+ * # Example
165
+ * ```ts
166
+ * const outer = await snaptrude.core.geom.create.profileRect(10, 8)
167
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(outer)
168
+ * const hole = await snaptrude.core.geom.create.profileRect(2, 2)
169
+ * const withHole = await snaptrude.core.geom.update.contour.addHole(contour, hole)
170
+ * const count = await snaptrude.core.geom.query.contour.getHoleCount(withHole) // 1
171
+ * ```
172
+ */
173
+ public abstract addHole(
174
+ contour: ContourHandle,
175
+ hole: ProfileHandle,
176
+ ): PluginApiReturn<ContourHandle>
177
+
178
+ /**
179
+ * Remove a hole from a contour by inner-profile index. Immutable — returns a NEW
180
+ * contour and leaves the input unchanged.
181
+ *
182
+ * @param contour The contour to remove a hole from
183
+ * @param index Zero-based index of the inner profile (hole) to remove
184
+ * @returns The contour with the hole removed as a NEW {@linkcode ContourHandle}
185
+ *
186
+ * @examplePrompt Remove the hole from this shape
187
+ * @examplePrompt Fill in the opening in this floor outline
188
+ *
189
+ * # Example
190
+ * ```ts
191
+ * const outer = await snaptrude.core.geom.create.profileRect(10, 8)
192
+ * const hole = await snaptrude.core.geom.create.profileRect(2, 2)
193
+ * const contour = await snaptrude.core.geom.create.contourFromProfiles(outer, [hole])
194
+ * const solid = await snaptrude.core.geom.update.contour.removeHole(contour, 0)
195
+ * ```
196
+ */
197
+ public abstract removeHole(
198
+ contour: ContourHandle,
199
+ index: number,
200
+ ): PluginApiReturn<ContourHandle>
201
+ }
202
+
203
+ /**
204
+ * Arguments for {@linkcode PluginGeomUpdateContourApi.offset}.
205
+ *
206
+ * | Property | Type | Description |
207
+ * |---|---|---|
208
+ * | `contour` | {@linkcode ContourHandle} | The contour to offset |
209
+ * | `distance` | `number` | Signed offset distance (outward when positive, inward when negative) |
210
+ */
211
+ export const PluginGeomUpdateContourOffsetArgs = z.object({
212
+ contour: ContourHandle,
213
+ distance: z.number(),
214
+ })
215
+
216
+ export type PluginGeomUpdateContourOffsetArgs = z.infer<typeof PluginGeomUpdateContourOffsetArgs>
217
+
218
+ /**
219
+ * Arguments for {@linkcode PluginGeomUpdateContourApi.move}.
220
+ *
221
+ * | Property | Type | Description |
222
+ * |---|---|---|
223
+ * | `contour` | {@linkcode ContourHandle} | The contour to move |
224
+ * | `translation` | {@linkcode Vec3Handle} | Translation vector to move the contour by |
225
+ */
226
+ export const PluginGeomUpdateContourMoveArgs = z.object({
227
+ contour: ContourHandle,
228
+ translation: Vec3Handle,
229
+ })
230
+
231
+ export type PluginGeomUpdateContourMoveArgs = z.infer<typeof PluginGeomUpdateContourMoveArgs>
232
+
233
+ /**
234
+ * Arguments for {@linkcode PluginGeomUpdateContourApi.rotate}.
235
+ *
236
+ * | Property | Type | Description |
237
+ * |---|---|---|
238
+ * | `contour` | {@linkcode ContourHandle} | The contour to rotate |
239
+ * | `axis` | {@linkcode Vec3Handle} | Rotation axis direction |
240
+ * | `angle` | `number` | Rotation angle in radians |
241
+ * | `pivot` | {@linkcode Vec3Handle} | Optional pivot point to rotate about (defaults to the origin) |
242
+ */
243
+ export const PluginGeomUpdateContourRotateArgs = z.object({
244
+ contour: ContourHandle,
245
+ axis: Vec3Handle,
246
+ angle: z.number(),
247
+ pivot: Vec3Handle.optional(),
248
+ })
249
+
250
+ export type PluginGeomUpdateContourRotateArgs = z.infer<typeof PluginGeomUpdateContourRotateArgs>
251
+
252
+ /**
253
+ * Arguments for {@linkcode PluginGeomUpdateContourApi.scale}.
254
+ *
255
+ * | Property | Type | Description |
256
+ * |---|---|---|
257
+ * | `contour` | {@linkcode ContourHandle} | The contour to scale |
258
+ * | `factor` | `number` \| {@linkcode Vec3Components} | Uniform scale factor, or per-axis factors |
259
+ * | `pivot` | {@linkcode Vec3Handle} | Optional pivot point to scale about (defaults to the origin) |
260
+ */
261
+ export const PluginGeomUpdateContourScaleArgs = z.object({
262
+ contour: ContourHandle,
263
+ factor: z.union([z.number(), Vec3Components]),
264
+ pivot: Vec3Handle.optional(),
265
+ })
266
+
267
+ export type PluginGeomUpdateContourScaleArgs = z.infer<typeof PluginGeomUpdateContourScaleArgs>
268
+
269
+ /**
270
+ * Arguments for {@linkcode PluginGeomUpdateContourApi.mirror}.
271
+ *
272
+ * | Property | Type | Description |
273
+ * |---|---|---|
274
+ * | `contour` | {@linkcode ContourHandle} | The contour to mirror |
275
+ * | `plane` | `{ point: `{@linkcode Vec3Handle}`, normal: `{@linkcode Vec3Handle}` }` | Mirror plane defined by a point on it and its normal |
276
+ */
277
+ export const PluginGeomUpdateContourMirrorArgs = z.object({
278
+ contour: ContourHandle,
279
+ plane: z.object({
280
+ point: Vec3Handle,
281
+ normal: Vec3Handle,
282
+ }),
283
+ })
284
+
285
+ export type PluginGeomUpdateContourMirrorArgs = z.infer<typeof PluginGeomUpdateContourMirrorArgs>
286
+
287
+ /**
288
+ * Arguments for {@linkcode PluginGeomUpdateContourApi.addHole}.
289
+ *
290
+ * | Property | Type | Description |
291
+ * |---|---|---|
292
+ * | `contour` | {@linkcode ContourHandle} | The contour to add a hole to |
293
+ * | `hole` | {@linkcode ProfileHandle} | The inner profile to add as a hole |
294
+ */
295
+ export const PluginGeomUpdateContourAddHoleArgs = z.object({
296
+ contour: ContourHandle,
297
+ hole: ProfileHandle,
298
+ })
299
+
300
+ export type PluginGeomUpdateContourAddHoleArgs = z.infer<typeof PluginGeomUpdateContourAddHoleArgs>
301
+
302
+ /**
303
+ * Arguments for {@linkcode PluginGeomUpdateContourApi.removeHole}.
304
+ *
305
+ * | Property | Type | Description |
306
+ * |---|---|---|
307
+ * | `contour` | {@linkcode ContourHandle} | The contour to remove a hole from |
308
+ * | `index` | `number` | Zero-based index of the inner profile (hole) to remove |
309
+ */
310
+ export const PluginGeomUpdateContourRemoveHoleArgs = z.object({
311
+ contour: ContourHandle,
312
+ index: z.number(),
313
+ })
314
+
315
+ export type PluginGeomUpdateContourRemoveHoleArgs = z.infer<typeof PluginGeomUpdateContourRemoveHoleArgs>
@@ -0,0 +1,209 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../../types"
3
+ import { Vec3Handle, CurveHandle } from "../../../../handles"
4
+
5
+ /**
6
+ * Curve editing — produce NEW curves from an existing one (all-handle model, §11).
7
+ *
8
+ * Every method takes an opaque {@linkcode CurveHandle} and returns a fresh handle
9
+ * (or handles) for the resulting geometry; the input curve is never mutated. Read
10
+ * the resulting geometry back as plain values with the query namespace.
11
+ *
12
+ * Accessed via `snaptrude.core.geom.update.curve`.
13
+ */
14
+ export abstract class PluginGeomUpdateCurveApi {
15
+ constructor() {}
16
+
17
+ /**
18
+ * Extend a curve by a distance from one of its ends. Host API call — returns a handle.
19
+ *
20
+ * @param curve - The curve to extend
21
+ * @param distance - Distance to extend the curve by
22
+ * @param fromStart - Extend from the start end when `true`, otherwise from the end
23
+ * @returns The extended curve as a {@linkcode CurveHandle}
24
+ *
25
+ * @examplePrompt Extend this line by 1 metre
26
+ * @examplePrompt Lengthen this edge from its start point
27
+ *
28
+ * # Example
29
+ * ```ts
30
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
31
+ * const b = await snaptrude.core.math.vec3.new(5, 0, 0)
32
+ * const line = await snaptrude.core.geom.create.line(a, b)
33
+ * const longer = await snaptrude.core.geom.update.curve.extend(line, 1, false)
34
+ * const length = await snaptrude.core.geom.query.curve.getLength(longer) // 6
35
+ * ```
36
+ */
37
+ public abstract extend(
38
+ curve: CurveHandle,
39
+ distance: number,
40
+ fromStart: boolean,
41
+ ): PluginApiReturn<CurveHandle>
42
+
43
+ /**
44
+ * Split a curve at a point into separate segments. Host API call — returns handles.
45
+ *
46
+ * @param curve - The curve to split
47
+ * @param point - Point on the curve to split at
48
+ * @returns The resulting segments as {@linkcode CurveHandle}`[]`
49
+ *
50
+ * @examplePrompt Split this line at its midpoint
51
+ * @examplePrompt Break this edge into two pieces where it meets the gridline
52
+ *
53
+ * # Example
54
+ * ```ts
55
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
56
+ * const b = await snaptrude.core.math.vec3.new(6, 0, 0)
57
+ * const line = await snaptrude.core.geom.create.line(a, b)
58
+ * const mid = await snaptrude.core.math.vec3.new(3, 0, 0)
59
+ * const [left, right] = await snaptrude.core.geom.update.curve.split(line, mid)
60
+ * ```
61
+ */
62
+ public abstract split(
63
+ curve: CurveHandle,
64
+ point: Vec3Handle,
65
+ ): PluginApiReturn<CurveHandle[]>
66
+
67
+ /**
68
+ * Trim a curve to the portion between two parameter values. Host API call — returns a handle.
69
+ *
70
+ * @param curve - The curve to trim
71
+ * @param startParam - Start parameter of the portion to keep
72
+ * @param endParam - End parameter of the portion to keep
73
+ * @returns The trimmed curve as a {@linkcode CurveHandle}
74
+ *
75
+ * @examplePrompt Trim this line back to a shorter segment
76
+ * @examplePrompt Keep only the middle portion of this curve
77
+ *
78
+ * # Example
79
+ * ```ts
80
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
81
+ * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
82
+ * const line = await snaptrude.core.geom.create.line(a, b)
83
+ * const middle = await snaptrude.core.geom.update.curve.trim(line, 0.25, 0.75)
84
+ * ```
85
+ */
86
+ public abstract trim(
87
+ curve: CurveHandle,
88
+ startParam: number,
89
+ endParam: number,
90
+ ): PluginApiReturn<CurveHandle>
91
+
92
+ /**
93
+ * Offset a curve by a translation vector. Host API call — returns a handle.
94
+ *
95
+ * @param curve - The curve to offset
96
+ * @param vector - Translation vector to offset the curve by
97
+ * @returns The offset curve as a {@linkcode CurveHandle}
98
+ *
99
+ * @examplePrompt Offset this line 500mm to the side
100
+ * @examplePrompt Shift this edge over to make a parallel copy
101
+ *
102
+ * # Example
103
+ * ```ts
104
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
105
+ * const b = await snaptrude.core.math.vec3.new(8, 0, 0)
106
+ * const line = await snaptrude.core.geom.create.line(a, b)
107
+ * const sideways = await snaptrude.core.math.vec3.new(0, 0, 0.5)
108
+ * const parallel = await snaptrude.core.geom.update.curve.offset(line, sideways)
109
+ * ```
110
+ */
111
+ public abstract offset(
112
+ curve: CurveHandle,
113
+ vector: Vec3Handle,
114
+ ): PluginApiReturn<CurveHandle>
115
+
116
+ /**
117
+ * Reverse the direction of a curve. Host API call — returns a handle.
118
+ *
119
+ * @param curve - The curve to reverse
120
+ * @returns The reversed curve as a {@linkcode CurveHandle}
121
+ *
122
+ * # Example
123
+ * ```ts
124
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
125
+ * const b = await snaptrude.core.math.vec3.new(4, 0, 0)
126
+ * const line = await snaptrude.core.geom.create.line(a, b)
127
+ * const reversed = await snaptrude.core.geom.update.curve.reverse(line)
128
+ * const start = await snaptrude.core.geom.query.curve.getStartPoint(reversed) // { x: 4, y: 0, z: 0 }
129
+ * ```
130
+ */
131
+ public abstract reverse(curve: CurveHandle): PluginApiReturn<CurveHandle>
132
+ }
133
+
134
+ /**
135
+ * Arguments for {@linkcode PluginGeomUpdateCurveApi.extend}.
136
+ *
137
+ * | Property | Type | Description |
138
+ * |---|---|---|
139
+ * | `curve` | {@linkcode CurveHandle} | The curve to extend |
140
+ * | `distance` | `number` | Distance to extend the curve by |
141
+ * | `fromStart` | `boolean` | Extend from the start end when `true`, otherwise from the end |
142
+ */
143
+ export const PluginGeomUpdateCurveExtendArgs = z.object({
144
+ curve: CurveHandle,
145
+ distance: z.number(),
146
+ fromStart: z.boolean(),
147
+ })
148
+
149
+ export type PluginGeomUpdateCurveExtendArgs = z.infer<typeof PluginGeomUpdateCurveExtendArgs>
150
+
151
+ /**
152
+ * Arguments for {@linkcode PluginGeomUpdateCurveApi.split}.
153
+ *
154
+ * | Property | Type | Description |
155
+ * |---|---|---|
156
+ * | `curve` | {@linkcode CurveHandle} | The curve to split |
157
+ * | `point` | {@linkcode Vec3Handle} | Point on the curve to split at |
158
+ */
159
+ export const PluginGeomUpdateCurveSplitArgs = z.object({
160
+ curve: CurveHandle,
161
+ point: Vec3Handle,
162
+ })
163
+
164
+ export type PluginGeomUpdateCurveSplitArgs = z.infer<typeof PluginGeomUpdateCurveSplitArgs>
165
+
166
+ /**
167
+ * Arguments for {@linkcode PluginGeomUpdateCurveApi.trim}.
168
+ *
169
+ * | Property | Type | Description |
170
+ * |---|---|---|
171
+ * | `curve` | {@linkcode CurveHandle} | The curve to trim |
172
+ * | `startParam` | `number` | Start parameter of the portion to keep |
173
+ * | `endParam` | `number` | End parameter of the portion to keep |
174
+ */
175
+ export const PluginGeomUpdateCurveTrimArgs = z.object({
176
+ curve: CurveHandle,
177
+ startParam: z.number(),
178
+ endParam: z.number(),
179
+ })
180
+
181
+ export type PluginGeomUpdateCurveTrimArgs = z.infer<typeof PluginGeomUpdateCurveTrimArgs>
182
+
183
+ /**
184
+ * Arguments for {@linkcode PluginGeomUpdateCurveApi.offset}.
185
+ *
186
+ * | Property | Type | Description |
187
+ * |---|---|---|
188
+ * | `curve` | {@linkcode CurveHandle} | The curve to offset |
189
+ * | `vector` | {@linkcode Vec3Handle} | Translation vector to offset the curve by |
190
+ */
191
+ export const PluginGeomUpdateCurveOffsetArgs = z.object({
192
+ curve: CurveHandle,
193
+ vector: Vec3Handle,
194
+ })
195
+
196
+ export type PluginGeomUpdateCurveOffsetArgs = z.infer<typeof PluginGeomUpdateCurveOffsetArgs>
197
+
198
+ /**
199
+ * Arguments for {@linkcode PluginGeomUpdateCurveApi.reverse}.
200
+ *
201
+ * | Property | Type | Description |
202
+ * |---|---|---|
203
+ * | `curve` | {@linkcode CurveHandle} | The curve to reverse |
204
+ */
205
+ export const PluginGeomUpdateCurveReverseArgs = z.object({
206
+ curve: CurveHandle,
207
+ })
208
+
209
+ export type PluginGeomUpdateCurveReverseArgs = z.infer<typeof PluginGeomUpdateCurveReverseArgs>
@@ -0,0 +1,29 @@
1
+ import { PluginGeomUpdateCurveApi } from "./curve"
2
+ import { PluginGeomUpdateProfileApi } from "./profile"
3
+ import { PluginGeomUpdateContourApi } from "./contour"
4
+
5
+ /**
6
+ * Curve/profile/contour update namespace — derive NEW geometry by editing existing
7
+ * handles (all-handle model, §11). Inputs are never mutated; every method returns a
8
+ * fresh handle.
9
+ *
10
+ * - {@linkcode PluginGeomUpdateApi.curve} — extend, split, trim, offset, reverse
11
+ * - {@linkcode PluginGeomUpdateApi.profile} — offset, affine, add/remove/reverse/simplify
12
+ * - {@linkcode PluginGeomUpdateApi.contour} — offset, affine, addHole/removeHole
13
+ *
14
+ * Accessed via `snaptrude.core.geom.update`.
15
+ */
16
+ export abstract class PluginGeomUpdateApi {
17
+ /** Curve editing operations. See {@linkcode PluginGeomUpdateCurveApi}. */
18
+ public abstract curve: PluginGeomUpdateCurveApi
19
+ /** Profile editing operations. See {@linkcode PluginGeomUpdateProfileApi}. */
20
+ public abstract profile: PluginGeomUpdateProfileApi
21
+ /** Contour editing operations. See {@linkcode PluginGeomUpdateContourApi}. */
22
+ public abstract contour: PluginGeomUpdateContourApi
23
+
24
+ constructor() {}
25
+ }
26
+
27
+ export * from "./curve"
28
+ export * from "./profile"
29
+ export * from "./contour"