@snaptrude/plugin-core 0.2.2 → 0.2.4

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 (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.cjs +17 -2
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +15 -2
  5. package/dist/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/api/entity/space.ts +120 -12
  8. package/dist/api/core/geom/arc.d.ts +0 -81
  9. package/dist/api/core/geom/arc.d.ts.map +0 -1
  10. package/dist/api/core/geom/curve.d.ts +0 -70
  11. package/dist/api/core/geom/curve.d.ts.map +0 -1
  12. package/dist/api/core/geom/index.d.ts +0 -32
  13. package/dist/api/core/geom/index.d.ts.map +0 -1
  14. package/dist/api/core/geom/line.d.ts +0 -56
  15. package/dist/api/core/geom/line.d.ts.map +0 -1
  16. package/dist/api/core/geom/profile.d.ts +0 -121
  17. package/dist/api/core/geom/profile.d.ts.map +0 -1
  18. package/dist/api/core/index.d.ts +0 -18
  19. package/dist/api/core/index.d.ts.map +0 -1
  20. package/dist/api/core/math/index.d.ts +0 -18
  21. package/dist/api/core/math/index.d.ts.map +0 -1
  22. package/dist/api/core/math/quat.d.ts +0 -187
  23. package/dist/api/core/math/quat.d.ts.map +0 -1
  24. package/dist/api/core/math/vec3.d.ts +0 -156
  25. package/dist/api/core/math/vec3.d.ts.map +0 -1
  26. package/dist/api/entity/buildableEnvelope.d.ts +0 -233
  27. package/dist/api/entity/buildableEnvelope.d.ts.map +0 -1
  28. package/dist/api/entity/department.d.ts +0 -99
  29. package/dist/api/entity/department.d.ts.map +0 -1
  30. package/dist/api/entity/index.d.ts +0 -33
  31. package/dist/api/entity/index.d.ts.map +0 -1
  32. package/dist/api/entity/referenceLine.d.ts +0 -259
  33. package/dist/api/entity/referenceLine.d.ts.map +0 -1
  34. package/dist/api/entity/space.d.ts +0 -613
  35. package/dist/api/entity/space.d.ts.map +0 -1
  36. package/dist/api/entity/story.d.ts +0 -239
  37. package/dist/api/entity/story.d.ts.map +0 -1
  38. package/dist/api/index.d.ts +0 -30
  39. package/dist/api/index.d.ts.map +0 -1
  40. package/dist/api/tools/copy.d.ts +0 -59
  41. package/dist/api/tools/copy.d.ts.map +0 -1
  42. package/dist/api/tools/index.d.ts +0 -29
  43. package/dist/api/tools/index.d.ts.map +0 -1
  44. package/dist/api/tools/offset.d.ts +0 -43
  45. package/dist/api/tools/offset.d.ts.map +0 -1
  46. package/dist/api/tools/selection.d.ts +0 -48
  47. package/dist/api/tools/selection.d.ts.map +0 -1
  48. package/dist/api/tools/transform.d.ts +0 -114
  49. package/dist/api/tools/transform.d.ts.map +0 -1
  50. package/dist/api/units/index.d.ts +0 -163
  51. package/dist/api/units/index.d.ts.map +0 -1
  52. package/dist/host-utils.d.ts +0 -41
  53. package/dist/host-utils.d.ts.map +0 -1
  54. package/dist/index.d.ts +0 -4
  55. package/dist/index.d.ts.map +0 -1
  56. package/dist/types.d.ts +0 -16
  57. package/dist/types.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snaptrude/plugin-core",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -5,7 +5,7 @@ import { PQuat } from "../core/math/quat"
5
5
  import { PProfile } from "../core/geom/profile"
6
6
 
7
7
  /**
8
- * Space (room/mass) management — create, query, and delete spaces.
8
+ * Space (room/mass) management — create, query, update, and delete spaces.
9
9
  *
10
10
  * A **space** is a 3D volume representing a room or mass in the
11
11
  * Snaptrude scene. Spaces live on a particular story and carry
@@ -53,18 +53,22 @@ export abstract class PluginSpaceApi {
53
53
  /**
54
54
  * Create a space by extruding a 2D profile.
55
55
  *
56
- * The {@linkcode PluginSpaceCreateFromProfileArgs.profile profile} is extruded
57
- * upward (along the Y axis) by {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight
58
- * extrudeHeight}, then offset by {@linkcode PluginSpaceCreateFromProfileArgs.position
59
- * position}. The created space is automatically assigned to the active story
60
- * and a default department.
56
+ * The {@linkcode PluginSpaceCreateFromProfileArgs.profile profile} is used as
57
+ * the outer boundary and extruded upward (along the Y axis) by
58
+ * {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight extrudeHeight},
59
+ * then offset by {@linkcode PluginSpaceCreateFromProfileArgs.position
60
+ * position}. Optional {@linkcode PluginSpaceCreateFromProfileArgs.innerProfiles
61
+ * innerProfiles} are used as holes inside the outer boundary. The created
62
+ * space is automatically assigned to the active story and a default department.
61
63
  *
62
64
  * Use {@linkcode PluginProfileApi.fromLinePoints} to quickly build a profile
63
65
  * from a list of points.
64
66
  *
65
67
  * @param args - An object containing:
66
68
  * - {@linkcode PluginSpaceCreateFromProfileArgs.profile args.profile} — A closed
67
- * {@linkcode PProfile} defining the floor shape
69
+ * {@linkcode PProfile} defining the outer floor shape
70
+ * - {@linkcode PluginSpaceCreateFromProfileArgs.innerProfiles args.innerProfiles} —
71
+ * Optional closed {@linkcode PProfile}`[]` loops to subtract as holes
68
72
  * - {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight args.extrudeHeight} —
69
73
  * Extrusion height in Babylon units
70
74
  * - {@linkcode PluginSpaceCreateFromProfileArgs.position args.position} — Offset
@@ -77,7 +81,7 @@ export abstract class PluginSpaceApi {
77
81
  * ```ts
78
82
  * const { vec3 } = snaptrude.core.math
79
83
  *
80
- * const profile = await snaptrude.core.geom.profile.fromLinePoints({
84
+ * const outerProfile = await snaptrude.core.geom.profile.fromLinePoints({
81
85
  * points: [
82
86
  * vec3.new(0, 0, 0),
83
87
  * vec3.new(10, 0, 0),
@@ -85,9 +89,18 @@ export abstract class PluginSpaceApi {
85
89
  * vec3.new(0, 0, 8),
86
90
  * ],
87
91
  * })
92
+ * const holeProfile = await snaptrude.core.geom.profile.fromLinePoints({
93
+ * points: [
94
+ * vec3.new(3, 0, 3),
95
+ * vec3.new(7, 0, 3),
96
+ * vec3.new(7, 0, 5),
97
+ * vec3.new(3, 0, 5),
98
+ * ],
99
+ * })
88
100
  *
89
101
  * const { spaceId } = await snaptrude.entity.space.createFromProfile({
90
- * profile,
102
+ * profile: outerProfile,
103
+ * innerProfiles: [holeProfile],
91
104
  * extrudeHeight: 3,
92
105
  * position: vec3.new(0, 0, 0),
93
106
  * })
@@ -95,10 +108,66 @@ export abstract class PluginSpaceApi {
95
108
  */
96
109
  public abstract createFromProfile({
97
110
  profile,
111
+ innerProfiles,
98
112
  extrudeHeight,
99
113
  position,
100
114
  }: PluginSpaceCreateFromProfileArgs): PluginApiReturn<PluginSpaceCreateFromProfileResult>
101
115
 
116
+ /**
117
+ * Update a space's BRep and mesh geometry by extruding a 2D profile.
118
+ *
119
+ * The {@linkcode PluginSpaceUpdateGeometryFromProfileArgs.profile profile} is
120
+ * extruded upward (along the Y axis) by
121
+ * {@linkcode PluginSpaceUpdateGeometryFromProfileArgs.extrudeHeight extrudeHeight}
122
+ * and applied to the existing space. The space keeps the same `spaceId`,
123
+ * metadata, department, and transform; only its geometry is replaced.
124
+ *
125
+ * Profile points are interpreted in scene coordinates. Profiles returned by
126
+ * {@linkcode PluginSpaceApi.get} with `"profile"` can be passed back directly;
127
+ * `"planPoints"` can be used to construct line-only profiles in the same X/Z
128
+ * plan coordinate space.
129
+ *
130
+ * Use {@linkcode PluginProfileApi.fromLinePoints} to quickly build a profile
131
+ * from a list of points.
132
+ *
133
+ * @param args - An object containing:
134
+ * - {@linkcode PluginSpaceUpdateGeometryFromProfileArgs.spaceId args.spaceId} —
135
+ * The unique space ID to update
136
+ * - {@linkcode PluginSpaceUpdateGeometryFromProfileArgs.profile args.profile} —
137
+ * A closed {@linkcode PProfile} defining the new floor shape
138
+ * - {@linkcode PluginSpaceUpdateGeometryFromProfileArgs.extrudeHeight
139
+ * args.extrudeHeight} — New extrusion height in Babylon units
140
+ * @returns A {@linkcode PluginSpaceUpdateGeometryFromProfileResult} with the
141
+ * `spaceId` of the updated space
142
+ * @throws If the space does not exist, the component is not a space/mass, the
143
+ * height is not positive, or the profile cannot create valid geometry
144
+ *
145
+ * # Example
146
+ * ```ts
147
+ * const { vec3 } = snaptrude.core.math
148
+ *
149
+ * const profile = await snaptrude.core.geom.profile.fromLinePoints({
150
+ * points: [
151
+ * vec3.new(0, 0, 0),
152
+ * vec3.new(12, 0, 0),
153
+ * vec3.new(12, 0, 6),
154
+ * vec3.new(0, 0, 6),
155
+ * ],
156
+ * })
157
+ *
158
+ * const { spaceId } = await snaptrude.entity.space.updateGeometryFromProfile({
159
+ * spaceId: "some-space-id",
160
+ * profile,
161
+ * extrudeHeight: 4,
162
+ * })
163
+ * ```
164
+ */
165
+ public abstract updateGeometryFromProfile({
166
+ spaceId,
167
+ profile,
168
+ extrudeHeight,
169
+ }: PluginSpaceUpdateGeometryFromProfileArgs): PluginApiReturn<PluginSpaceUpdateGeometryFromProfileResult>
170
+
102
171
  /**
103
172
  * Get the IDs of all spaces in the current project.
104
173
  *
@@ -195,7 +264,7 @@ export abstract class PluginSpaceApi {
195
264
  * ```
196
265
  */
197
266
  public abstract update(
198
- args: PluginSpaceUpdateArgs
267
+ args: PluginSpaceUpdateArgs,
199
268
  ): PluginApiReturn<PluginSpaceUpdateResult>
200
269
  }
