@snaptrude/plugin-core 0.9.16 → 0.9.18-networks-20261016.1

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 (215) hide show
  1. package/AGENTS.md +231 -231
  2. package/CHANGELOG.md +408 -402
  3. package/CLAUDE.md +11 -11
  4. package/dist/api/analysis/daylight.d.ts +5 -5
  5. package/dist/api/analysis/solar.d.ts +2 -2
  6. package/dist/api/core/camera/index.d.ts +29 -0
  7. package/dist/api/core/camera/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +7 -1
  9. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  10. package/dist/api/core/geom/update/contour.d.ts +8 -2
  11. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  12. package/dist/api/core/zoom/index.d.ts +13 -0
  13. package/dist/api/core/zoom/index.d.ts.map +1 -1
  14. package/dist/api/design/bim.d.ts +209 -0
  15. package/dist/api/design/bim.d.ts.map +1 -0
  16. package/dist/api/design/boolean/index.d.ts +2 -0
  17. package/dist/api/design/boolean/index.d.ts.map +1 -1
  18. package/dist/api/design/catalog.d.ts +320 -0
  19. package/dist/api/design/catalog.d.ts.map +1 -0
  20. package/dist/api/design/create/bulk-items.d.ts +65 -25
  21. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  22. package/dist/api/design/create/index.d.ts +272 -99
  23. package/dist/api/design/create/index.d.ts.map +1 -1
  24. package/dist/api/design/create/opening-fields.d.ts +13 -12
  25. package/dist/api/design/create/opening-fields.d.ts.map +1 -1
  26. package/dist/api/design/delete/index.d.ts +1 -0
  27. package/dist/api/design/delete/index.d.ts.map +1 -1
  28. package/dist/api/design/doors/index.d.ts +18 -24
  29. package/dist/api/design/doors/index.d.ts.map +1 -1
  30. package/dist/api/design/family.d.ts +797 -27
  31. package/dist/api/design/family.d.ts.map +1 -1
  32. package/dist/api/design/index.d.ts +16 -0
  33. package/dist/api/design/index.d.ts.map +1 -1
  34. package/dist/api/design/networks.d.ts +1763 -0
  35. package/dist/api/design/networks.d.ts.map +1 -0
  36. package/dist/api/design/query/index.d.ts +42 -32
  37. package/dist/api/design/query/index.d.ts.map +1 -1
  38. package/dist/api/design/selection/index.d.ts +10 -10
  39. package/dist/api/design/types/index.d.ts +40 -24
  40. package/dist/api/design/types/index.d.ts.map +1 -1
  41. package/dist/api/design/update/index.d.ts +43 -3
  42. package/dist/api/design/update/index.d.ts.map +1 -1
  43. package/dist/api/design/windows/index.d.ts +8 -8
  44. package/dist/api/design/windows/index.d.ts.map +1 -1
  45. package/dist/api/presentation/aiInspiration.d.ts +10 -10
  46. package/dist/api/presentation/annotate.d.ts +38 -22
  47. package/dist/api/presentation/annotate.d.ts.map +1 -1
  48. package/dist/api/presentation/drawingContract.d.ts +32 -0
  49. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  50. package/dist/api/presentation/drawings.d.ts +3523 -0
  51. package/dist/api/presentation/drawings.d.ts.map +1 -0
  52. package/dist/api/presentation/export.d.ts +23 -5
  53. package/dist/api/presentation/export.d.ts.map +1 -1
  54. package/dist/api/presentation/index.d.ts +41 -12
  55. package/dist/api/presentation/index.d.ts.map +1 -1
  56. package/dist/api/presentation/placedViews.d.ts +106 -6
  57. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  58. package/dist/api/presentation/sections.d.ts +461 -0
  59. package/dist/api/presentation/sections.d.ts.map +1 -0
  60. package/dist/api/presentation/shapes.d.ts +2 -2
  61. package/dist/api/presentation/sheets.d.ts +175 -19
  62. package/dist/api/presentation/sheets.d.ts.map +1 -1
  63. package/dist/api/presentation/viewPresets.d.ts +222 -0
  64. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  65. package/dist/api/presentation/views.d.ts +103 -5
  66. package/dist/api/presentation/views.d.ts.map +1 -1
  67. package/dist/api/presentation/walkthroughs.d.ts +6 -6
  68. package/dist/errors/codes.d.ts +3 -1
  69. package/dist/errors/codes.d.ts.map +1 -1
  70. package/dist/index.cjs +3788 -2328
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.js +3650 -2328
  73. package/dist/index.js.map +1 -1
  74. package/package.json +42 -42
  75. package/scripts/check-dist-fresh.mjs +22 -22
  76. package/scripts/generate-manifest.mjs +243 -238
  77. package/scripts/generate-manifest.test.mjs +303 -303
  78. package/src/api/analysis/daylight.ts +470 -470
  79. package/src/api/analysis/heatmaps.ts +683 -683
  80. package/src/api/analysis/illuminance.ts +155 -155
  81. package/src/api/analysis/index.ts +61 -61
  82. package/src/api/analysis/shadows.ts +183 -183
  83. package/src/api/analysis/solar.ts +237 -237
  84. package/src/api/analysis/sunlightHours.ts +211 -211
  85. package/src/api/analysis/sunpath.ts +83 -83
  86. package/src/api/analysis/weather.ts +179 -179
  87. package/src/api/core/buildings.ts +485 -485
  88. package/src/api/core/camera/index.ts +696 -667
  89. package/src/api/core/comment/index.ts +376 -376
  90. package/src/api/core/geom/create/index.ts +2139 -2133
  91. package/src/api/core/geom/delete/index.ts +84 -84
  92. package/src/api/core/geom/index.ts +35 -35
  93. package/src/api/core/geom/query/arc.ts +169 -169
  94. package/src/api/core/geom/query/brep.ts +621 -621
  95. package/src/api/core/geom/query/circle.ts +404 -404
  96. package/src/api/core/geom/query/contour.ts +540 -540
  97. package/src/api/core/geom/query/curve.ts +1102 -1102
  98. package/src/api/core/geom/query/edge.ts +130 -130
  99. package/src/api/core/geom/query/face.ts +508 -508
  100. package/src/api/core/geom/query/halfedge.ts +210 -210
  101. package/src/api/core/geom/query/index.ts +63 -63
  102. package/src/api/core/geom/query/profile.ts +473 -473
  103. package/src/api/core/geom/query/vertex.ts +205 -205
  104. package/src/api/core/geom/update/contour.ts +323 -317
  105. package/src/api/core/geom/update/curve.ts +209 -209
  106. package/src/api/core/geom/update/index.ts +29 -29
  107. package/src/api/core/geom/update/profile.ts +379 -379
  108. package/src/api/core/groups.ts +521 -521
  109. package/src/api/core/handles/index.ts +234 -234
  110. package/src/api/core/history/index.ts +84 -84
  111. package/src/api/core/index.ts +99 -99
  112. package/src/api/core/io/export/index.ts +126 -126
  113. package/src/api/core/io/import/index.ts +504 -504
  114. package/src/api/core/io/index.ts +42 -42
  115. package/src/api/core/io/job/index.ts +140 -140
  116. package/src/api/core/io/query/index.ts +71 -71
  117. package/src/api/core/io/terrain/index.ts +360 -360
  118. package/src/api/core/io/underlay/index.ts +705 -705
  119. package/src/api/core/layers.ts +540 -540
  120. package/src/api/core/math/index.ts +20 -20
  121. package/src/api/core/math/quat.ts +172 -172
  122. package/src/api/core/math/vec3.ts +179 -179
  123. package/src/api/core/mode/index.ts +108 -108
  124. package/src/api/core/project/index.ts +479 -479
  125. package/src/api/core/proposals/index.ts +570 -570
  126. package/src/api/core/storeys/index.ts +308 -308
  127. package/src/api/core/storeys/layers.ts +339 -339
  128. package/src/api/core/tags.ts +911 -911
  129. package/src/api/core/units/index.ts +164 -164
  130. package/src/api/core/user.ts +46 -46
  131. package/src/api/core/zoom/index.ts +64 -51
  132. package/src/api/design/bim.ts +121 -0
  133. package/src/api/design/boolean/index.ts +181 -179
  134. package/src/api/design/catalog.ts +203 -0
  135. package/src/api/design/create/bulk-items.ts +294 -254
  136. package/src/api/design/create/grids.ts +137 -137
  137. package/src/api/design/create/index.ts +2148 -1980
  138. package/src/api/design/create/opening-fields.ts +40 -37
  139. package/src/api/design/delete/index.ts +75 -74
  140. package/src/api/design/dimensions.ts +453 -453
  141. package/src/api/design/doors/index.ts +516 -500
  142. package/src/api/design/edit/index.ts +54 -54
  143. package/src/api/design/erase/index.ts +151 -151
  144. package/src/api/design/family.ts +1334 -704
  145. package/src/api/design/furniture/index.ts +319 -319
  146. package/src/api/design/grids.ts +237 -237
  147. package/src/api/design/index.ts +304 -274
  148. package/src/api/design/lock.ts +69 -69
  149. package/src/api/design/materials/index.ts +608 -608
  150. package/src/api/design/networks.ts +667 -0
  151. package/src/api/design/query/geometry/index.ts +319 -319
  152. package/src/api/design/query/grids.ts +197 -197
  153. package/src/api/design/query/index.ts +1236 -1226
  154. package/src/api/design/query/referenceLines.ts +52 -52
  155. package/src/api/design/query/spaces.ts +275 -275
  156. package/src/api/design/selection/index.ts +273 -273
  157. package/src/api/design/shared.ts +40 -40
  158. package/src/api/design/transform/index.ts +254 -254
  159. package/src/api/design/types/index.ts +163 -156
  160. package/src/api/design/update/index.ts +1024 -983
  161. package/src/api/design/visibility.ts +143 -143
  162. package/src/api/design/windows/index.ts +351 -333
  163. package/src/api/entity/buildableEnvelope.ts +322 -322
  164. package/src/api/entity/index.ts +30 -30
  165. package/src/api/entity/referenceLine.ts +235 -235
  166. package/src/api/entity/space.ts +612 -612
  167. package/src/api/entity/story.ts +517 -517
  168. package/src/api/index.ts +47 -47
  169. package/src/api/presentation/aiInspiration.ts +1116 -1116
  170. package/src/api/presentation/annotate.ts +417 -385
  171. package/src/api/presentation/camera.ts +289 -289
  172. package/src/api/presentation/diagrams.ts +194 -194
  173. package/src/api/presentation/drawingContract.ts +70 -0
  174. package/src/api/presentation/drawings.ts +1179 -0
  175. package/src/api/presentation/export.ts +134 -108
  176. package/src/api/presentation/import.ts +159 -159
  177. package/src/api/presentation/index.ts +160 -126
  178. package/src/api/presentation/placedViews.ts +1211 -1120
  179. package/src/api/presentation/sections.ts +420 -0
  180. package/src/api/presentation/shapes.ts +274 -274
  181. package/src/api/presentation/sheets.ts +746 -585
  182. package/src/api/presentation/slideshow.ts +134 -134
  183. package/src/api/presentation/tables.ts +84 -84
  184. package/src/api/presentation/viewPresets.ts +241 -0
  185. package/src/api/presentation/views.ts +713 -673
  186. package/src/api/presentation/walkthroughs.ts +1201 -1201
  187. package/src/api/program/adjacency.ts +164 -164
  188. package/src/api/program/areas.ts +408 -408
  189. package/src/api/program/classification.ts +138 -138
  190. package/src/api/program/cores.ts +83 -83
  191. package/src/api/program/departments.ts +517 -517
  192. package/src/api/program/index.ts +73 -73
  193. package/src/api/program/labels.ts +332 -332
  194. package/src/api/program/layout.ts +422 -422
  195. package/src/api/program/metadata.ts +364 -364
  196. package/src/api/program/metrics.ts +120 -120
  197. package/src/api/program/site.ts +748 -748
  198. package/src/api/program/spreadsheet.ts +2698 -2698
  199. package/src/api/workspace/index.ts +612 -612
  200. package/src/errors/codes.ts +143 -136
  201. package/src/errors/envelope.ts +75 -75
  202. package/src/errors/index.ts +21 -21
  203. package/src/errors/plugin-error.ts +134 -134
  204. package/src/handles.ts +297 -297
  205. package/src/host-utils.ts +67 -67
  206. package/src/index.ts +7 -7
  207. package/src/massParameters.ops.ts +246 -246
  208. package/src/massParameters.ts +427 -427
  209. package/src/types.ts +16 -16
  210. package/test/drawingContract.test.mjs +288 -0
  211. package/test/errors.test.mjs +185 -184
  212. package/test/massParameters.test.mjs +952 -952
  213. package/tsconfig.json +22 -22
  214. package/tsup.config.ts +12 -12
  215. package/api-manifest.json +0 -9618
@@ -1,1102 +1,1102 @@
1
- import * as z from "zod"
2
- import { PluginApiReturn } from "../../../../types"
3
- import { Vec3Handle, CurveHandle, LineHandle, Vec3Components } from "../../../../handles"
4
-
5
- /**
6
- * Curve queries — read-only geometric questions about curves (lines, arcs and
7
- * splines) and the relationships between two curves.
8
- *
9
- * Every method takes opaque curve handles ({@linkcode CurveHandle}/{@linkcode LineHandle})
10
- * and point handles ({@linkcode Vec3Handle}) and returns plain values — points as
11
- * {@linkcode Vec3Components}, lengths/distances/parameters as `number`, predicates as
12
- * `boolean`. Relationship methods that produce a new curve return a
13
- * {@linkcode CurveHandle} (or `null` when there is no result). No query mutates its
14
- * inputs.
15
- *
16
- * ## Splines
17
- *
18
- * A {@linkcode CurveHandle} is a line, an arc, or a NURBS spline (minted by
19
- * `core.geom.create.splineFromPoints` / `splineFromControlPoints`, and returned by
20
- * `edge.getCurve`, `profile.listCurves` and `update.curve.reverse` for a spline run). Every method here accepts a spline at
21
- * compile time, but only the reads backed by the engine's spline math answer
22
- * for one today. The rest throw `PRECONDITION_FAILED` ("not supported for
23
- * splines yet") — a typed refusal, never a quietly wrong answer.
24
- *
25
- * | Splines | Members |
26
- * |---|---|
27
- * | **supported** | {@linkcode PluginGeomQueryCurveApi.getStartPoint}, {@linkcode PluginGeomQueryCurveApi.getEndPoint}, {@linkcode PluginGeomQueryCurveApi.getLength}, {@linkcode PluginGeomQueryCurveApi.getTangent}, {@linkcode PluginGeomQueryCurveApi.listPoints}, {@linkcode PluginGeomQueryCurveApi.getNearestPoint} |
28
- * | **not yet** | `getMidPoint`, `getChordLength`, `getNormal`, `getProjection`, `getPointAtDistance`, `getParameterAtPoint`, `getCurvature`, `getDistanceToPoint`, `getDistanceAlong`, `listSubdivisions`, `isLinear`, `isOnCurve`, `hasPoint`, `isEqual`, `isOverlapping`, `getCommonPart`, `listIntersections`, `getMergedCurve`, `isContinuous`, `isParallel`, `getShortestGap`, `getDistanceBetween` |
29
- *
30
- * {@linkcode PluginGeomQueryCurveApi.isOverlapping} is deliberately in the
31
- * second row: its line/arc path falls back to structural equality, which would
32
- * answer a spline pair wrongly rather than not at all.
33
- *
34
- * To work around the second row, sample the curve —
35
- * {@linkcode PluginGeomQueryCurveApi.listPoints} then the ordinary
36
- * `core.math.vec3` operations — or read a spline brep edge exactly with
37
- * `core.geom.query.brep.getEdgeCurve`, which returns its degree, control points
38
- * and knots.
39
- *
40
- * Accessed via `snaptrude.core.geom.query.curve`.
41
- */
42
- export abstract class PluginGeomQueryCurveApi {
43
- constructor() {}
44
-
45
- /**
46
- * Get the start point of a curve.
47
- * @param curve The curve to query
48
- * @returns The start point as {@linkcode Vec3Components}
49
- *
50
- * @examplePrompt Where does this wall edge start?
51
- *
52
- * # Example
53
- * ```ts
54
- * const [wall] = await snaptrude.design.query.listWalls()
55
- * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
56
- * if (centerline) {
57
- * const start = await snaptrude.core.geom.query.curve.getStartPoint(centerline)
58
- * console.log(start.x, start.y, start.z)
59
- * }
60
- * ```
61
- */
62
- public abstract getStartPoint(curve: CurveHandle): PluginApiReturn<Vec3Components>
63
-
64
- /**
65
- * Get the end point of a curve.
66
- * @param curve The curve to query
67
- * @returns The end point as {@linkcode Vec3Components}
68
- *
69
- * @examplePrompt Get the coordinates of the far end of this edge
70
- *
71
- * # Example
72
- * ```ts
73
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
74
- * const b = await snaptrude.core.math.vec3.new(5, 0, 0)
75
- * const line = await snaptrude.core.geom.create.line(a, b)
76
- * const end = await snaptrude.core.geom.query.curve.getEndPoint(line) // { x: 5, y: 0, z: 0 }
77
- * ```
78
- */
79
- public abstract getEndPoint(curve: CurveHandle): PluginApiReturn<Vec3Components>
80
-
81
- /**
82
- * Get the mid point of a curve.
83
- * @param curve The curve to query
84
- * @returns The mid point as {@linkcode Vec3Components}
85
- *
86
- * @examplePrompt Find the midpoint of this wall edge
87
- * @examplePrompt Where is the centre of this boundary line?
88
- *
89
- * # Example
90
- * ```ts
91
- * const [wall] = await snaptrude.design.query.listWalls()
92
- * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
93
- * if (centerline) {
94
- * const mid = await snaptrude.core.geom.query.curve.getMidPoint(centerline)
95
- * console.log(mid.x, mid.y, mid.z)
96
- * }
97
- * ```
98
- */
99
- public abstract getMidPoint(curve: CurveHandle): PluginApiReturn<Vec3Components>
100
-
101
- /**
102
- * Get the arc-length of a curve.
103
- * @param curve The curve to query
104
- * @returns The curve length as a `number`
105
- *
106
- * @examplePrompt How long is this wall edge?
107
- * @examplePrompt Measure the length of this curved boundary
108
- *
109
- * # Example
110
- * ```ts
111
- * const [wall] = await snaptrude.design.query.listWalls()
112
- * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
113
- * if (centerline) {
114
- * const length = await snaptrude.core.geom.query.curve.getLength(centerline)
115
- * }
116
- * ```
117
- */
118
- public abstract getLength(curve: CurveHandle): PluginApiReturn<number>
119
-
120
- /**
121
- * Get the straight-line chord length between a curve's endpoints.
122
- * @param curve The curve to query
123
- * @returns The chord length as a `number`
124
- *
125
- * @examplePrompt What is the straight-line distance between the two ends of this arc?
126
- *
127
- * # Example
128
- * ```ts
129
- * const start = await snaptrude.core.math.vec3.new(5, 0, 0)
130
- * const end = await snaptrude.core.math.vec3.new(-5, 0, 0)
131
- * const centre = await snaptrude.core.math.vec3.new(0, 0, 0)
132
- * const axis = await snaptrude.core.math.vec3.new(0, 1, 0)
133
- * const arc = await snaptrude.core.geom.create.arc(start, end, centre, axis)
134
- * const chord = await snaptrude.core.geom.query.curve.getChordLength(arc) // 10 (getLength gives the arc length)
135
- * ```
136
- */
137
- public abstract getChordLength(curve: CurveHandle): PluginApiReturn<number>
138
-
139
- /**
140
- * Get the unit tangent vector of a curve at a point on it.
141
- * @param curve The curve to query
142
- * @param point Point on the curve
143
- * @returns The tangent vector as {@linkcode Vec3Components}
144
- *
145
- * # Example
146
- * ```ts
147
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
148
- * const b = await snaptrude.core.math.vec3.new(3, 0, 4)
149
- * const line = await snaptrude.core.geom.create.line(a, b)
150
- * const tangent = await snaptrude.core.geom.query.curve.getTangent(line, a) // { x: 0.6, y: 0, z: 0.8 }
151
- * ```
152
- */
153
- public abstract getTangent(
154
- curve: CurveHandle,
155
- point: Vec3Handle,
156
- ): PluginApiReturn<Vec3Components>
157
-
158
- /**
159
- * Get the unit normal vector of a curve at a point on it.
160
- * @param curve The curve to query
161
- * @param point Point on the curve
162
- * @returns The normal vector as {@linkcode Vec3Components}
163
- *
164
- * # Example
165
- * ```ts
166
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
167
- * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
168
- * const line = await snaptrude.core.geom.create.line(a, b)
169
- * const normal = await snaptrude.core.geom.query.curve.getNormal(line, a)
170
- * ```
171
- */
172
- public abstract getNormal(
173
- curve: CurveHandle,
174
- point: Vec3Handle,
175
- ): PluginApiReturn<Vec3Components>
176
-
177
- /**
178
- * Get the point on a curve nearest to an arbitrary point.
179
- * @param curve The curve to query
180
- * @param point The reference point
181
- * @returns The nearest point on the curve as {@linkcode Vec3Components}
182
- *
183
- * @examplePrompt Find the point on this edge closest to the column
184
- *
185
- * # Example
186
- * ```ts
187
- * const [wall] = await snaptrude.design.query.listWalls()
188
- * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
189
- * const reference = await snaptrude.core.math.vec3.new(2, 0, 3)
190
- * if (centerline) {
191
- * const nearest = await snaptrude.core.geom.query.curve.getNearestPoint(centerline, reference)
192
- * }
193
- * ```
194
- */
195
- public abstract getNearestPoint(
196
- curve: CurveHandle,
197
- point: Vec3Handle,
198
- ): PluginApiReturn<Vec3Components>
199
-
200
- /**
201
- * Project a point onto a curve.
202
- * @param curve The curve to project onto
203
- * @param point The point to project
204
- * @returns The projected point as {@linkcode Vec3Components}
205
- *
206
- * # Example
207
- * ```ts
208
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
209
- * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
210
- * const line = await snaptrude.core.geom.create.line(a, b)
211
- * const point = await snaptrude.core.math.vec3.new(3, 0, 4)
212
- * const projected = await snaptrude.core.geom.query.curve.getProjection(line, point) // { x: 3, y: 0, z: 0 }
213
- * ```
214
- */
215
- public abstract getProjection(
216
- curve: CurveHandle,
217
- point: Vec3Handle,
218
- ): PluginApiReturn<Vec3Components>
219
-
220
- /**
221
- * Get the point at a given distance along a curve from a reference point.
222
- * @param curve The curve to query
223
- * @param referencePoint Point on the curve to measure from
224
- * @param distance Distance along the curve from the reference point
225
- * @param forward Optional direction along the curve (defaults to `true`)
226
- * @returns The resulting point as {@linkcode Vec3Components}
227
- *
228
- * @examplePrompt Find the point 2 metres along this edge from the corner
229
- * @examplePrompt Mark a spot 900mm from the start of the wall edge
230
- *
231
- * # Example
232
- * ```ts
233
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
234
- * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
235
- * const line = await snaptrude.core.geom.create.line(a, b)
236
- * const p = await snaptrude.core.geom.query.curve.getPointAtDistance(line, a, 2) // { x: 2, y: 0, z: 0 }
237
- * const q = await snaptrude.core.geom.query.curve.getPointAtDistance(line, b, 2, false) // measured backwards from the end
238
- * ```
239
- */
240
- public abstract getPointAtDistance(
241
- curve: CurveHandle,
242
- referencePoint: Vec3Handle,
243
- distance: number,
244
- forward?: boolean,
245
- ): PluginApiReturn<Vec3Components>
246
-
247
- /**
248
- * Get the curve parameter corresponding to a point on the curve.
249
- * @param curve The curve to query
250
- * @param point Point on the curve
251
- * @returns The parameter as a `number`
252
- *
253
- * # Example
254
- * ```ts
255
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
256
- * const b = await snaptrude.core.math.vec3.new(8, 0, 0)
257
- * const line = await snaptrude.core.geom.create.line(a, b)
258
- * const t = await snaptrude.core.geom.query.curve.getParameterAtPoint(line, b)
259
- * ```
260
- */
261
- public abstract getParameterAtPoint(
262
- curve: CurveHandle,
263
- point: Vec3Handle,
264
- ): PluginApiReturn<number>
265
-
266
- /**
267
- * Get the curvature of a curve at a point on it.
268
- * @param curve The curve to query
269
- * @param point Point on the curve
270
- * @returns The curvature as a `number`
271
- *
272
- * # Example
273
- * ```ts
274
- * const start = await snaptrude.core.math.vec3.new(2, 0, 0)
275
- * const end = await snaptrude.core.math.vec3.new(-2, 0, 0)
276
- * const centre = await snaptrude.core.math.vec3.new(0, 0, 0)
277
- * const axis = await snaptrude.core.math.vec3.new(0, 1, 0)
278
- * const arc = await snaptrude.core.geom.create.arc(start, end, centre, axis)
279
- * const k = await snaptrude.core.geom.query.curve.getCurvature(arc, start) // 0.5 (1 / radius)
280
- * ```
281
- */
282
- public abstract getCurvature(
283
- curve: CurveHandle,
284
- point: Vec3Handle,
285
- ): PluginApiReturn<number>
286
-
287
- /**
288
- * Get the shortest distance from an arbitrary point to a curve.
289
- * @param curve The curve to query
290
- * @param point The point to measure from
291
- * @returns The distance as a `number`
292
- *
293
- * @examplePrompt How far is this column from the wall edge?
294
- * @examplePrompt What is the shortest distance from this point to the boundary line?
295
- *
296
- * # Example
297
- * ```ts
298
- * const [wall] = await snaptrude.design.query.listWalls()
299
- * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
300
- * const point = await snaptrude.core.math.vec3.new(2, 0, 3)
301
- * if (centerline) {
302
- * const distance = await snaptrude.core.geom.query.curve.getDistanceToPoint(centerline, point)
303
- * }
304
- * ```
305
- */
306
- public abstract getDistanceToPoint(
307
- curve: CurveHandle,
308
- point: Vec3Handle,
309
- ): PluginApiReturn<number>
310
-
311
- /**
312
- * Get the arc-length distance along a curve between two points on it.
313
- * @param curve The curve to query
314
- * @param pointA First point on the curve
315
- * @param pointB Second point on the curve
316
- * @returns The distance along the curve as a `number`
317
- *
318
- * @examplePrompt How far apart are these two points measured along the curved wall?
319
- *
320
- * # Example
321
- * ```ts
322
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
323
- * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
324
- * const line = await snaptrude.core.geom.create.line(a, b)
325
- * const mid = await snaptrude.core.math.vec3.new(5, 0, 0)
326
- * const d = await snaptrude.core.geom.query.curve.getDistanceAlong(line, a, mid) // 5
327
- * ```
328
- */
329
- public abstract getDistanceAlong(
330
- curve: CurveHandle,
331
- pointA: Vec3Handle,
332
- pointB: Vec3Handle,
333
- ): PluginApiReturn<number>
334
-
335
- /**
336
- * List sampled points along a curve.
337
- * @param curve The curve to sample
338
- * @param resolution Optional number of samples for arcs (defaults to `20`; ignored for lines)
339
- * @returns The sampled points as {@linkcode Vec3Components}`[]`
340
- *
341
- * # Example
342
- * ```ts
343
- * const start = await snaptrude.core.math.vec3.new(5, 0, 0)
344
- * const end = await snaptrude.core.math.vec3.new(0, 0, 5)
345
- * const centre = await snaptrude.core.math.vec3.new(0, 0, 0)
346
- * const axis = await snaptrude.core.math.vec3.new(0, 1, 0)
347
- * const arc = await snaptrude.core.geom.create.arc(start, end, centre, axis)
348
- * const points = await snaptrude.core.geom.query.curve.listPoints(arc, 40)
349
- * for (const p of points) console.log(p.x, p.y, p.z)
350
- * ```
351
- */
352
- public abstract listPoints(
353
- curve: CurveHandle,
354
- resolution?: number,
355
- ): PluginApiReturn<Vec3Components[]>
356
-
357
- /**
358
- * List the points produced by subdividing a curve into equal segments.
359
- * @param curve The curve to subdivide
360
- * @param segments Number of equal segments to divide the curve into
361
- * @returns The subdivision points as {@linkcode Vec3Components}`[]`
362
- *
363
- * @examplePrompt Divide this edge into 5 equal segments
364
- * @examplePrompt Split the wall line into equal parts for placing columns
365
- *
366
- * # Example
367
- * ```ts
368
- * const [wall] = await snaptrude.design.query.listWalls()
369
- * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
370
- * if (centerline) {
371
- * const points = await snaptrude.core.geom.query.curve.listSubdivisions(centerline, 5)
372
- * }
373
- * ```
374
- */
375
- public abstract listSubdivisions(
376
- curve: CurveHandle,
377
- segments: number,
378
- ): PluginApiReturn<Vec3Components[]>
379
-
380
- /**
381
- * Test whether a curve is a straight line.
382
- * @param curve The curve to query
383
- * @returns `true` if the curve is linear, otherwise `false`
384
- *
385
- * @examplePrompt Is this edge straight or curved?
386
- *
387
- * # Example
388
- * ```ts
389
- * const [wall] = await snaptrude.design.query.listWalls()
390
- * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
391
- * if (centerline) {
392
- * const straight = await snaptrude.core.geom.query.curve.isLinear(centerline)
393
- * }
394
- * ```
395
- */
396
- public abstract isLinear(curve: CurveHandle): PluginApiReturn<boolean>
397
-
398
- /**
399
- * Test whether a point lies on a curve within an optional threshold.
400
- * @param curve The curve to query
401
- * @param point The point to test
402
- * @param threshold Optional distance tolerance (defaults to the engine default)
403
- * @returns `true` if the point is on the curve, otherwise `false`
404
- *
405
- * @examplePrompt Check whether this point lies on the wall edge
406
- *
407
- * # Example
408
- * ```ts
409
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
410
- * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
411
- * const line = await snaptrude.core.geom.create.line(a, b)
412
- * const point = await snaptrude.core.math.vec3.new(5, 0, 0.005)
413
- * const on = await snaptrude.core.geom.query.curve.isOnCurve(line, point, 0.01) // true within tolerance
414
- * ```
415
- */
416
- public abstract isOnCurve(
417
- curve: CurveHandle,
418
- point: Vec3Handle,
419
- threshold?: number,
420
- ): PluginApiReturn<boolean>
421
-
422
- /**
423
- * Test whether a curve contains a point, optionally including its endpoints.
424
- * @param curve The curve to query
425
- * @param point The point to test
426
- * @param includeEndPoints Optional flag to count endpoints as contained (defaults to `true`)
427
- * @returns `true` if the curve contains the point, otherwise `false`
428
- *
429
- * # Example
430
- * ```ts
431
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
432
- * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
433
- * const line = await snaptrude.core.geom.create.line(a, b)
434
- * const atEnd = await snaptrude.core.geom.query.curve.hasPoint(line, b) // true (endpoints count by default)
435
- * const interiorOnly = await snaptrude.core.geom.query.curve.hasPoint(line, b, false) // false
436
- * ```
437
- */
438
- public abstract hasPoint(
439
- curve: CurveHandle,
440
- point: Vec3Handle,
441
- includeEndPoints?: boolean,
442
- ): PluginApiReturn<boolean>
443
-
444
- /**
445
- * Test whether two curves are geometrically equal.
446
- * @param curveA First curve
447
- * @param curveB Second curve
448
- * @returns `true` if the curves are equal, otherwise `false`
449
- *
450
- * # Example
451
- * ```ts
452
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
453
- * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
454
- * const lineA = await snaptrude.core.geom.create.line(a, b)
455
- * const lineB = await snaptrude.core.geom.create.line(a, b)
456
- * const same = await snaptrude.core.geom.query.curve.isEqual(lineA, lineB) // true
457
- * ```
458
- */
459
- public abstract isEqual(
460
- curveA: CurveHandle,
461
- curveB: CurveHandle,
462
- ): PluginApiReturn<boolean>
463
-
464
- /**
465
- * Test whether two curves overlap (share a collinear/concentric span), optionally including their endpoints.
466
- * @param curveA First curve
467
- * @param curveB Second curve
468
- * @param includeEndPoints Optional flag to count endpoint contact as overlap (defaults to `false`)
469
- * @returns `true` if the curves overlap, otherwise `false`
470
- *
471
- * @examplePrompt Do these two wall edges overlap?
472
- *
473
- * # Example
474
- * ```ts
475
- * const p0 = await snaptrude.core.math.vec3.new(0, 0, 0)
476
- * const p5 = await snaptrude.core.math.vec3.new(5, 0, 0)
477
- * const p10 = await snaptrude.core.math.vec3.new(10, 0, 0)
478
- * const p15 = await snaptrude.core.math.vec3.new(15, 0, 0)
479
- * const lineA = await snaptrude.core.geom.create.line(p0, p10)
480
- * const lineB = await snaptrude.core.geom.create.line(p5, p15)
481
- * const overlaps = await snaptrude.core.geom.query.curve.isOverlapping(lineA, lineB) // true (share the 5..10 span)
482
- * ```
483
- */
484
- public abstract isOverlapping(
485
- curveA: CurveHandle,
486
- curveB: CurveHandle,
487
- includeEndPoints?: boolean,
488
- ): PluginApiReturn<boolean>
489
-
490
- /**
491
- * Get the common (overlapping) part of two curves.
492
- * @param curveA First curve
493
- * @param curveB Second curve
494
- * @returns The common part as a {@linkcode CurveHandle}, or `null` if there is none
495
- *
496
- * @examplePrompt Get the shared segment where these two edges overlap
497
- *
498
- * # Example
499
- * ```ts
500
- * const p0 = await snaptrude.core.math.vec3.new(0, 0, 0)
501
- * const p5 = await snaptrude.core.math.vec3.new(5, 0, 0)
502
- * const p10 = await snaptrude.core.math.vec3.new(10, 0, 0)
503
- * const p15 = await snaptrude.core.math.vec3.new(15, 0, 0)
504
- * const lineA = await snaptrude.core.geom.create.line(p0, p10)
505
- * const lineB = await snaptrude.core.geom.create.line(p5, p15)
506
- * const common = await snaptrude.core.geom.query.curve.getCommonPart(lineA, lineB)
507
- * if (common) {
508
- * const length = await snaptrude.core.geom.query.curve.getLength(common) // 5
509
- * }
510
- * ```
511
- */
512
- public abstract getCommonPart(
513
- curveA: CurveHandle,
514
- curveB: CurveHandle,
515
- ): PluginApiReturn<CurveHandle | null>
516
-
517
- /**
518
- * List the intersection points between two curves.
519
- * @param curveA First curve
520
- * @param curveB Second curve
521
- * @param boundedA Optional flag to bound intersections to `curveA`'s extent (defaults to `true`)
522
- * @param boundedB Optional flag to bound intersections to `curveB`'s extent (defaults to `true`)
523
- * @returns The intersection points as {@linkcode Vec3Components}`[]`
524
- *
525
- * @examplePrompt Where do these two lines cross?
526
- * @examplePrompt Find the intersection points of these two gridlines
527
- *
528
- * # Example
529
- * ```ts
530
- * const a1 = await snaptrude.core.math.vec3.new(0, 0, 0)
531
- * const a2 = await snaptrude.core.math.vec3.new(10, 0, 0)
532
- * const b1 = await snaptrude.core.math.vec3.new(5, 0, -5)
533
- * const b2 = await snaptrude.core.math.vec3.new(5, 0, 5)
534
- * const lineA = await snaptrude.core.geom.create.line(a1, a2)
535
- * const lineB = await snaptrude.core.geom.create.line(b1, b2)
536
- * const points = await snaptrude.core.geom.query.curve.listIntersections(lineA, lineB) // [{ x: 5, y: 0, z: 0 }]
537
- * const unbounded = await snaptrude.core.geom.query.curve.listIntersections(lineA, lineB, false, false) // treat both as infinite
538
- * ```
539
- */
540
- public abstract listIntersections(
541
- curveA: CurveHandle,
542
- curveB: CurveHandle,
543
- boundedA?: boolean,
544
- boundedB?: boolean,
545
- ): PluginApiReturn<Vec3Components[]>
546
-
547
- /**
548
- * Merge two curves into a single curve when they are mergeable.
549
- * @param curveA First curve
550
- * @param curveB Second curve
551
- * @returns The merged curve as a {@linkcode CurveHandle}, or `null` if they cannot be merged
552
- *
553
- * @examplePrompt Merge these two line segments into a single line
554
- *
555
- * # Example
556
- * ```ts
557
- * const p0 = await snaptrude.core.math.vec3.new(0, 0, 0)
558
- * const p5 = await snaptrude.core.math.vec3.new(5, 0, 0)
559
- * const p10 = await snaptrude.core.math.vec3.new(10, 0, 0)
560
- * const lineA = await snaptrude.core.geom.create.line(p0, p5)
561
- * const lineB = await snaptrude.core.geom.create.line(p5, p10)
562
- * const merged = await snaptrude.core.geom.query.curve.getMergedCurve(lineA, lineB)
563
- * if (merged) {
564
- * const length = await snaptrude.core.geom.query.curve.getLength(merged) // 10
565
- * }
566
- * ```
567
- */
568
- public abstract getMergedCurve(
569
- curveA: CurveHandle,
570
- curveB: CurveHandle,
571
- ): PluginApiReturn<CurveHandle | null>
572
-
573
- /**
574
- * Test whether two curves are continuous (share an endpoint without a gap).
575
- * @param curveA First curve
576
- * @param curveB Second curve
577
- * @returns `true` if the curves are continuous, otherwise `false`
578
- *
579
- * @examplePrompt Do these two edges connect end to end without a gap?
580
- *
581
- * # Example
582
- * ```ts
583
- * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
584
- * const b = await snaptrude.core.math.vec3.new(5, 0, 0)
585
- * const c = await snaptrude.core.math.vec3.new(5, 0, 5)
586
- * const lineA = await snaptrude.core.geom.create.line(a, b)
587
- * const lineB = await snaptrude.core.geom.create.line(b, c)
588
- * const connected = await snaptrude.core.geom.query.curve.isContinuous(lineA, lineB) // true
589
- * ```
590
- */
591
- public abstract isContinuous(
592
- curveA: CurveHandle,
593
- curveB: CurveHandle,
594
- ): PluginApiReturn<boolean>
595
-
596
- /**
597
- * Test whether two lines are parallel within an optional tolerance.
598
- * @param lineA First line
599
- * @param lineB Second line
600
- * @param tolerance Optional angular tolerance (defaults to the engine default)
601
- * @returns `true` if the lines are parallel, otherwise `false`
602
- *
603
- * @examplePrompt Are these two walls parallel?
604
- * @examplePrompt Check if these gridlines run parallel to each other
605
- *
606
- * # Example
607
- * ```ts
608
- * const a1 = await snaptrude.core.math.vec3.new(0, 0, 0)
609
- * const a2 = await snaptrude.core.math.vec3.new(10, 0, 0)
610
- * const b1 = await snaptrude.core.math.vec3.new(0, 0, 3)
611
- * const b2 = await snaptrude.core.math.vec3.new(10, 0, 3)
612
- * const lineA = await snaptrude.core.geom.create.line(a1, a2)
613
- * const lineB = await snaptrude.core.geom.create.line(b1, b2)
614
- * const parallel = await snaptrude.core.geom.query.curve.isParallel(lineA, lineB) // true
615
- * ```
616
- */
617
- public abstract isParallel(
618
- lineA: LineHandle,
619
- lineB: LineHandle,
620
- tolerance?: number,
621
- ): PluginApiReturn<boolean>
622
-
623
- /**
624
- * Get the shortest gap between two curves, optionally including their endpoints.
625
- * @param curveA First curve
626
- * @param curveB Second curve
627
- * @param includeEndPoints Optional flag to include endpoints when measuring (defaults to `false`)
628
- * @returns The shortest gap as a `number`
629
- *
630
- * @examplePrompt What is the gap between these two wall edges?
631
- * @examplePrompt How close do these two curves get to each other?
632
- *
633
- * # Example
634
- * ```ts
635
- * const a1 = await snaptrude.core.math.vec3.new(0, 0, 0)
636
- * const a2 = await snaptrude.core.math.vec3.new(5, 0, 0)
637
- * const b1 = await snaptrude.core.math.vec3.new(0, 0, 2)
638
- * const b2 = await snaptrude.core.math.vec3.new(5, 0, 2)
639
- * const curveA = await snaptrude.core.geom.create.line(a1, a2)
640
- * const curveB = await snaptrude.core.geom.create.line(b1, b2)
641
- * const gap = await snaptrude.core.geom.query.curve.getShortestGap(curveA, curveB) // 2
642
- * ```
643
- */
644
- public abstract getShortestGap(
645
- curveA: CurveHandle,
646
- curveB: CurveHandle,
647
- includeEndPoints?: boolean,
648
- ): PluginApiReturn<number>
649
-
650
- /**
651
- * Get the perpendicular distance between two parallel lines.
652
- * @param lineA First line
653
- * @param lineB Second line
654
- * @returns The distance between the lines as a `number`
655
- *
656
- * @examplePrompt How far apart are these two parallel walls?
657
- * @examplePrompt Measure the spacing between these two gridlines
658
- *
659
- * # Example
660
- * ```ts
661
- * const a1 = await snaptrude.core.math.vec3.new(0, 0, 0)
662
- * const a2 = await snaptrude.core.math.vec3.new(10, 0, 0)
663
- * const b1 = await snaptrude.core.math.vec3.new(0, 0, 4)
664
- * const b2 = await snaptrude.core.math.vec3.new(10, 0, 4)
665
- * const lineA = await snaptrude.core.geom.create.line(a1, a2)
666
- * const lineB = await snaptrude.core.geom.create.line(b1, b2)
667
- * const spacing = await snaptrude.core.geom.query.curve.getDistanceBetween(lineA, lineB) // 4
668
- * ```
669
- */
670
- public abstract getDistanceBetween(
671
- lineA: LineHandle,
672
- lineB: LineHandle,
673
- ): PluginApiReturn<number>
674
- }
675
-
676
- /**
677
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getStartPoint}.
678
- *
679
- * | Property | Type | Description |
680
- * |---|---|---|
681
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
682
- */
683
- export const PluginGeomQueryCurveGetStartPointArgs = z.object({
684
- curve: CurveHandle,
685
- })
686
-
687
- export type PluginGeomQueryCurveGetStartPointArgs = z.infer<typeof PluginGeomQueryCurveGetStartPointArgs>
688
-
689
- /**
690
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getEndPoint}.
691
- *
692
- * | Property | Type | Description |
693
- * |---|---|---|
694
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
695
- */
696
- export const PluginGeomQueryCurveGetEndPointArgs = z.object({
697
- curve: CurveHandle,
698
- })
699
-
700
- export type PluginGeomQueryCurveGetEndPointArgs = z.infer<typeof PluginGeomQueryCurveGetEndPointArgs>
701
-
702
- /**
703
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getMidPoint}.
704
- *
705
- * | Property | Type | Description |
706
- * |---|---|---|
707
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
708
- */
709
- export const PluginGeomQueryCurveGetMidPointArgs = z.object({
710
- curve: CurveHandle,
711
- })
712
-
713
- export type PluginGeomQueryCurveGetMidPointArgs = z.infer<typeof PluginGeomQueryCurveGetMidPointArgs>
714
-
715
- /**
716
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getLength}.
717
- *
718
- * | Property | Type | Description |
719
- * |---|---|---|
720
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
721
- */
722
- export const PluginGeomQueryCurveGetLengthArgs = z.object({
723
- curve: CurveHandle,
724
- })
725
-
726
- export type PluginGeomQueryCurveGetLengthArgs = z.infer<typeof PluginGeomQueryCurveGetLengthArgs>
727
-
728
- /**
729
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getChordLength}.
730
- *
731
- * | Property | Type | Description |
732
- * |---|---|---|
733
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
734
- */
735
- export const PluginGeomQueryCurveGetChordLengthArgs = z.object({
736
- curve: CurveHandle,
737
- })
738
-
739
- export type PluginGeomQueryCurveGetChordLengthArgs = z.infer<typeof PluginGeomQueryCurveGetChordLengthArgs>
740
-
741
- /**
742
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getTangent}.
743
- *
744
- * | Property | Type | Description |
745
- * |---|---|---|
746
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
747
- * | `point` | {@linkcode Vec3Handle} | Point on the curve |
748
- */
749
- export const PluginGeomQueryCurveGetTangentArgs = z.object({
750
- curve: CurveHandle,
751
- point: Vec3Handle,
752
- })
753
-
754
- export type PluginGeomQueryCurveGetTangentArgs = z.infer<typeof PluginGeomQueryCurveGetTangentArgs>
755
-
756
- /**
757
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getNormal}.
758
- *
759
- * | Property | Type | Description |
760
- * |---|---|---|
761
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
762
- * | `point` | {@linkcode Vec3Handle} | Point on the curve |
763
- */
764
- export const PluginGeomQueryCurveGetNormalArgs = z.object({
765
- curve: CurveHandle,
766
- point: Vec3Handle,
767
- })
768
-
769
- export type PluginGeomQueryCurveGetNormalArgs = z.infer<typeof PluginGeomQueryCurveGetNormalArgs>
770
-
771
- /**
772
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getNearestPoint}.
773
- *
774
- * | Property | Type | Description |
775
- * |---|---|---|
776
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
777
- * | `point` | {@linkcode Vec3Handle} | The reference point |
778
- */
779
- export const PluginGeomQueryCurveGetNearestPointArgs = z.object({
780
- curve: CurveHandle,
781
- point: Vec3Handle,
782
- })
783
-
784
- export type PluginGeomQueryCurveGetNearestPointArgs = z.infer<typeof PluginGeomQueryCurveGetNearestPointArgs>
785
-
786
- /**
787
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getProjection}.
788
- *
789
- * | Property | Type | Description |
790
- * |---|---|---|
791
- * | `curve` | {@linkcode CurveHandle} | The curve to project onto |
792
- * | `point` | {@linkcode Vec3Handle} | The point to project |
793
- */
794
- export const PluginGeomQueryCurveGetProjectionArgs = z.object({
795
- curve: CurveHandle,
796
- point: Vec3Handle,
797
- })
798
-
799
- export type PluginGeomQueryCurveGetProjectionArgs = z.infer<typeof PluginGeomQueryCurveGetProjectionArgs>
800
-
801
- /**
802
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getPointAtDistance}.
803
- *
804
- * | Property | Type | Description |
805
- * |---|---|---|
806
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
807
- * | `referencePoint` | {@linkcode Vec3Handle} | Point on the curve to measure from |
808
- * | `distance` | `number` | Distance along the curve from the reference point |
809
- * | `forward` | `boolean` | Optional direction along the curve (defaults to `true`) |
810
- */
811
- export const PluginGeomQueryCurveGetPointAtDistanceArgs = z.object({
812
- curve: CurveHandle,
813
- referencePoint: Vec3Handle,
814
- distance: z.number(),
815
- forward: z.boolean().optional(),
816
- })
817
-
818
- export type PluginGeomQueryCurveGetPointAtDistanceArgs = z.infer<typeof PluginGeomQueryCurveGetPointAtDistanceArgs>
819
-
820
- /**
821
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getParameterAtPoint}.
822
- *
823
- * | Property | Type | Description |
824
- * |---|---|---|
825
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
826
- * | `point` | {@linkcode Vec3Handle} | Point on the curve |
827
- */
828
- export const PluginGeomQueryCurveGetParameterAtPointArgs = z.object({
829
- curve: CurveHandle,
830
- point: Vec3Handle,
831
- })
832
-
833
- export type PluginGeomQueryCurveGetParameterAtPointArgs = z.infer<typeof PluginGeomQueryCurveGetParameterAtPointArgs>
834
-
835
- /**
836
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getCurvature}.
837
- *
838
- * | Property | Type | Description |
839
- * |---|---|---|
840
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
841
- * | `point` | {@linkcode Vec3Handle} | Point on the curve |
842
- */
843
- export const PluginGeomQueryCurveGetCurvatureArgs = z.object({
844
- curve: CurveHandle,
845
- point: Vec3Handle,
846
- })
847
-
848
- export type PluginGeomQueryCurveGetCurvatureArgs = z.infer<typeof PluginGeomQueryCurveGetCurvatureArgs>
849
-
850
- /**
851
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getDistanceToPoint}.
852
- *
853
- * | Property | Type | Description |
854
- * |---|---|---|
855
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
856
- * | `point` | {@linkcode Vec3Handle} | The point to measure from |
857
- */
858
- export const PluginGeomQueryCurveGetDistanceToPointArgs = z.object({
859
- curve: CurveHandle,
860
- point: Vec3Handle,
861
- })
862
-
863
- export type PluginGeomQueryCurveGetDistanceToPointArgs = z.infer<typeof PluginGeomQueryCurveGetDistanceToPointArgs>
864
-
865
- /**
866
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getDistanceAlong}.
867
- *
868
- * | Property | Type | Description |
869
- * |---|---|---|
870
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
871
- * | `pointA` | {@linkcode Vec3Handle} | First point on the curve |
872
- * | `pointB` | {@linkcode Vec3Handle} | Second point on the curve |
873
- */
874
- export const PluginGeomQueryCurveGetDistanceAlongArgs = z.object({
875
- curve: CurveHandle,
876
- pointA: Vec3Handle,
877
- pointB: Vec3Handle,
878
- })
879
-
880
- export type PluginGeomQueryCurveGetDistanceAlongArgs = z.infer<typeof PluginGeomQueryCurveGetDistanceAlongArgs>
881
-
882
- /**
883
- * Arguments for {@linkcode PluginGeomQueryCurveApi.listPoints}.
884
- *
885
- * | Property | Type | Description |
886
- * |---|---|---|
887
- * | `curve` | {@linkcode CurveHandle} | The curve to sample |
888
- * | `resolution` | `number` | Optional number of samples for arcs (defaults to `20`; ignored for lines) |
889
- */
890
- export const PluginGeomQueryCurveListPointsArgs = z.object({
891
- curve: CurveHandle,
892
- resolution: z.number().optional(),
893
- })
894
-
895
- export type PluginGeomQueryCurveListPointsArgs = z.infer<typeof PluginGeomQueryCurveListPointsArgs>
896
-
897
- /**
898
- * Arguments for {@linkcode PluginGeomQueryCurveApi.listSubdivisions}.
899
- *
900
- * | Property | Type | Description |
901
- * |---|---|---|
902
- * | `curve` | {@linkcode CurveHandle} | The curve to subdivide |
903
- * | `segments` | `number` | Number of equal segments to divide the curve into |
904
- */
905
- export const PluginGeomQueryCurveListSubdivisionsArgs = z.object({
906
- curve: CurveHandle,
907
- segments: z.number(),
908
- })
909
-
910
- export type PluginGeomQueryCurveListSubdivisionsArgs = z.infer<typeof PluginGeomQueryCurveListSubdivisionsArgs>
911
-
912
- /**
913
- * Arguments for {@linkcode PluginGeomQueryCurveApi.isLinear}.
914
- *
915
- * | Property | Type | Description |
916
- * |---|---|---|
917
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
918
- */
919
- export const PluginGeomQueryCurveIsLinearArgs = z.object({
920
- curve: CurveHandle,
921
- })
922
-
923
- export type PluginGeomQueryCurveIsLinearArgs = z.infer<typeof PluginGeomQueryCurveIsLinearArgs>
924
-
925
- /**
926
- * Arguments for {@linkcode PluginGeomQueryCurveApi.isOnCurve}.
927
- *
928
- * | Property | Type | Description |
929
- * |---|---|---|
930
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
931
- * | `point` | {@linkcode Vec3Handle} | The point to test |
932
- * | `threshold` | `number` | Optional distance tolerance (defaults to the engine default) |
933
- */
934
- export const PluginGeomQueryCurveIsOnCurveArgs = z.object({
935
- curve: CurveHandle,
936
- point: Vec3Handle,
937
- threshold: z.number().optional(),
938
- })
939
-
940
- export type PluginGeomQueryCurveIsOnCurveArgs = z.infer<typeof PluginGeomQueryCurveIsOnCurveArgs>
941
-
942
- /**
943
- * Arguments for {@linkcode PluginGeomQueryCurveApi.hasPoint}.
944
- *
945
- * | Property | Type | Description |
946
- * |---|---|---|
947
- * | `curve` | {@linkcode CurveHandle} | The curve to query |
948
- * | `point` | {@linkcode Vec3Handle} | The point to test |
949
- * | `includeEndPoints` | `boolean` | Optional flag to count endpoints as contained (defaults to `true`) |
950
- */
951
- export const PluginGeomQueryCurveHasPointArgs = z.object({
952
- curve: CurveHandle,
953
- point: Vec3Handle,
954
- includeEndPoints: z.boolean().optional(),
955
- })
956
-
957
- export type PluginGeomQueryCurveHasPointArgs = z.infer<typeof PluginGeomQueryCurveHasPointArgs>
958
-
959
- /**
960
- * Arguments for {@linkcode PluginGeomQueryCurveApi.isEqual}.
961
- *
962
- * | Property | Type | Description |
963
- * |---|---|---|
964
- * | `curveA` | {@linkcode CurveHandle} | First curve |
965
- * | `curveB` | {@linkcode CurveHandle} | Second curve |
966
- */
967
- export const PluginGeomQueryCurveIsEqualArgs = z.object({
968
- curveA: CurveHandle,
969
- curveB: CurveHandle,
970
- })
971
-
972
- export type PluginGeomQueryCurveIsEqualArgs = z.infer<typeof PluginGeomQueryCurveIsEqualArgs>
973
-
974
- /**
975
- * Arguments for {@linkcode PluginGeomQueryCurveApi.isOverlapping}.
976
- *
977
- * | Property | Type | Description |
978
- * |---|---|---|
979
- * | `curveA` | {@linkcode CurveHandle} | First curve |
980
- * | `curveB` | {@linkcode CurveHandle} | Second curve |
981
- * | `includeEndPoints` | `boolean` | Optional flag to count endpoint contact as overlap (defaults to `false`) |
982
- */
983
- export const PluginGeomQueryCurveIsOverlappingArgs = z.object({
984
- curveA: CurveHandle,
985
- curveB: CurveHandle,
986
- includeEndPoints: z.boolean().optional(),
987
- })
988
-
989
- export type PluginGeomQueryCurveIsOverlappingArgs = z.infer<typeof PluginGeomQueryCurveIsOverlappingArgs>
990
-
991
- /**
992
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getCommonPart}.
993
- *
994
- * | Property | Type | Description |
995
- * |---|---|---|
996
- * | `curveA` | {@linkcode CurveHandle} | First curve |
997
- * | `curveB` | {@linkcode CurveHandle} | Second curve |
998
- */
999
- export const PluginGeomQueryCurveGetCommonPartArgs = z.object({
1000
- curveA: CurveHandle,
1001
- curveB: CurveHandle,
1002
- })
1003
-
1004
- export type PluginGeomQueryCurveGetCommonPartArgs = z.infer<typeof PluginGeomQueryCurveGetCommonPartArgs>
1005
-
1006
- /**
1007
- * Arguments for {@linkcode PluginGeomQueryCurveApi.listIntersections}.
1008
- *
1009
- * | Property | Type | Description |
1010
- * |---|---|---|
1011
- * | `curveA` | {@linkcode CurveHandle} | First curve |
1012
- * | `curveB` | {@linkcode CurveHandle} | Second curve |
1013
- * | `boundedA` | `boolean` | Optional flag to bound intersections to `curveA`'s extent (defaults to `true`) |
1014
- * | `boundedB` | `boolean` | Optional flag to bound intersections to `curveB`'s extent (defaults to `true`) |
1015
- */
1016
- export const PluginGeomQueryCurveListIntersectionsArgs = z.object({
1017
- curveA: CurveHandle,
1018
- curveB: CurveHandle,
1019
- boundedA: z.boolean().optional(),
1020
- boundedB: z.boolean().optional(),
1021
- })
1022
-
1023
- export type PluginGeomQueryCurveListIntersectionsArgs = z.infer<typeof PluginGeomQueryCurveListIntersectionsArgs>
1024
-
1025
- /**
1026
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getMergedCurve}.
1027
- *
1028
- * | Property | Type | Description |
1029
- * |---|---|---|
1030
- * | `curveA` | {@linkcode CurveHandle} | First curve |
1031
- * | `curveB` | {@linkcode CurveHandle} | Second curve |
1032
- */
1033
- export const PluginGeomQueryCurveGetMergedCurveArgs = z.object({
1034
- curveA: CurveHandle,
1035
- curveB: CurveHandle,
1036
- })
1037
-
1038
- export type PluginGeomQueryCurveGetMergedCurveArgs = z.infer<typeof PluginGeomQueryCurveGetMergedCurveArgs>
1039
-
1040
- /**
1041
- * Arguments for {@linkcode PluginGeomQueryCurveApi.isContinuous}.
1042
- *
1043
- * | Property | Type | Description |
1044
- * |---|---|---|
1045
- * | `curveA` | {@linkcode CurveHandle} | First curve |
1046
- * | `curveB` | {@linkcode CurveHandle} | Second curve |
1047
- */
1048
- export const PluginGeomQueryCurveIsContinuousArgs = z.object({
1049
- curveA: CurveHandle,
1050
- curveB: CurveHandle,
1051
- })
1052
-
1053
- export type PluginGeomQueryCurveIsContinuousArgs = z.infer<typeof PluginGeomQueryCurveIsContinuousArgs>
1054
-
1055
- /**
1056
- * Arguments for {@linkcode PluginGeomQueryCurveApi.isParallel}.
1057
- *
1058
- * | Property | Type | Description |
1059
- * |---|---|---|
1060
- * | `lineA` | {@linkcode LineHandle} | First line |
1061
- * | `lineB` | {@linkcode LineHandle} | Second line |
1062
- * | `tolerance` | `number` | Optional angular tolerance (defaults to the engine default) |
1063
- */
1064
- export const PluginGeomQueryCurveIsParallelArgs = z.object({
1065
- lineA: LineHandle,
1066
- lineB: LineHandle,
1067
- tolerance: z.number().optional(),
1068
- })
1069
-
1070
- export type PluginGeomQueryCurveIsParallelArgs = z.infer<typeof PluginGeomQueryCurveIsParallelArgs>
1071
-
1072
- /**
1073
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getShortestGap}.
1074
- *
1075
- * | Property | Type | Description |
1076
- * |---|---|---|
1077
- * | `curveA` | {@linkcode CurveHandle} | First curve |
1078
- * | `curveB` | {@linkcode CurveHandle} | Second curve |
1079
- * | `includeEndPoints` | `boolean` | Optional flag to include endpoints when measuring (defaults to `false`) |
1080
- */
1081
- export const PluginGeomQueryCurveGetShortestGapArgs = z.object({
1082
- curveA: CurveHandle,
1083
- curveB: CurveHandle,
1084
- includeEndPoints: z.boolean().optional(),
1085
- })
1086
-
1087
- export type PluginGeomQueryCurveGetShortestGapArgs = z.infer<typeof PluginGeomQueryCurveGetShortestGapArgs>
1088
-
1089
- /**
1090
- * Arguments for {@linkcode PluginGeomQueryCurveApi.getDistanceBetween}.
1091
- *
1092
- * | Property | Type | Description |
1093
- * |---|---|---|
1094
- * | `lineA` | {@linkcode LineHandle} | First line |
1095
- * | `lineB` | {@linkcode LineHandle} | Second line |
1096
- */
1097
- export const PluginGeomQueryCurveGetDistanceBetweenArgs = z.object({
1098
- lineA: LineHandle,
1099
- lineB: LineHandle,
1100
- })
1101
-
1102
- export type PluginGeomQueryCurveGetDistanceBetweenArgs = z.infer<typeof PluginGeomQueryCurveGetDistanceBetweenArgs>
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../../types"
3
+ import { Vec3Handle, CurveHandle, LineHandle, Vec3Components } from "../../../../handles"
4
+
5
+ /**
6
+ * Curve queries — read-only geometric questions about curves (lines, arcs and
7
+ * splines) and the relationships between two curves.
8
+ *
9
+ * Every method takes opaque curve handles ({@linkcode CurveHandle}/{@linkcode LineHandle})
10
+ * and point handles ({@linkcode Vec3Handle}) and returns plain values — points as
11
+ * {@linkcode Vec3Components}, lengths/distances/parameters as `number`, predicates as
12
+ * `boolean`. Relationship methods that produce a new curve return a
13
+ * {@linkcode CurveHandle} (or `null` when there is no result). No query mutates its
14
+ * inputs.
15
+ *
16
+ * ## Splines
17
+ *
18
+ * A {@linkcode CurveHandle} is a line, an arc, or a NURBS spline (minted by
19
+ * `core.geom.create.splineFromPoints` / `splineFromControlPoints`, and returned by
20
+ * `edge.getCurve`, `profile.listCurves` and `update.curve.reverse` for a spline run). Every method here accepts a spline at
21
+ * compile time, but only the reads backed by the engine's spline math answer
22
+ * for one today. The rest throw `PRECONDITION_FAILED` ("not supported for
23
+ * splines yet") — a typed refusal, never a quietly wrong answer.
24
+ *
25
+ * | Splines | Members |
26
+ * |---|---|
27
+ * | **supported** | {@linkcode PluginGeomQueryCurveApi.getStartPoint}, {@linkcode PluginGeomQueryCurveApi.getEndPoint}, {@linkcode PluginGeomQueryCurveApi.getLength}, {@linkcode PluginGeomQueryCurveApi.getTangent}, {@linkcode PluginGeomQueryCurveApi.listPoints}, {@linkcode PluginGeomQueryCurveApi.getNearestPoint} |
28
+ * | **not yet** | `getMidPoint`, `getChordLength`, `getNormal`, `getProjection`, `getPointAtDistance`, `getParameterAtPoint`, `getCurvature`, `getDistanceToPoint`, `getDistanceAlong`, `listSubdivisions`, `isLinear`, `isOnCurve`, `hasPoint`, `isEqual`, `isOverlapping`, `getCommonPart`, `listIntersections`, `getMergedCurve`, `isContinuous`, `isParallel`, `getShortestGap`, `getDistanceBetween` |
29
+ *
30
+ * {@linkcode PluginGeomQueryCurveApi.isOverlapping} is deliberately in the
31
+ * second row: its line/arc path falls back to structural equality, which would
32
+ * answer a spline pair wrongly rather than not at all.
33
+ *
34
+ * To work around the second row, sample the curve —
35
+ * {@linkcode PluginGeomQueryCurveApi.listPoints} then the ordinary
36
+ * `core.math.vec3` operations — or read a spline brep edge exactly with
37
+ * `core.geom.query.brep.getEdgeCurve`, which returns its degree, control points
38
+ * and knots.
39
+ *
40
+ * Accessed via `snaptrude.core.geom.query.curve`.
41
+ */
42
+ export abstract class PluginGeomQueryCurveApi {
43
+ constructor() {}
44
+
45
+ /**
46
+ * Get the start point of a curve.
47
+ * @param curve The curve to query
48
+ * @returns The start point as {@linkcode Vec3Components}
49
+ *
50
+ * @examplePrompt Where does this wall edge start?
51
+ *
52
+ * # Example
53
+ * ```ts
54
+ * const [wall] = await snaptrude.design.query.listWalls()
55
+ * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
56
+ * if (centerline) {
57
+ * const start = await snaptrude.core.geom.query.curve.getStartPoint(centerline)
58
+ * console.log(start.x, start.y, start.z)
59
+ * }
60
+ * ```
61
+ */
62
+ public abstract getStartPoint(curve: CurveHandle): PluginApiReturn<Vec3Components>
63
+
64
+ /**
65
+ * Get the end point of a curve.
66
+ * @param curve The curve to query
67
+ * @returns The end point as {@linkcode Vec3Components}
68
+ *
69
+ * @examplePrompt Get the coordinates of the far end of this edge
70
+ *
71
+ * # Example
72
+ * ```ts
73
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
74
+ * const b = await snaptrude.core.math.vec3.new(5, 0, 0)
75
+ * const line = await snaptrude.core.geom.create.line(a, b)
76
+ * const end = await snaptrude.core.geom.query.curve.getEndPoint(line) // { x: 5, y: 0, z: 0 }
77
+ * ```
78
+ */
79
+ public abstract getEndPoint(curve: CurveHandle): PluginApiReturn<Vec3Components>
80
+
81
+ /**
82
+ * Get the mid point of a curve.
83
+ * @param curve The curve to query
84
+ * @returns The mid point as {@linkcode Vec3Components}
85
+ *
86
+ * @examplePrompt Find the midpoint of this wall edge
87
+ * @examplePrompt Where is the centre of this boundary line?
88
+ *
89
+ * # Example
90
+ * ```ts
91
+ * const [wall] = await snaptrude.design.query.listWalls()
92
+ * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
93
+ * if (centerline) {
94
+ * const mid = await snaptrude.core.geom.query.curve.getMidPoint(centerline)
95
+ * console.log(mid.x, mid.y, mid.z)
96
+ * }
97
+ * ```
98
+ */
99
+ public abstract getMidPoint(curve: CurveHandle): PluginApiReturn<Vec3Components>
100
+
101
+ /**
102
+ * Get the arc-length of a curve.
103
+ * @param curve The curve to query
104
+ * @returns The curve length as a `number`
105
+ *
106
+ * @examplePrompt How long is this wall edge?
107
+ * @examplePrompt Measure the length of this curved boundary
108
+ *
109
+ * # Example
110
+ * ```ts
111
+ * const [wall] = await snaptrude.design.query.listWalls()
112
+ * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
113
+ * if (centerline) {
114
+ * const length = await snaptrude.core.geom.query.curve.getLength(centerline)
115
+ * }
116
+ * ```
117
+ */
118
+ public abstract getLength(curve: CurveHandle): PluginApiReturn<number>
119
+
120
+ /**
121
+ * Get the straight-line chord length between a curve's endpoints.
122
+ * @param curve The curve to query
123
+ * @returns The chord length as a `number`
124
+ *
125
+ * @examplePrompt What is the straight-line distance between the two ends of this arc?
126
+ *
127
+ * # Example
128
+ * ```ts
129
+ * const start = await snaptrude.core.math.vec3.new(5, 0, 0)
130
+ * const end = await snaptrude.core.math.vec3.new(-5, 0, 0)
131
+ * const centre = await snaptrude.core.math.vec3.new(0, 0, 0)
132
+ * const axis = await snaptrude.core.math.vec3.new(0, 1, 0)
133
+ * const arc = await snaptrude.core.geom.create.arc(start, end, centre, axis)
134
+ * const chord = await snaptrude.core.geom.query.curve.getChordLength(arc) // 10 (getLength gives the arc length)
135
+ * ```
136
+ */
137
+ public abstract getChordLength(curve: CurveHandle): PluginApiReturn<number>
138
+
139
+ /**
140
+ * Get the unit tangent vector of a curve at a point on it.
141
+ * @param curve The curve to query
142
+ * @param point Point on the curve
143
+ * @returns The tangent vector as {@linkcode Vec3Components}
144
+ *
145
+ * # Example
146
+ * ```ts
147
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
148
+ * const b = await snaptrude.core.math.vec3.new(3, 0, 4)
149
+ * const line = await snaptrude.core.geom.create.line(a, b)
150
+ * const tangent = await snaptrude.core.geom.query.curve.getTangent(line, a) // { x: 0.6, y: 0, z: 0.8 }
151
+ * ```
152
+ */
153
+ public abstract getTangent(
154
+ curve: CurveHandle,
155
+ point: Vec3Handle,
156
+ ): PluginApiReturn<Vec3Components>
157
+
158
+ /**
159
+ * Get the unit normal vector of a curve at a point on it.
160
+ * @param curve The curve to query
161
+ * @param point Point on the curve
162
+ * @returns The normal vector as {@linkcode Vec3Components}
163
+ *
164
+ * # Example
165
+ * ```ts
166
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
167
+ * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
168
+ * const line = await snaptrude.core.geom.create.line(a, b)
169
+ * const normal = await snaptrude.core.geom.query.curve.getNormal(line, a)
170
+ * ```
171
+ */
172
+ public abstract getNormal(
173
+ curve: CurveHandle,
174
+ point: Vec3Handle,
175
+ ): PluginApiReturn<Vec3Components>
176
+
177
+ /**
178
+ * Get the point on a curve nearest to an arbitrary point.
179
+ * @param curve The curve to query
180
+ * @param point The reference point
181
+ * @returns The nearest point on the curve as {@linkcode Vec3Components}
182
+ *
183
+ * @examplePrompt Find the point on this edge closest to the column
184
+ *
185
+ * # Example
186
+ * ```ts
187
+ * const [wall] = await snaptrude.design.query.listWalls()
188
+ * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
189
+ * const reference = await snaptrude.core.math.vec3.new(2, 0, 3)
190
+ * if (centerline) {
191
+ * const nearest = await snaptrude.core.geom.query.curve.getNearestPoint(centerline, reference)
192
+ * }
193
+ * ```
194
+ */
195
+ public abstract getNearestPoint(
196
+ curve: CurveHandle,
197
+ point: Vec3Handle,
198
+ ): PluginApiReturn<Vec3Components>
199
+
200
+ /**
201
+ * Project a point onto a curve.
202
+ * @param curve The curve to project onto
203
+ * @param point The point to project
204
+ * @returns The projected point as {@linkcode Vec3Components}
205
+ *
206
+ * # Example
207
+ * ```ts
208
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
209
+ * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
210
+ * const line = await snaptrude.core.geom.create.line(a, b)
211
+ * const point = await snaptrude.core.math.vec3.new(3, 0, 4)
212
+ * const projected = await snaptrude.core.geom.query.curve.getProjection(line, point) // { x: 3, y: 0, z: 0 }
213
+ * ```
214
+ */
215
+ public abstract getProjection(
216
+ curve: CurveHandle,
217
+ point: Vec3Handle,
218
+ ): PluginApiReturn<Vec3Components>
219
+
220
+ /**
221
+ * Get the point at a given distance along a curve from a reference point.
222
+ * @param curve The curve to query
223
+ * @param referencePoint Point on the curve to measure from
224
+ * @param distance Distance along the curve from the reference point
225
+ * @param forward Optional direction along the curve (defaults to `true`)
226
+ * @returns The resulting point as {@linkcode Vec3Components}
227
+ *
228
+ * @examplePrompt Find the point 2 metres along this edge from the corner
229
+ * @examplePrompt Mark a spot 900mm from the start of the wall edge
230
+ *
231
+ * # Example
232
+ * ```ts
233
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
234
+ * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
235
+ * const line = await snaptrude.core.geom.create.line(a, b)
236
+ * const p = await snaptrude.core.geom.query.curve.getPointAtDistance(line, a, 2) // { x: 2, y: 0, z: 0 }
237
+ * const q = await snaptrude.core.geom.query.curve.getPointAtDistance(line, b, 2, false) // measured backwards from the end
238
+ * ```
239
+ */
240
+ public abstract getPointAtDistance(
241
+ curve: CurveHandle,
242
+ referencePoint: Vec3Handle,
243
+ distance: number,
244
+ forward?: boolean,
245
+ ): PluginApiReturn<Vec3Components>
246
+
247
+ /**
248
+ * Get the curve parameter corresponding to a point on the curve.
249
+ * @param curve The curve to query
250
+ * @param point Point on the curve
251
+ * @returns The parameter as a `number`
252
+ *
253
+ * # Example
254
+ * ```ts
255
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
256
+ * const b = await snaptrude.core.math.vec3.new(8, 0, 0)
257
+ * const line = await snaptrude.core.geom.create.line(a, b)
258
+ * const t = await snaptrude.core.geom.query.curve.getParameterAtPoint(line, b)
259
+ * ```
260
+ */
261
+ public abstract getParameterAtPoint(
262
+ curve: CurveHandle,
263
+ point: Vec3Handle,
264
+ ): PluginApiReturn<number>
265
+
266
+ /**
267
+ * Get the curvature of a curve at a point on it.
268
+ * @param curve The curve to query
269
+ * @param point Point on the curve
270
+ * @returns The curvature as a `number`
271
+ *
272
+ * # Example
273
+ * ```ts
274
+ * const start = await snaptrude.core.math.vec3.new(2, 0, 0)
275
+ * const end = await snaptrude.core.math.vec3.new(-2, 0, 0)
276
+ * const centre = await snaptrude.core.math.vec3.new(0, 0, 0)
277
+ * const axis = await snaptrude.core.math.vec3.new(0, 1, 0)
278
+ * const arc = await snaptrude.core.geom.create.arc(start, end, centre, axis)
279
+ * const k = await snaptrude.core.geom.query.curve.getCurvature(arc, start) // 0.5 (1 / radius)
280
+ * ```
281
+ */
282
+ public abstract getCurvature(
283
+ curve: CurveHandle,
284
+ point: Vec3Handle,
285
+ ): PluginApiReturn<number>
286
+
287
+ /**
288
+ * Get the shortest distance from an arbitrary point to a curve.
289
+ * @param curve The curve to query
290
+ * @param point The point to measure from
291
+ * @returns The distance as a `number`
292
+ *
293
+ * @examplePrompt How far is this column from the wall edge?
294
+ * @examplePrompt What is the shortest distance from this point to the boundary line?
295
+ *
296
+ * # Example
297
+ * ```ts
298
+ * const [wall] = await snaptrude.design.query.listWalls()
299
+ * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
300
+ * const point = await snaptrude.core.math.vec3.new(2, 0, 3)
301
+ * if (centerline) {
302
+ * const distance = await snaptrude.core.geom.query.curve.getDistanceToPoint(centerline, point)
303
+ * }
304
+ * ```
305
+ */
306
+ public abstract getDistanceToPoint(
307
+ curve: CurveHandle,
308
+ point: Vec3Handle,
309
+ ): PluginApiReturn<number>
310
+
311
+ /**
312
+ * Get the arc-length distance along a curve between two points on it.
313
+ * @param curve The curve to query
314
+ * @param pointA First point on the curve
315
+ * @param pointB Second point on the curve
316
+ * @returns The distance along the curve as a `number`
317
+ *
318
+ * @examplePrompt How far apart are these two points measured along the curved wall?
319
+ *
320
+ * # Example
321
+ * ```ts
322
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
323
+ * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
324
+ * const line = await snaptrude.core.geom.create.line(a, b)
325
+ * const mid = await snaptrude.core.math.vec3.new(5, 0, 0)
326
+ * const d = await snaptrude.core.geom.query.curve.getDistanceAlong(line, a, mid) // 5
327
+ * ```
328
+ */
329
+ public abstract getDistanceAlong(
330
+ curve: CurveHandle,
331
+ pointA: Vec3Handle,
332
+ pointB: Vec3Handle,
333
+ ): PluginApiReturn<number>
334
+
335
+ /**
336
+ * List sampled points along a curve.
337
+ * @param curve The curve to sample
338
+ * @param resolution Optional number of samples for arcs (defaults to `20`; ignored for lines)
339
+ * @returns The sampled points as {@linkcode Vec3Components}`[]`
340
+ *
341
+ * # Example
342
+ * ```ts
343
+ * const start = await snaptrude.core.math.vec3.new(5, 0, 0)
344
+ * const end = await snaptrude.core.math.vec3.new(0, 0, 5)
345
+ * const centre = await snaptrude.core.math.vec3.new(0, 0, 0)
346
+ * const axis = await snaptrude.core.math.vec3.new(0, 1, 0)
347
+ * const arc = await snaptrude.core.geom.create.arc(start, end, centre, axis)
348
+ * const points = await snaptrude.core.geom.query.curve.listPoints(arc, 40)
349
+ * for (const p of points) console.log(p.x, p.y, p.z)
350
+ * ```
351
+ */
352
+ public abstract listPoints(
353
+ curve: CurveHandle,
354
+ resolution?: number,
355
+ ): PluginApiReturn<Vec3Components[]>
356
+
357
+ /**
358
+ * List the points produced by subdividing a curve into equal segments.
359
+ * @param curve The curve to subdivide
360
+ * @param segments Number of equal segments to divide the curve into
361
+ * @returns The subdivision points as {@linkcode Vec3Components}`[]`
362
+ *
363
+ * @examplePrompt Divide this edge into 5 equal segments
364
+ * @examplePrompt Split the wall line into equal parts for placing columns
365
+ *
366
+ * # Example
367
+ * ```ts
368
+ * const [wall] = await snaptrude.design.query.listWalls()
369
+ * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
370
+ * if (centerline) {
371
+ * const points = await snaptrude.core.geom.query.curve.listSubdivisions(centerline, 5)
372
+ * }
373
+ * ```
374
+ */
375
+ public abstract listSubdivisions(
376
+ curve: CurveHandle,
377
+ segments: number,
378
+ ): PluginApiReturn<Vec3Components[]>
379
+
380
+ /**
381
+ * Test whether a curve is a straight line.
382
+ * @param curve The curve to query
383
+ * @returns `true` if the curve is linear, otherwise `false`
384
+ *
385
+ * @examplePrompt Is this edge straight or curved?
386
+ *
387
+ * # Example
388
+ * ```ts
389
+ * const [wall] = await snaptrude.design.query.listWalls()
390
+ * const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
391
+ * if (centerline) {
392
+ * const straight = await snaptrude.core.geom.query.curve.isLinear(centerline)
393
+ * }
394
+ * ```
395
+ */
396
+ public abstract isLinear(curve: CurveHandle): PluginApiReturn<boolean>
397
+
398
+ /**
399
+ * Test whether a point lies on a curve within an optional threshold.
400
+ * @param curve The curve to query
401
+ * @param point The point to test
402
+ * @param threshold Optional distance tolerance (defaults to the engine default)
403
+ * @returns `true` if the point is on the curve, otherwise `false`
404
+ *
405
+ * @examplePrompt Check whether this point lies on the wall edge
406
+ *
407
+ * # Example
408
+ * ```ts
409
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
410
+ * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
411
+ * const line = await snaptrude.core.geom.create.line(a, b)
412
+ * const point = await snaptrude.core.math.vec3.new(5, 0, 0.005)
413
+ * const on = await snaptrude.core.geom.query.curve.isOnCurve(line, point, 0.01) // true within tolerance
414
+ * ```
415
+ */
416
+ public abstract isOnCurve(
417
+ curve: CurveHandle,
418
+ point: Vec3Handle,
419
+ threshold?: number,
420
+ ): PluginApiReturn<boolean>
421
+
422
+ /**
423
+ * Test whether a curve contains a point, optionally including its endpoints.
424
+ * @param curve The curve to query
425
+ * @param point The point to test
426
+ * @param includeEndPoints Optional flag to count endpoints as contained (defaults to `true`)
427
+ * @returns `true` if the curve contains the point, otherwise `false`
428
+ *
429
+ * # Example
430
+ * ```ts
431
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
432
+ * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
433
+ * const line = await snaptrude.core.geom.create.line(a, b)
434
+ * const atEnd = await snaptrude.core.geom.query.curve.hasPoint(line, b) // true (endpoints count by default)
435
+ * const interiorOnly = await snaptrude.core.geom.query.curve.hasPoint(line, b, false) // false
436
+ * ```
437
+ */
438
+ public abstract hasPoint(
439
+ curve: CurveHandle,
440
+ point: Vec3Handle,
441
+ includeEndPoints?: boolean,
442
+ ): PluginApiReturn<boolean>
443
+
444
+ /**
445
+ * Test whether two curves are geometrically equal.
446
+ * @param curveA First curve
447
+ * @param curveB Second curve
448
+ * @returns `true` if the curves are equal, otherwise `false`
449
+ *
450
+ * # Example
451
+ * ```ts
452
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
453
+ * const b = await snaptrude.core.math.vec3.new(10, 0, 0)
454
+ * const lineA = await snaptrude.core.geom.create.line(a, b)
455
+ * const lineB = await snaptrude.core.geom.create.line(a, b)
456
+ * const same = await snaptrude.core.geom.query.curve.isEqual(lineA, lineB) // true
457
+ * ```
458
+ */
459
+ public abstract isEqual(
460
+ curveA: CurveHandle,
461
+ curveB: CurveHandle,
462
+ ): PluginApiReturn<boolean>
463
+
464
+ /**
465
+ * Test whether two curves overlap (share a collinear/concentric span), optionally including their endpoints.
466
+ * @param curveA First curve
467
+ * @param curveB Second curve
468
+ * @param includeEndPoints Optional flag to count endpoint contact as overlap (defaults to `false`)
469
+ * @returns `true` if the curves overlap, otherwise `false`
470
+ *
471
+ * @examplePrompt Do these two wall edges overlap?
472
+ *
473
+ * # Example
474
+ * ```ts
475
+ * const p0 = await snaptrude.core.math.vec3.new(0, 0, 0)
476
+ * const p5 = await snaptrude.core.math.vec3.new(5, 0, 0)
477
+ * const p10 = await snaptrude.core.math.vec3.new(10, 0, 0)
478
+ * const p15 = await snaptrude.core.math.vec3.new(15, 0, 0)
479
+ * const lineA = await snaptrude.core.geom.create.line(p0, p10)
480
+ * const lineB = await snaptrude.core.geom.create.line(p5, p15)
481
+ * const overlaps = await snaptrude.core.geom.query.curve.isOverlapping(lineA, lineB) // true (share the 5..10 span)
482
+ * ```
483
+ */
484
+ public abstract isOverlapping(
485
+ curveA: CurveHandle,
486
+ curveB: CurveHandle,
487
+ includeEndPoints?: boolean,
488
+ ): PluginApiReturn<boolean>
489
+
490
+ /**
491
+ * Get the common (overlapping) part of two curves.
492
+ * @param curveA First curve
493
+ * @param curveB Second curve
494
+ * @returns The common part as a {@linkcode CurveHandle}, or `null` if there is none
495
+ *
496
+ * @examplePrompt Get the shared segment where these two edges overlap
497
+ *
498
+ * # Example
499
+ * ```ts
500
+ * const p0 = await snaptrude.core.math.vec3.new(0, 0, 0)
501
+ * const p5 = await snaptrude.core.math.vec3.new(5, 0, 0)
502
+ * const p10 = await snaptrude.core.math.vec3.new(10, 0, 0)
503
+ * const p15 = await snaptrude.core.math.vec3.new(15, 0, 0)
504
+ * const lineA = await snaptrude.core.geom.create.line(p0, p10)
505
+ * const lineB = await snaptrude.core.geom.create.line(p5, p15)
506
+ * const common = await snaptrude.core.geom.query.curve.getCommonPart(lineA, lineB)
507
+ * if (common) {
508
+ * const length = await snaptrude.core.geom.query.curve.getLength(common) // 5
509
+ * }
510
+ * ```
511
+ */
512
+ public abstract getCommonPart(
513
+ curveA: CurveHandle,
514
+ curveB: CurveHandle,
515
+ ): PluginApiReturn<CurveHandle | null>
516
+
517
+ /**
518
+ * List the intersection points between two curves.
519
+ * @param curveA First curve
520
+ * @param curveB Second curve
521
+ * @param boundedA Optional flag to bound intersections to `curveA`'s extent (defaults to `true`)
522
+ * @param boundedB Optional flag to bound intersections to `curveB`'s extent (defaults to `true`)
523
+ * @returns The intersection points as {@linkcode Vec3Components}`[]`
524
+ *
525
+ * @examplePrompt Where do these two lines cross?
526
+ * @examplePrompt Find the intersection points of these two gridlines
527
+ *
528
+ * # Example
529
+ * ```ts
530
+ * const a1 = await snaptrude.core.math.vec3.new(0, 0, 0)
531
+ * const a2 = await snaptrude.core.math.vec3.new(10, 0, 0)
532
+ * const b1 = await snaptrude.core.math.vec3.new(5, 0, -5)
533
+ * const b2 = await snaptrude.core.math.vec3.new(5, 0, 5)
534
+ * const lineA = await snaptrude.core.geom.create.line(a1, a2)
535
+ * const lineB = await snaptrude.core.geom.create.line(b1, b2)
536
+ * const points = await snaptrude.core.geom.query.curve.listIntersections(lineA, lineB) // [{ x: 5, y: 0, z: 0 }]
537
+ * const unbounded = await snaptrude.core.geom.query.curve.listIntersections(lineA, lineB, false, false) // treat both as infinite
538
+ * ```
539
+ */
540
+ public abstract listIntersections(
541
+ curveA: CurveHandle,
542
+ curveB: CurveHandle,
543
+ boundedA?: boolean,
544
+ boundedB?: boolean,
545
+ ): PluginApiReturn<Vec3Components[]>
546
+
547
+ /**
548
+ * Merge two curves into a single curve when they are mergeable.
549
+ * @param curveA First curve
550
+ * @param curveB Second curve
551
+ * @returns The merged curve as a {@linkcode CurveHandle}, or `null` if they cannot be merged
552
+ *
553
+ * @examplePrompt Merge these two line segments into a single line
554
+ *
555
+ * # Example
556
+ * ```ts
557
+ * const p0 = await snaptrude.core.math.vec3.new(0, 0, 0)
558
+ * const p5 = await snaptrude.core.math.vec3.new(5, 0, 0)
559
+ * const p10 = await snaptrude.core.math.vec3.new(10, 0, 0)
560
+ * const lineA = await snaptrude.core.geom.create.line(p0, p5)
561
+ * const lineB = await snaptrude.core.geom.create.line(p5, p10)
562
+ * const merged = await snaptrude.core.geom.query.curve.getMergedCurve(lineA, lineB)
563
+ * if (merged) {
564
+ * const length = await snaptrude.core.geom.query.curve.getLength(merged) // 10
565
+ * }
566
+ * ```
567
+ */
568
+ public abstract getMergedCurve(
569
+ curveA: CurveHandle,
570
+ curveB: CurveHandle,
571
+ ): PluginApiReturn<CurveHandle | null>
572
+
573
+ /**
574
+ * Test whether two curves are continuous (share an endpoint without a gap).
575
+ * @param curveA First curve
576
+ * @param curveB Second curve
577
+ * @returns `true` if the curves are continuous, otherwise `false`
578
+ *
579
+ * @examplePrompt Do these two edges connect end to end without a gap?
580
+ *
581
+ * # Example
582
+ * ```ts
583
+ * const a = await snaptrude.core.math.vec3.new(0, 0, 0)
584
+ * const b = await snaptrude.core.math.vec3.new(5, 0, 0)
585
+ * const c = await snaptrude.core.math.vec3.new(5, 0, 5)
586
+ * const lineA = await snaptrude.core.geom.create.line(a, b)
587
+ * const lineB = await snaptrude.core.geom.create.line(b, c)
588
+ * const connected = await snaptrude.core.geom.query.curve.isContinuous(lineA, lineB) // true
589
+ * ```
590
+ */
591
+ public abstract isContinuous(
592
+ curveA: CurveHandle,
593
+ curveB: CurveHandle,
594
+ ): PluginApiReturn<boolean>
595
+
596
+ /**
597
+ * Test whether two lines are parallel within an optional tolerance.
598
+ * @param lineA First line
599
+ * @param lineB Second line
600
+ * @param tolerance Optional angular tolerance (defaults to the engine default)
601
+ * @returns `true` if the lines are parallel, otherwise `false`
602
+ *
603
+ * @examplePrompt Are these two walls parallel?
604
+ * @examplePrompt Check if these gridlines run parallel to each other
605
+ *
606
+ * # Example
607
+ * ```ts
608
+ * const a1 = await snaptrude.core.math.vec3.new(0, 0, 0)
609
+ * const a2 = await snaptrude.core.math.vec3.new(10, 0, 0)
610
+ * const b1 = await snaptrude.core.math.vec3.new(0, 0, 3)
611
+ * const b2 = await snaptrude.core.math.vec3.new(10, 0, 3)
612
+ * const lineA = await snaptrude.core.geom.create.line(a1, a2)
613
+ * const lineB = await snaptrude.core.geom.create.line(b1, b2)
614
+ * const parallel = await snaptrude.core.geom.query.curve.isParallel(lineA, lineB) // true
615
+ * ```
616
+ */
617
+ public abstract isParallel(
618
+ lineA: LineHandle,
619
+ lineB: LineHandle,
620
+ tolerance?: number,
621
+ ): PluginApiReturn<boolean>
622
+
623
+ /**
624
+ * Get the shortest gap between two curves, optionally including their endpoints.
625
+ * @param curveA First curve
626
+ * @param curveB Second curve
627
+ * @param includeEndPoints Optional flag to include endpoints when measuring (defaults to `false`)
628
+ * @returns The shortest gap as a `number`
629
+ *
630
+ * @examplePrompt What is the gap between these two wall edges?
631
+ * @examplePrompt How close do these two curves get to each other?
632
+ *
633
+ * # Example
634
+ * ```ts
635
+ * const a1 = await snaptrude.core.math.vec3.new(0, 0, 0)
636
+ * const a2 = await snaptrude.core.math.vec3.new(5, 0, 0)
637
+ * const b1 = await snaptrude.core.math.vec3.new(0, 0, 2)
638
+ * const b2 = await snaptrude.core.math.vec3.new(5, 0, 2)
639
+ * const curveA = await snaptrude.core.geom.create.line(a1, a2)
640
+ * const curveB = await snaptrude.core.geom.create.line(b1, b2)
641
+ * const gap = await snaptrude.core.geom.query.curve.getShortestGap(curveA, curveB) // 2
642
+ * ```
643
+ */
644
+ public abstract getShortestGap(
645
+ curveA: CurveHandle,
646
+ curveB: CurveHandle,
647
+ includeEndPoints?: boolean,
648
+ ): PluginApiReturn<number>
649
+
650
+ /**
651
+ * Get the perpendicular distance between two parallel lines.
652
+ * @param lineA First line
653
+ * @param lineB Second line
654
+ * @returns The distance between the lines as a `number`
655
+ *
656
+ * @examplePrompt How far apart are these two parallel walls?
657
+ * @examplePrompt Measure the spacing between these two gridlines
658
+ *
659
+ * # Example
660
+ * ```ts
661
+ * const a1 = await snaptrude.core.math.vec3.new(0, 0, 0)
662
+ * const a2 = await snaptrude.core.math.vec3.new(10, 0, 0)
663
+ * const b1 = await snaptrude.core.math.vec3.new(0, 0, 4)
664
+ * const b2 = await snaptrude.core.math.vec3.new(10, 0, 4)
665
+ * const lineA = await snaptrude.core.geom.create.line(a1, a2)
666
+ * const lineB = await snaptrude.core.geom.create.line(b1, b2)
667
+ * const spacing = await snaptrude.core.geom.query.curve.getDistanceBetween(lineA, lineB) // 4
668
+ * ```
669
+ */
670
+ public abstract getDistanceBetween(
671
+ lineA: LineHandle,
672
+ lineB: LineHandle,
673
+ ): PluginApiReturn<number>
674
+ }
675
+
676
+ /**
677
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getStartPoint}.
678
+ *
679
+ * | Property | Type | Description |
680
+ * |---|---|---|
681
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
682
+ */
683
+ export const PluginGeomQueryCurveGetStartPointArgs = z.object({
684
+ curve: CurveHandle,
685
+ })
686
+
687
+ export type PluginGeomQueryCurveGetStartPointArgs = z.infer<typeof PluginGeomQueryCurveGetStartPointArgs>
688
+
689
+ /**
690
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getEndPoint}.
691
+ *
692
+ * | Property | Type | Description |
693
+ * |---|---|---|
694
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
695
+ */
696
+ export const PluginGeomQueryCurveGetEndPointArgs = z.object({
697
+ curve: CurveHandle,
698
+ })
699
+
700
+ export type PluginGeomQueryCurveGetEndPointArgs = z.infer<typeof PluginGeomQueryCurveGetEndPointArgs>
701
+
702
+ /**
703
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getMidPoint}.
704
+ *
705
+ * | Property | Type | Description |
706
+ * |---|---|---|
707
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
708
+ */
709
+ export const PluginGeomQueryCurveGetMidPointArgs = z.object({
710
+ curve: CurveHandle,
711
+ })
712
+
713
+ export type PluginGeomQueryCurveGetMidPointArgs = z.infer<typeof PluginGeomQueryCurveGetMidPointArgs>
714
+
715
+ /**
716
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getLength}.
717
+ *
718
+ * | Property | Type | Description |
719
+ * |---|---|---|
720
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
721
+ */
722
+ export const PluginGeomQueryCurveGetLengthArgs = z.object({
723
+ curve: CurveHandle,
724
+ })
725
+
726
+ export type PluginGeomQueryCurveGetLengthArgs = z.infer<typeof PluginGeomQueryCurveGetLengthArgs>
727
+
728
+ /**
729
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getChordLength}.
730
+ *
731
+ * | Property | Type | Description |
732
+ * |---|---|---|
733
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
734
+ */
735
+ export const PluginGeomQueryCurveGetChordLengthArgs = z.object({
736
+ curve: CurveHandle,
737
+ })
738
+
739
+ export type PluginGeomQueryCurveGetChordLengthArgs = z.infer<typeof PluginGeomQueryCurveGetChordLengthArgs>
740
+
741
+ /**
742
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getTangent}.
743
+ *
744
+ * | Property | Type | Description |
745
+ * |---|---|---|
746
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
747
+ * | `point` | {@linkcode Vec3Handle} | Point on the curve |
748
+ */
749
+ export const PluginGeomQueryCurveGetTangentArgs = z.object({
750
+ curve: CurveHandle,
751
+ point: Vec3Handle,
752
+ })
753
+
754
+ export type PluginGeomQueryCurveGetTangentArgs = z.infer<typeof PluginGeomQueryCurveGetTangentArgs>
755
+
756
+ /**
757
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getNormal}.
758
+ *
759
+ * | Property | Type | Description |
760
+ * |---|---|---|
761
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
762
+ * | `point` | {@linkcode Vec3Handle} | Point on the curve |
763
+ */
764
+ export const PluginGeomQueryCurveGetNormalArgs = z.object({
765
+ curve: CurveHandle,
766
+ point: Vec3Handle,
767
+ })
768
+
769
+ export type PluginGeomQueryCurveGetNormalArgs = z.infer<typeof PluginGeomQueryCurveGetNormalArgs>
770
+
771
+ /**
772
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getNearestPoint}.
773
+ *
774
+ * | Property | Type | Description |
775
+ * |---|---|---|
776
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
777
+ * | `point` | {@linkcode Vec3Handle} | The reference point |
778
+ */
779
+ export const PluginGeomQueryCurveGetNearestPointArgs = z.object({
780
+ curve: CurveHandle,
781
+ point: Vec3Handle,
782
+ })
783
+
784
+ export type PluginGeomQueryCurveGetNearestPointArgs = z.infer<typeof PluginGeomQueryCurveGetNearestPointArgs>
785
+
786
+ /**
787
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getProjection}.
788
+ *
789
+ * | Property | Type | Description |
790
+ * |---|---|---|
791
+ * | `curve` | {@linkcode CurveHandle} | The curve to project onto |
792
+ * | `point` | {@linkcode Vec3Handle} | The point to project |
793
+ */
794
+ export const PluginGeomQueryCurveGetProjectionArgs = z.object({
795
+ curve: CurveHandle,
796
+ point: Vec3Handle,
797
+ })
798
+
799
+ export type PluginGeomQueryCurveGetProjectionArgs = z.infer<typeof PluginGeomQueryCurveGetProjectionArgs>
800
+
801
+ /**
802
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getPointAtDistance}.
803
+ *
804
+ * | Property | Type | Description |
805
+ * |---|---|---|
806
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
807
+ * | `referencePoint` | {@linkcode Vec3Handle} | Point on the curve to measure from |
808
+ * | `distance` | `number` | Distance along the curve from the reference point |
809
+ * | `forward` | `boolean` | Optional direction along the curve (defaults to `true`) |
810
+ */
811
+ export const PluginGeomQueryCurveGetPointAtDistanceArgs = z.object({
812
+ curve: CurveHandle,
813
+ referencePoint: Vec3Handle,
814
+ distance: z.number(),
815
+ forward: z.boolean().optional(),
816
+ })
817
+
818
+ export type PluginGeomQueryCurveGetPointAtDistanceArgs = z.infer<typeof PluginGeomQueryCurveGetPointAtDistanceArgs>
819
+
820
+ /**
821
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getParameterAtPoint}.
822
+ *
823
+ * | Property | Type | Description |
824
+ * |---|---|---|
825
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
826
+ * | `point` | {@linkcode Vec3Handle} | Point on the curve |
827
+ */
828
+ export const PluginGeomQueryCurveGetParameterAtPointArgs = z.object({
829
+ curve: CurveHandle,
830
+ point: Vec3Handle,
831
+ })
832
+
833
+ export type PluginGeomQueryCurveGetParameterAtPointArgs = z.infer<typeof PluginGeomQueryCurveGetParameterAtPointArgs>
834
+
835
+ /**
836
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getCurvature}.
837
+ *
838
+ * | Property | Type | Description |
839
+ * |---|---|---|
840
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
841
+ * | `point` | {@linkcode Vec3Handle} | Point on the curve |
842
+ */
843
+ export const PluginGeomQueryCurveGetCurvatureArgs = z.object({
844
+ curve: CurveHandle,
845
+ point: Vec3Handle,
846
+ })
847
+
848
+ export type PluginGeomQueryCurveGetCurvatureArgs = z.infer<typeof PluginGeomQueryCurveGetCurvatureArgs>
849
+
850
+ /**
851
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getDistanceToPoint}.
852
+ *
853
+ * | Property | Type | Description |
854
+ * |---|---|---|
855
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
856
+ * | `point` | {@linkcode Vec3Handle} | The point to measure from |
857
+ */
858
+ export const PluginGeomQueryCurveGetDistanceToPointArgs = z.object({
859
+ curve: CurveHandle,
860
+ point: Vec3Handle,
861
+ })
862
+
863
+ export type PluginGeomQueryCurveGetDistanceToPointArgs = z.infer<typeof PluginGeomQueryCurveGetDistanceToPointArgs>
864
+
865
+ /**
866
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getDistanceAlong}.
867
+ *
868
+ * | Property | Type | Description |
869
+ * |---|---|---|
870
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
871
+ * | `pointA` | {@linkcode Vec3Handle} | First point on the curve |
872
+ * | `pointB` | {@linkcode Vec3Handle} | Second point on the curve |
873
+ */
874
+ export const PluginGeomQueryCurveGetDistanceAlongArgs = z.object({
875
+ curve: CurveHandle,
876
+ pointA: Vec3Handle,
877
+ pointB: Vec3Handle,
878
+ })
879
+
880
+ export type PluginGeomQueryCurveGetDistanceAlongArgs = z.infer<typeof PluginGeomQueryCurveGetDistanceAlongArgs>
881
+
882
+ /**
883
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.listPoints}.
884
+ *
885
+ * | Property | Type | Description |
886
+ * |---|---|---|
887
+ * | `curve` | {@linkcode CurveHandle} | The curve to sample |
888
+ * | `resolution` | `number` | Optional number of samples for arcs (defaults to `20`; ignored for lines) |
889
+ */
890
+ export const PluginGeomQueryCurveListPointsArgs = z.object({
891
+ curve: CurveHandle,
892
+ resolution: z.number().optional(),
893
+ })
894
+
895
+ export type PluginGeomQueryCurveListPointsArgs = z.infer<typeof PluginGeomQueryCurveListPointsArgs>
896
+
897
+ /**
898
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.listSubdivisions}.
899
+ *
900
+ * | Property | Type | Description |
901
+ * |---|---|---|
902
+ * | `curve` | {@linkcode CurveHandle} | The curve to subdivide |
903
+ * | `segments` | `number` | Number of equal segments to divide the curve into |
904
+ */
905
+ export const PluginGeomQueryCurveListSubdivisionsArgs = z.object({
906
+ curve: CurveHandle,
907
+ segments: z.number(),
908
+ })
909
+
910
+ export type PluginGeomQueryCurveListSubdivisionsArgs = z.infer<typeof PluginGeomQueryCurveListSubdivisionsArgs>
911
+
912
+ /**
913
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.isLinear}.
914
+ *
915
+ * | Property | Type | Description |
916
+ * |---|---|---|
917
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
918
+ */
919
+ export const PluginGeomQueryCurveIsLinearArgs = z.object({
920
+ curve: CurveHandle,
921
+ })
922
+
923
+ export type PluginGeomQueryCurveIsLinearArgs = z.infer<typeof PluginGeomQueryCurveIsLinearArgs>
924
+
925
+ /**
926
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.isOnCurve}.
927
+ *
928
+ * | Property | Type | Description |
929
+ * |---|---|---|
930
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
931
+ * | `point` | {@linkcode Vec3Handle} | The point to test |
932
+ * | `threshold` | `number` | Optional distance tolerance (defaults to the engine default) |
933
+ */
934
+ export const PluginGeomQueryCurveIsOnCurveArgs = z.object({
935
+ curve: CurveHandle,
936
+ point: Vec3Handle,
937
+ threshold: z.number().optional(),
938
+ })
939
+
940
+ export type PluginGeomQueryCurveIsOnCurveArgs = z.infer<typeof PluginGeomQueryCurveIsOnCurveArgs>
941
+
942
+ /**
943
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.hasPoint}.
944
+ *
945
+ * | Property | Type | Description |
946
+ * |---|---|---|
947
+ * | `curve` | {@linkcode CurveHandle} | The curve to query |
948
+ * | `point` | {@linkcode Vec3Handle} | The point to test |
949
+ * | `includeEndPoints` | `boolean` | Optional flag to count endpoints as contained (defaults to `true`) |
950
+ */
951
+ export const PluginGeomQueryCurveHasPointArgs = z.object({
952
+ curve: CurveHandle,
953
+ point: Vec3Handle,
954
+ includeEndPoints: z.boolean().optional(),
955
+ })
956
+
957
+ export type PluginGeomQueryCurveHasPointArgs = z.infer<typeof PluginGeomQueryCurveHasPointArgs>
958
+
959
+ /**
960
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.isEqual}.
961
+ *
962
+ * | Property | Type | Description |
963
+ * |---|---|---|
964
+ * | `curveA` | {@linkcode CurveHandle} | First curve |
965
+ * | `curveB` | {@linkcode CurveHandle} | Second curve |
966
+ */
967
+ export const PluginGeomQueryCurveIsEqualArgs = z.object({
968
+ curveA: CurveHandle,
969
+ curveB: CurveHandle,
970
+ })
971
+
972
+ export type PluginGeomQueryCurveIsEqualArgs = z.infer<typeof PluginGeomQueryCurveIsEqualArgs>
973
+
974
+ /**
975
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.isOverlapping}.
976
+ *
977
+ * | Property | Type | Description |
978
+ * |---|---|---|
979
+ * | `curveA` | {@linkcode CurveHandle} | First curve |
980
+ * | `curveB` | {@linkcode CurveHandle} | Second curve |
981
+ * | `includeEndPoints` | `boolean` | Optional flag to count endpoint contact as overlap (defaults to `false`) |
982
+ */
983
+ export const PluginGeomQueryCurveIsOverlappingArgs = z.object({
984
+ curveA: CurveHandle,
985
+ curveB: CurveHandle,
986
+ includeEndPoints: z.boolean().optional(),
987
+ })
988
+
989
+ export type PluginGeomQueryCurveIsOverlappingArgs = z.infer<typeof PluginGeomQueryCurveIsOverlappingArgs>
990
+
991
+ /**
992
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getCommonPart}.
993
+ *
994
+ * | Property | Type | Description |
995
+ * |---|---|---|
996
+ * | `curveA` | {@linkcode CurveHandle} | First curve |
997
+ * | `curveB` | {@linkcode CurveHandle} | Second curve |
998
+ */
999
+ export const PluginGeomQueryCurveGetCommonPartArgs = z.object({
1000
+ curveA: CurveHandle,
1001
+ curveB: CurveHandle,
1002
+ })
1003
+
1004
+ export type PluginGeomQueryCurveGetCommonPartArgs = z.infer<typeof PluginGeomQueryCurveGetCommonPartArgs>
1005
+
1006
+ /**
1007
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.listIntersections}.
1008
+ *
1009
+ * | Property | Type | Description |
1010
+ * |---|---|---|
1011
+ * | `curveA` | {@linkcode CurveHandle} | First curve |
1012
+ * | `curveB` | {@linkcode CurveHandle} | Second curve |
1013
+ * | `boundedA` | `boolean` | Optional flag to bound intersections to `curveA`'s extent (defaults to `true`) |
1014
+ * | `boundedB` | `boolean` | Optional flag to bound intersections to `curveB`'s extent (defaults to `true`) |
1015
+ */
1016
+ export const PluginGeomQueryCurveListIntersectionsArgs = z.object({
1017
+ curveA: CurveHandle,
1018
+ curveB: CurveHandle,
1019
+ boundedA: z.boolean().optional(),
1020
+ boundedB: z.boolean().optional(),
1021
+ })
1022
+
1023
+ export type PluginGeomQueryCurveListIntersectionsArgs = z.infer<typeof PluginGeomQueryCurveListIntersectionsArgs>
1024
+
1025
+ /**
1026
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getMergedCurve}.
1027
+ *
1028
+ * | Property | Type | Description |
1029
+ * |---|---|---|
1030
+ * | `curveA` | {@linkcode CurveHandle} | First curve |
1031
+ * | `curveB` | {@linkcode CurveHandle} | Second curve |
1032
+ */
1033
+ export const PluginGeomQueryCurveGetMergedCurveArgs = z.object({
1034
+ curveA: CurveHandle,
1035
+ curveB: CurveHandle,
1036
+ })
1037
+
1038
+ export type PluginGeomQueryCurveGetMergedCurveArgs = z.infer<typeof PluginGeomQueryCurveGetMergedCurveArgs>
1039
+
1040
+ /**
1041
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.isContinuous}.
1042
+ *
1043
+ * | Property | Type | Description |
1044
+ * |---|---|---|
1045
+ * | `curveA` | {@linkcode CurveHandle} | First curve |
1046
+ * | `curveB` | {@linkcode CurveHandle} | Second curve |
1047
+ */
1048
+ export const PluginGeomQueryCurveIsContinuousArgs = z.object({
1049
+ curveA: CurveHandle,
1050
+ curveB: CurveHandle,
1051
+ })
1052
+
1053
+ export type PluginGeomQueryCurveIsContinuousArgs = z.infer<typeof PluginGeomQueryCurveIsContinuousArgs>
1054
+
1055
+ /**
1056
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.isParallel}.
1057
+ *
1058
+ * | Property | Type | Description |
1059
+ * |---|---|---|
1060
+ * | `lineA` | {@linkcode LineHandle} | First line |
1061
+ * | `lineB` | {@linkcode LineHandle} | Second line |
1062
+ * | `tolerance` | `number` | Optional angular tolerance (defaults to the engine default) |
1063
+ */
1064
+ export const PluginGeomQueryCurveIsParallelArgs = z.object({
1065
+ lineA: LineHandle,
1066
+ lineB: LineHandle,
1067
+ tolerance: z.number().optional(),
1068
+ })
1069
+
1070
+ export type PluginGeomQueryCurveIsParallelArgs = z.infer<typeof PluginGeomQueryCurveIsParallelArgs>
1071
+
1072
+ /**
1073
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getShortestGap}.
1074
+ *
1075
+ * | Property | Type | Description |
1076
+ * |---|---|---|
1077
+ * | `curveA` | {@linkcode CurveHandle} | First curve |
1078
+ * | `curveB` | {@linkcode CurveHandle} | Second curve |
1079
+ * | `includeEndPoints` | `boolean` | Optional flag to include endpoints when measuring (defaults to `false`) |
1080
+ */
1081
+ export const PluginGeomQueryCurveGetShortestGapArgs = z.object({
1082
+ curveA: CurveHandle,
1083
+ curveB: CurveHandle,
1084
+ includeEndPoints: z.boolean().optional(),
1085
+ })
1086
+
1087
+ export type PluginGeomQueryCurveGetShortestGapArgs = z.infer<typeof PluginGeomQueryCurveGetShortestGapArgs>
1088
+
1089
+ /**
1090
+ * Arguments for {@linkcode PluginGeomQueryCurveApi.getDistanceBetween}.
1091
+ *
1092
+ * | Property | Type | Description |
1093
+ * |---|---|---|
1094
+ * | `lineA` | {@linkcode LineHandle} | First line |
1095
+ * | `lineB` | {@linkcode LineHandle} | Second line |
1096
+ */
1097
+ export const PluginGeomQueryCurveGetDistanceBetweenArgs = z.object({
1098
+ lineA: LineHandle,
1099
+ lineB: LineHandle,
1100
+ })
1101
+
1102
+ export type PluginGeomQueryCurveGetDistanceBetweenArgs = z.infer<typeof PluginGeomQueryCurveGetDistanceBetweenArgs>