201
270
 
@@ -240,12 +309,14 @@ export type PluginSpaceCreateRectangularResult = z.infer<
240
309
  *
241
310
  * | Property | Type | Description |
242
311
  * |---|---|---|
243
- * | `profile` | {@linkcode PProfile} | Closed 2D profile defining the floor shape |
312
+ * | `profile` | {@linkcode PProfile} | Closed 2D profile defining the outer floor shape |
313
+ * | `innerProfiles` | {@linkcode PProfile}`[]` | Optional closed profiles to subtract as holes |
244
314
  * | `extrudeHeight` | `number` | Extrusion height in Babylon units |
245
315
  * | `position` | {@linkcode PVec3} | Offset position in Babylon units |
246
316
  */
247
317
  export const PluginSpaceCreateFromProfileArgs = z.object({
248
318
  profile: PProfile,
319
+ innerProfiles: z.array(PProfile).optional(),
249
320
  extrudeHeight: z.number(),
250
321
  position: PVec3,
251
322
  })
@@ -269,6 +340,40 @@ export type PluginSpaceCreateFromProfileResult = z.infer<
269
340
  typeof PluginSpaceCreateFromProfileResult
270
341
  >
271
342
 
343
+ /**
344
+ * Arguments for {@linkcode PluginSpaceApi.updateGeometryFromProfile}.
345
+ *
346
+ * | Property | Type | Description |
347
+ * |---|---|---|
348
+ * | `spaceId` | `string` | Space to update |
349
+ * | `profile` | {@linkcode PProfile} | Closed 2D profile defining the new floor shape |
350
+ * | `extrudeHeight` | `number` | New extrusion height in Babylon units |
351
+ */
352
+ export const PluginSpaceUpdateGeometryFromProfileArgs = z.object({
353
+ spaceId: z.string(),
354
+ profile: PProfile,
355
+ extrudeHeight: z.number(),
356
+ })
357
+
358
+ export type PluginSpaceUpdateGeometryFromProfileArgs = z.infer<
359
+ typeof PluginSpaceUpdateGeometryFromProfileArgs
360
+ >
361
+
362
+ /**
363
+ * Result of {@linkcode PluginSpaceApi.updateGeometryFromProfile}.
364
+ *
365
+ * | Property | Type | Description |
366
+ * |---|---|---|
367
+ * | `spaceId` | `string` | Unique ID of the updated space |
368
+ */
369
+ export const PluginSpaceUpdateGeometryFromProfileResult = z.object({
370
+ spaceId: z.string(),
371
+ })
372
+
373
+ export type PluginSpaceUpdateGeometryFromProfileResult = z.infer<
374
+ typeof PluginSpaceUpdateGeometryFromProfileResult
375
+ >
376
+
272
377
  /**
273
378
  * Available properties that can be queried on a space.
274
379
  *
@@ -306,6 +411,7 @@ export type PluginSpaceCreateFromProfileResult = z.infer<
306
411
  * | Value | Return Type | Description |
307
412
  * |---|---|---|
308
413
  * | `"planPoints"` | {@linkcode PVec3}`[]` | Bottom outer profile points in world space with `y = 0` (2D plan). No closing duplicate point. |
414
+ * | `"profile"` | {@linkcode PProfile} | Bottom outer profile in world space, preserving line/arc curve data. |
309
415
  */
310
416
  export const PluginSpaceGetProperty = z.enum([
311
417
  // Basic
@@ -331,6 +437,7 @@ export const PluginSpaceGetProperty = z.enum([
331
437
  "rotationQuaternion",
332
438
  // Derived from brep
333
439
  "planPoints",
440
+ "profile",
334
441
  ])
335
442
 
336
443
  /**
@@ -376,7 +483,7 @@ export const PluginSpaceType = z.enum([
376
483
  "Pool",
377
484
  "Walkway",
378
485
  "Envelope",
379
- "Parking"
486
+ "Parking",
380
487
  ])
381
488
 
382
489
  /**
@@ -410,6 +517,7 @@ export const PluginSpaceGetResult = z
410
517
  rotationQuaternion: PQuat.nullable(),
411
518
  // Derived from brep
412
519
  planPoints: z.array(PVec3),
520
+ profile: PProfile,
413
521
  })
414
522
  .partial()
415
523
 
@@ -1,81 +0,0 @@
1
- import * as z from "zod";
2
- import { PVec3 } from "../math/vec3";
3
- /**
4
- * Arc construction.
5
- *
6
- * A {@linkcode PArc} represents a circular arc in 3D space, defined by
7
- * start/end points, a centre, and a rotation axis. Arcs can be wrapped
8
- * as a {@linkcode PCurve} and combined into a {@linkcode PProfile}.
9
- *
10
- * Accessed via `snaptrude.core.geom.arc`.
11
- */
12
- export declare abstract class PluginArcApi {
13
- constructor();
14
- /**
15
- * Create a new arc from start, end, centre, and axis.
16
- *
17
- * The arc sweeps from {@linkcode startPoint} to {@linkcode endPoint}
18
- * along the circle centred at {@linkcode centrePoint}, in the
19
- * direction determined by the right-hand rule around {@linkcode axis}.
20
- *
21
- * @param startPoint - The start point as a {@linkcode PVec3}
22
- * @param endPoint - The end point as a {@linkcode PVec3}
23
- * @param centrePoint - The centre of the arc's circle as a {@linkcode PVec3}
24
- * @param axis - The arc's rotation axis as a {@linkcode PVec3}
25
- * (perpendicular to the arc's plane)
26
- * @returns A new {@linkcode PArc}
27
- *
28
- * # Example
29
- * ```ts
30
- * const { vec3 } = snaptrude.core.math
31
- * const { arc } = snaptrude.core.geom
32
- *
33
- * // Quarter-circle arc on the XZ plane
34
- * const a = arc.new(
35
- * vec3.new(1, 0, 0), // start
36
- * vec3.new(0, 0, 1), // end
37
- * vec3.new(0, 0, 0), // centre
38
- * vec3.new(0, 1, 0), // Y-up axis
39
- * )
40
- * ```
41
- */
42
- new(startPoint: PVec3, endPoint: PVec3, centrePoint: PVec3, axis: PVec3): PArc;
43
- }
44
- /**
45
- * A circular arc defined by start, end, centre, and axis.
46
- *
47
- * Discriminated by `curveType: "Arc"` within the {@linkcode PCurve} union.
48
- *
49
- * | Property | Type | Description |
50
- * |---|---|---|
51
- * | `curveType` | `"Arc"` | Discriminator tag |
52
- * | `startPoint` | {@linkcode PVec3} | Start point of the arc |
53
- * | `endPoint` | {@linkcode PVec3} | End point of the arc |
54
- * | `centrePoint` | {@linkcode PVec3} | Centre of the arc's circle |
55
- * | `axis` | {@linkcode PVec3} | Rotation axis (normal to the arc's plane) |
56
- */
57
- export declare const PArc: z.ZodObject<{
58
- curveType: z.ZodLiteral<"Arc">;
59
- startPoint: z.ZodObject<{
60
- x: z.ZodNumber;
61
- y: z.ZodNumber;
62
- z: z.ZodNumber;
63
- }, z.core.$strip>;
64
- endPoint: z.ZodObject<{
65
- x: z.ZodNumber;
66
- y: z.ZodNumber;
67
- z: z.ZodNumber;
68
- }, z.core.$strip>;
69
- centrePoint: z.ZodObject<{
70
- x: z.ZodNumber;
71
- y: z.ZodNumber;
72
- z: z.ZodNumber;
73
- }, z.core.$strip>;
74
- axis: z.ZodObject<{
75
- x: z.ZodNumber;
76
- y: z.ZodNumber;
77
- z: z.ZodNumber;
78
- }, z.core.$strip>;
79
- }, z.core.$strip>;
80
- export type PArc = z.infer<typeof PArc>;
81
- //# sourceMappingURL=arc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/arc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEpC;;;;;;;;GAQG;AACH,8BAAsB,YAAY;;IAGhC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;CAG/E;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;iBAMf,CAAA;AAEF,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA"}
@@ -1,70 +0,0 @@
1
- import * as z from "zod";
2
- import { PLine } from "./line";
3
- import { PArc } from "./arc";
4
- /**
5
- * Unified curve wrapper — either a {@linkcode PLine} or a {@linkcode PArc}.
6
- *
7
- * Use this to build heterogeneous curve lists (mixing lines and arcs)
8
- * when constructing a {@linkcode PProfile}.
9
- *
10
- * Accessed via `snaptrude.core.geom.curve`.
11
- */
12
- export declare abstract class PluginCurveApi {
13
- constructor();
14
- /**
15
- * Wrap a {@linkcode PLine} or {@linkcode PArc} as a {@linkcode PCurve}.
16
- *
17
- * This is an identity operation — it simply returns the input unchanged.
18
- * It exists for type-level clarity when building mixed curve lists.
19
- *
20
- * @param curve - A {@linkcode PLine} or {@linkcode PArc} to wrap
21
- * @returns The same value typed as {@linkcode PCurve}
22
- */
23
- new(curve: PLine | PArc): PCurve;
24
- }
25
- /**
26
- * A discriminated union of {@linkcode PLine} and {@linkcode PArc}.
27
- *
28
- * Discriminated on the `curveType` field:
29
- * - `"Line"` → {@linkcode PLine}
30
- * - `"Arc"` → {@linkcode PArc}
31
- *
32
- * Use `curve.curveType` to narrow the type in a switch or if-statement.
33
- */
34
- export declare const PCurve: z.ZodDiscriminatedUnion<[z.ZodObject<{
35
- curveType: z.ZodLiteral<"Line">;
36
- startPoint: z.ZodObject<{
37
- x: z.ZodNumber;
38
- y: z.ZodNumber;
39
- z: z.ZodNumber;
40
- }, z.core.$strip>;
41
- endPoint: z.ZodObject<{
42
- x: z.ZodNumber;
43
- y: z.ZodNumber;
44
- z: z.ZodNumber;
45
- }, z.core.$strip>;
46
- }, z.core.$strip>, z.ZodObject<{
47
- curveType: z.ZodLiteral<"Arc">;
48
- startPoint: z.ZodObject<{
49
- x: z.ZodNumber;
50
- y: z.ZodNumber;
51
- z: z.ZodNumber;
52
- }, z.core.$strip>;
53
- endPoint: z.ZodObject<{
54
- x: z.ZodNumber;
55
- y: z.ZodNumber;
56
- z: z.ZodNumber;
57
- }, z.core.$strip>;
58
- centrePoint: z.ZodObject<{
59
- x: z.ZodNumber;
60
- y: z.ZodNumber;
61
- z: z.ZodNumber;
62
- }, z.core.$strip>;
63
- axis: z.ZodObject<{
64
- x: z.ZodNumber;
65
- y: z.ZodNumber;
66
- z: z.ZodNumber;
67
- }, z.core.$strip>;
68
- }, z.core.$strip>], "curveType">;
69
- export type PCurve = z.infer<typeof PCurve>;
70
- //# sourceMappingURL=curve.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"curve.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/curve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAE5B;;;;;;;GAOG;AACH,8BAAsB,cAAc;;IAGlC;;;;;;;;OAQG;IACH,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,MAAM;CAGjC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAmD,CAAA;AAEtE,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAA"}
@@ -1,32 +0,0 @@
1
- import { PluginLineApi } from "./line";
2
- import { PluginArcApi } from "./arc";
3
- import { PluginCurveApi } from "./curve";
4
- import { PluginProfileApi } from "./profile";
5
- /**
6
- * Geometry primitives for constructing 2D/3D shapes.
7
- *
8
- * Build geometry bottom-up: points ({@linkcode PVec3}) → lines/arcs → curves → profiles.
9
- * Profiles can then be used with entity creation methods like
10
- * {@linkcode PluginSpaceApi.createFromProfile}.
11
- *
12
- * - {@linkcode PluginGeomApi.line} — Line segment construction
13
- * - {@linkcode PluginGeomApi.arc} — Arc construction
14
- * - {@linkcode PluginGeomApi.curve} — Unified curve wrapper (line or arc)
15
- * - {@linkcode PluginGeomApi.profile} — Closed loop of curves
16
- */
17
- export declare abstract class PluginGeomApi {
18
- /** Line segment construction. See {@linkcode PluginLineApi}. */
19
- abstract line: PluginLineApi;
20
- /** Arc construction. See {@linkcode PluginArcApi}. */
21
- abstract arc: PluginArcApi;
22
- /** Unified curve wrapper. See {@linkcode PluginCurveApi}. */
23
- abstract curve: PluginCurveApi;
24
- /** Closed profile (loop of curves). See {@linkcode PluginProfileApi}. */
25
- abstract profile: PluginProfileApi;
26
- constructor();
27
- }
28
- export * from "./line";
29
- export * from "./arc";
30
- export * from "./curve";
31
- export * from "./profile";
32
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAE5C;;;;;;;;;;;GAWG;AACH,8BAAsB,aAAa;IACjC,gEAAgE;IAChE,SAAgB,IAAI,EAAE,aAAa,CAAA;IACnC,sDAAsD;IACtD,SAAgB,GAAG,EAAE,YAAY,CAAA;IACjC,6DAA6D;IAC7D,SAAgB,KAAK,EAAE,cAAc,CAAA;IACrC,yEAAyE;IACzE,SAAgB,OAAO,EAAE,gBAAgB,CAAA;;CAG1C;AAED,cAAc,QAAQ,CAAA;AACtB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA"}
@@ -1,56 +0,0 @@
1
- import * as z from "zod";
2
- import { PVec3 } from "../math/vec3";
3
- /**
4
- * Line segment construction.
5
- *
6
- * A {@linkcode PLine} is the simplest curve primitive — a straight
7
- * segment between two 3D points. Lines can be wrapped as a
8
- * {@linkcode PCurve} and combined into a {@linkcode PProfile}.
9
- *
10
- * Accessed via `snaptrude.core.geom.line`.
11
- */
12
- export declare abstract class PluginLineApi {
13
- constructor();
14
- /**
15
- * Create a new line segment between two points.
16
- *
17
- * @param startPoint - The start point as a {@linkcode PVec3}
18
- * @param endPoint - The end point as a {@linkcode PVec3}
19
- * @returns A new {@linkcode PLine}
20
- *
21
- * # Example
22
- * ```ts
23
- * const { vec3 } = snaptrude.core.math
24
- * const { line } = snaptrude.core.geom
25
- *
26
- * const edge = line.new(vec3.new(0, 0, 0), vec3.new(5, 0, 0))
27
- * ```
28
- */
29
- new(startPoint: PVec3, endPoint: PVec3): PLine;
30
- }
31
- /**
32
- * A line segment defined by a start and end point.
33
- *
34
- * Discriminated by `curveType: "Line"` within the {@linkcode PCurve} union.
35
- *
36
- * | Property | Type | Description |
37
- * |---|---|---|
38
- * | `curveType` | `"Line"` | Discriminator tag |
39
- * | `startPoint` | {@linkcode PVec3} | Start point of the segment |
40
- * | `endPoint` | {@linkcode PVec3} | End point of the segment |
41
- */
42
- export declare const PLine: z.ZodObject<{
43
- curveType: z.ZodLiteral<"Line">;
44
- startPoint: z.ZodObject<{
45
- x: z.ZodNumber;
46
- y: z.ZodNumber;
47
- z: z.ZodNumber;
48
- }, z.core.$strip>;
49
- endPoint: z.ZodObject<{
50
- x: z.ZodNumber;
51
- y: z.ZodNumber;
52
- z: z.ZodNumber;
53
- }, z.core.$strip>;
54
- }, z.core.$strip>;
55
- export type PLine = z.infer<typeof PLine>;
56
- //# sourceMappingURL=line.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEpC;;;;;;;;GAQG;AACH,8BAAsB,aAAa;;IAGjC;;;;;;;;;;;;;;OAcG;IACH,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,GAAG,KAAK;CAG/C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;iBAIhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAA"}
@@ -1,121 +0,0 @@
1
- import * as z from "zod";
2
- import { PluginApiReturn } from "../../../types";
3
- import { PCurve } from "./curve";
4
- /**
5
- * Profile construction — a closed loop of {@linkcode PCurve}s.
6
- *
7
- * Profiles are the primary 2D shape primitive used for creating
8
- * extruded entities like spaces. Build profiles either from an
9
- * explicit list of curves or from a list of points (auto-connected
10
- * with line segments).
11
- *
12
- * Accessed via `snaptrude.core.geom.profile`.
13
- */
14
- export declare abstract class PluginProfileApi {
15
- constructor();
16
- /**
17
- * Create a profile from an ordered list of curves.
18
- *
19
- * The curves should form a closed loop — the end point of each curve
20
- * should coincide with the start point of the next.
21
- *
22
- * @param curves - An ordered array of {@linkcode PCurve}s forming a closed loop
23
- * @returns A new {@linkcode PProfile}
24
- */
25
- new(curves: PCurve[]): PProfile;
26
- /**
27
- * Create a profile by connecting a list of points with line segments.
28
- *
29
- * The points are connected in order, with the last point automatically
30
- * connected back to the first to close the loop.
31
- *
32
- * This is a **host API call** — it returns a `Promise`.
33
- *
34
- * @param args - An object containing:
35
- * - {@linkcode PluginProfileFromLinePointsArgs.points args.points} — An ordered
36
- * array of {@linkcode PVec3} forming the profile vertices
37
- * @returns A {@linkcode PProfile} with line-segment curves connecting the points
38
- *
39
- * # Example
40
- * ```ts
41
- * const { vec3 } = snaptrude.core.math
42
- *
43
- * // Create an L-shaped profile
44
- * const profile = await snaptrude.core.geom.profile.fromLinePoints({
45
- * points: [
46
- * vec3.new(0, 0, 0),
47
- * vec3.new(10, 0, 0),
48
- * vec3.new(10, 0, 5),
49
- * vec3.new(5, 0, 5),
50
- * vec3.new(5, 0, 10),
51
- * vec3.new(0, 0, 10),
52
- * ],
53
- * })
54
- * ```
55
- */
56
- abstract fromLinePoints(args: PluginProfileFromLinePointsArgs): PluginApiReturn<PProfile>;
57
- }
58
- /**
59
- * Arguments for {@linkcode PluginProfileApi.fromLinePoints}.
60
- *
61
- * | Property | Type | Description |
62
- * |---|---|---|
63
- * | `points` | {@linkcode PVec3}`[]` | Ordered vertices of the profile |
64
- */
65
- export declare const PluginProfileFromLinePointsArgs: z.ZodObject<{
66
- points: z.ZodArray<z.ZodObject<{
67
- x: z.ZodNumber;
68
- y: z.ZodNumber;
69
- z: z.ZodNumber;
70
- }, z.core.$strip>>;
71
- }, z.core.$strip>;
72
- export type PluginProfileFromLinePointsArgs = z.infer<typeof PluginProfileFromLinePointsArgs>;
73
- /**
74
- * A closed profile composed of an ordered list of curves.
75
- *
76
- * Profiles are used as input to entity creation methods like
77
- * {@linkcode PluginSpaceApi.createFromProfile}.
78
- *
79
- * | Property | Type | Description |
80
- * |---|---|---|
81
- * | `curves` | {@linkcode PCurve}`[]` | Ordered curves forming a closed loop |
82
- */
83
- export declare const PProfile: z.ZodObject<{
84
- curves: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
85
- curveType: z.ZodLiteral<"Line">;
86
- startPoint: z.ZodObject<{
87
- x: z.ZodNumber;
88
- y: z.ZodNumber;
89
- z: z.ZodNumber;
90
- }, z.core.$strip>;
91
- endPoint: z.ZodObject<{
92
- x: z.ZodNumber;
93
- y: z.ZodNumber;
94
- z: z.ZodNumber;
95
- }, z.core.$strip>;
96
- }, z.core.$strip>, z.ZodObject<{
97
- curveType: z.ZodLiteral<"Arc">;
98
- startPoint: z.ZodObject<{
99
- x: z.ZodNumber;
100
- y: z.ZodNumber;
101
- z: z.ZodNumber;
102
- }, z.core.$strip>;
103
- endPoint: z.ZodObject<{
104
- x: z.ZodNumber;
105
- y: z.ZodNumber;
106
- z: z.ZodNumber;
107
- }, z.core.$strip>;
108
- centrePoint: z.ZodObject<{
109
- x: z.ZodNumber;
110
- y: z.ZodNumber;
111
- z: z.ZodNumber;
112
- }, z.core.$strip>;
113
- axis: z.ZodObject<{
114
- x: z.ZodNumber;
115
- y: z.ZodNumber;
116
- z: z.ZodNumber;
117
- }, z.core.$strip>;
118
- }, z.core.$strip>], "curveType">>;
119
- }, z.core.$strip>;
120
- export type PProfile = z.infer<typeof PProfile>;
121
- //# sourceMappingURL=profile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC;;;;;;;;;GASG;AACH,8BAAsB,gBAAgB;;IAGpC;;;;;;;;OAQG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ;IAI/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;aACa,cAAc,CAC5B,IAAI,EAAE,+BAA+B,GACpC,eAAe,CAAC,QAAQ,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B;;;;;;iBAE1C,CAAA;AAEF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEnB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAA"}
@@ -1,18 +0,0 @@
1
- import { PluginMathApi } from "./math";
2
- import { PluginGeomApi } from "./geom";
3
- /**
4
- * Core primitives used across the plugin API.
5
- *
6
- * - {@linkcode PluginCoreApi.math} — Vector and quaternion operations
7
- * - {@linkcode PluginCoreApi.geom} — Geometry primitives (lines, arcs, curves, profiles)
8
- */
9
- export declare abstract class PluginCoreApi {
10
- /** Vector and quaternion math utilities. See {@linkcode PluginMathApi}. */
11
- abstract math: PluginMathApi;
12
- /** Geometry primitives and constructors. See {@linkcode PluginGeomApi}. */
13
- abstract geom: PluginGeomApi;
14
- constructor();
15
- }
16
- export * from "./math";
17
- export * from "./geom";
18
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAEtC;;;;;GAKG;AACH,8BAAsB,aAAa;IACjC,2EAA2E;IAC3E,SAAgB,IAAI,EAAE,aAAa,CAAA;IACnC,2EAA2E;IAC3E,SAAgB,IAAI,EAAE,aAAa,CAAA;;CAGpC;AAED,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}
@@ -1,18 +0,0 @@
1
- import { PluginVec3Api } from "./vec3";
2
- import { PluginQuatApi } from "./quat";
3
- /**
4
- * Math primitives for 3D vector and quaternion operations.
5
- *
6
- * - {@linkcode PluginMathApi.vec3} — 3D vector creation and arithmetic
7
- * - {@linkcode PluginMathApi.quat} — Quaternion creation and rotation operations
8
- */
9
- export declare abstract class PluginMathApi {
10
- /** 3D vector operations. See {@linkcode PluginVec3Api}. */
11
- abstract vec3: PluginVec3Api;
12
- /** Quaternion operations. See {@linkcode PluginQuatApi}. */
13
- abstract quat: PluginQuatApi;
14
- constructor();
15
- }
16
- export * from "./vec3";
17
- export * from "./quat";
18
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/core/math/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAEtC;;;;;GAKG;AACH,8BAAsB,aAAa;IACjC,2DAA2D;IAC3D,SAAgB,IAAI,EAAE,aAAa,CAAA;IACnC,4DAA4D;IAC5D,SAAgB,IAAI,EAAE,aAAa,CAAA;;CAGpC;AAED,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}