@snaptrude/plugin-core 0.3.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +130 -48
- package/CHANGELOG.md +163 -0
- package/api-manifest.full.json +5600 -0
- package/api-manifest.json +5502 -0
- package/dist/api/analysis/heatmaps.d.ts +234 -0
- package/dist/api/analysis/heatmaps.d.ts.map +1 -0
- package/dist/api/analysis/illuminance.d.ts +145 -0
- package/dist/api/analysis/illuminance.d.ts.map +1 -0
- package/dist/api/analysis/index.d.ts +44 -0
- package/dist/api/analysis/index.d.ts.map +1 -0
- package/dist/api/analysis/shadows.d.ts +165 -0
- package/dist/api/analysis/shadows.d.ts.map +1 -0
- package/dist/api/analysis/sunlightHours.d.ts +208 -0
- package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
- package/dist/api/analysis/sunpath.d.ts +80 -0
- package/dist/api/analysis/sunpath.d.ts.map +1 -0
- package/dist/api/core/buildings.d.ts +427 -0
- package/dist/api/core/buildings.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +230 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +247 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +72 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +24 -23
- package/dist/api/core/geom/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +169 -0
- package/dist/api/core/geom/query/arc.d.ts.map +1 -0
- package/dist/api/core/geom/query/brep.d.ts +402 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -0
- package/dist/api/core/geom/query/circle.d.ts +378 -0
- package/dist/api/core/geom/query/circle.d.ts.map +1 -0
- package/dist/api/core/geom/query/contour.d.ts +450 -0
- package/dist/api/core/geom/query/contour.d.ts.map +1 -0
- package/dist/api/core/geom/query/curve.d.ts +918 -0
- package/dist/api/core/geom/query/curve.d.ts.map +1 -0
- package/dist/api/core/geom/query/edge.d.ts +128 -0
- package/dist/api/core/geom/query/edge.d.ts.map +1 -0
- package/dist/api/core/geom/query/face.d.ts +363 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -0
- package/dist/api/core/geom/query/halfedge.d.ts +206 -0
- package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
- package/dist/api/core/geom/query/index.d.ts +61 -0
- package/dist/api/core/geom/query/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/profile.d.ts +410 -0
- package/dist/api/core/geom/query/profile.d.ts.map +1 -0
- package/dist/api/core/geom/query/vertex.d.ts +187 -0
- package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
- package/dist/api/core/geom/update/contour.d.ts +272 -0
- package/dist/api/core/geom/update/contour.d.ts.map +1 -0
- package/dist/api/core/geom/update/curve.d.ts +180 -0
- package/dist/api/core/geom/update/curve.d.ts.map +1 -0
- package/dist/api/core/geom/update/index.d.ts +27 -0
- package/dist/api/core/geom/update/index.d.ts.map +1 -0
- package/dist/api/core/geom/update/profile.d.ts +329 -0
- package/dist/api/core/geom/update/profile.d.ts.map +1 -0
- package/dist/api/core/groups.d.ts +485 -0
- package/dist/api/core/groups.d.ts.map +1 -0
- package/dist/api/core/history/index.d.ts +78 -0
- package/dist/api/core/history/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +51 -1
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/import/index.d.ts +392 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +35 -0
- package/dist/api/core/io/index.d.ts.map +1 -0
- package/dist/api/core/io/job/index.d.ts +139 -0
- package/dist/api/core/io/job/index.d.ts.map +1 -0
- package/dist/api/core/io/query/index.d.ts +74 -0
- package/dist/api/core/io/query/index.d.ts.map +1 -0
- package/dist/api/core/io/terrain/index.d.ts +206 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +286 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +111 -128
- package/dist/api/core/math/quat.d.ts.map +1 -1
- package/dist/api/core/math/vec3.d.ts +120 -102
- package/dist/api/core/math/vec3.d.ts.map +1 -1
- package/dist/api/core/project/index.d.ts +399 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +755 -0
- package/dist/api/core/tags.d.ts.map +1 -0
- package/dist/api/core/units/index.d.ts +175 -0
- package/dist/api/core/units/index.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +45 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +168 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +837 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +63 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +268 -0
- package/dist/api/design/doors/index.d.ts.map +1 -0
- package/dist/api/design/edit/index.d.ts +49 -0
- package/dist/api/design/edit/index.d.ts.map +1 -0
- package/dist/api/design/erase/index.d.ts +160 -0
- package/dist/api/design/erase/index.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +123 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +153 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +41 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +297 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +140 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1011 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +221 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +282 -0
- package/dist/api/design/selection/index.d.ts.map +1 -0
- package/dist/api/design/shared.d.ts +38 -0
- package/dist/api/design/shared.d.ts.map +1 -0
- package/dist/api/design/transform/index.d.ts +87 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +178 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +189 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +261 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
- package/dist/api/entity/department.d.ts +0 -98
- package/dist/api/entity/department.d.ts.map +1 -1
- package/dist/api/entity/index.d.ts +9 -9
- package/dist/api/entity/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +49 -106
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +484 -251
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +49 -39
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +22 -12
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +440 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +81 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +113 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +46 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +176 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +296 -0
- package/dist/api/presentation/views.d.ts.map +1 -0
- package/dist/api/program/adjacency.d.ts +155 -0
- package/dist/api/program/adjacency.d.ts.map +1 -0
- package/dist/api/program/areas.d.ts +360 -0
- package/dist/api/program/areas.d.ts.map +1 -0
- package/dist/api/program/classification.d.ts +135 -0
- package/dist/api/program/classification.d.ts.map +1 -0
- package/dist/api/program/cores.d.ts +174 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +431 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +69 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +63 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metrics.d.ts +108 -0
- package/dist/api/program/metrics.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +451 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2041 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/handles.d.ts +171 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +7 -5
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4344 -899
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3682 -865
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/scripts/generate-manifest.mjs +193 -0
- package/scripts/generate-manifest.test.mjs +215 -0
- package/src/api/analysis/heatmaps.ts +256 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +46 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/core/buildings.ts +485 -0
- package/src/api/core/comment/index.ts +258 -0
- package/src/api/core/geom/create/index.ts +293 -0
- package/src/api/core/geom/delete/index.ts +78 -0
- package/src/api/core/geom/index.ts +24 -23
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +444 -0
- package/src/api/core/geom/query/circle.ts +404 -0
- package/src/api/core/geom/query/contour.ts +540 -0
- package/src/api/core/geom/query/curve.ts +1078 -0
- package/src/api/core/geom/query/edge.ts +130 -0
- package/src/api/core/geom/query/face.ts +403 -0
- package/src/api/core/geom/query/halfedge.ts +210 -0
- package/src/api/core/geom/query/index.ts +63 -0
- package/src/api/core/geom/query/profile.ts +473 -0
- package/src/api/core/geom/query/vertex.ts +205 -0
- package/src/api/core/geom/update/contour.ts +315 -0
- package/src/api/core/geom/update/curve.ts +209 -0
- package/src/api/core/geom/update/index.ts +29 -0
- package/src/api/core/geom/update/profile.ts +377 -0
- package/src/api/core/groups.ts +521 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +51 -1
- package/src/api/core/io/import/index.ts +432 -0
- package/src/api/core/io/index.ts +37 -0
- package/src/api/core/io/job/index.ts +140 -0
- package/src/api/core/io/query/index.ts +71 -0
- package/src/api/core/io/terrain/index.ts +214 -0
- package/src/api/core/io/underlay/index.ts +295 -0
- package/src/api/core/layers.ts +333 -0
- package/src/api/core/math/quat.ts +112 -235
- package/src/api/core/math/vec3.ts +124 -159
- package/src/api/core/project/index.ts +418 -0
- package/src/api/core/tags.ts +808 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/zoom/index.ts +47 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/index.ts +895 -0
- package/src/api/design/delete/index.ts +67 -0
- package/src/api/design/doors/index.ts +285 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/furniture/index.ts +130 -0
- package/src/api/design/index.ts +162 -0
- package/src/api/design/lock.ts +42 -0
- package/src/api/design/materials/index.ts +301 -0
- package/src/api/design/query/geometry/index.ts +166 -0
- package/src/api/design/query/index.ts +937 -0
- package/src/api/design/query/spaces.ts +132 -0
- package/src/api/design/selection/index.ts +273 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +93 -0
- package/src/api/design/update/index.ts +117 -0
- package/src/api/design/windows/index.ts +207 -0
- package/src/api/entity/buildableEnvelope.ts +318 -0
- package/src/api/entity/department.ts +0 -113
- package/src/api/entity/index.ts +9 -9
- package/src/api/entity/referenceLine.ts +50 -38
- package/src/api/entity/space.ts +285 -226
- package/src/api/entity/story.ts +53 -42
- package/src/api/index.ts +22 -12
- package/src/api/presentation/aiInspiration.ts +362 -0
- package/src/api/presentation/diagrams.ts +84 -0
- package/src/api/presentation/import.ts +112 -0
- package/src/api/presentation/index.ts +48 -0
- package/src/api/presentation/sheets.ts +198 -0
- package/src/api/presentation/views.ts +303 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +335 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +171 -0
- package/src/api/program/departments.ts +465 -0
- package/src/api/program/index.ts +71 -0
- package/src/api/program/layout.ts +68 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +419 -0
- package/src/api/program/spreadsheet.ts +2075 -0
- package/src/handles.ts +194 -0
- package/src/host-utils.ts +10 -6
- package/src/index.ts +1 -0
- package/dist/api/core/geom/arc.d.ts +0 -81
- package/dist/api/core/geom/arc.d.ts.map +0 -1
- package/dist/api/core/geom/curve.d.ts +0 -70
- package/dist/api/core/geom/curve.d.ts.map +0 -1
- package/dist/api/core/geom/line.d.ts +0 -56
- package/dist/api/core/geom/line.d.ts.map +0 -1
- package/dist/api/core/geom/profile.d.ts +0 -121
- package/dist/api/core/geom/profile.d.ts.map +0 -1
- package/dist/api/tools/copy.d.ts +0 -59
- package/dist/api/tools/copy.d.ts.map +0 -1
- package/dist/api/tools/index.d.ts +0 -33
- package/dist/api/tools/index.d.ts.map +0 -1
- package/dist/api/tools/material.d.ts +0 -51
- package/dist/api/tools/material.d.ts.map +0 -1
- package/dist/api/tools/offset.d.ts +0 -43
- package/dist/api/tools/offset.d.ts.map +0 -1
- package/dist/api/tools/selection.d.ts +0 -48
- package/dist/api/tools/selection.d.ts.map +0 -1
- package/dist/api/tools/transform.d.ts +0 -114
- package/dist/api/tools/transform.d.ts.map +0 -1
- package/dist/api/units/index.d.ts +0 -163
- package/dist/api/units/index.d.ts.map +0 -1
- package/src/api/core/geom/arc.ts +0 -70
- package/src/api/core/geom/curve.ts +0 -41
- package/src/api/core/geom/line.ts +0 -53
- package/src/api/core/geom/profile.ts +0 -94
- package/src/api/tools/copy.ts +0 -55
- package/src/api/tools/index.ts +0 -39
- package/src/api/tools/material.ts +0 -49
- package/src/api/tools/offset.ts +0 -43
- package/src/api/tools/selection.ts +0 -51
- package/src/api/tools/transform.ts +0 -117
- package/src/api/units/index.ts +0 -163
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../../types"
|
|
3
|
+
import {
|
|
4
|
+
ProfileHandle,
|
|
5
|
+
Vec3Handle,
|
|
6
|
+
CurveHandle,
|
|
7
|
+
Vec3Components,
|
|
8
|
+
} from "../../../../handles"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Profile editing — produce NEW profiles from an existing one (all-handle model, §11).
|
|
12
|
+
*
|
|
13
|
+
* Every method is an immutable derive-new operation: it takes an opaque
|
|
14
|
+
* {@linkcode ProfileHandle} (plus any extra inputs) and returns a fresh
|
|
15
|
+
* {@linkcode ProfileHandle} for the resulting profile. The input profile is never
|
|
16
|
+
* mutated — the original handle keeps referring to the unchanged profile. Read the
|
|
17
|
+
* resulting geometry back as plain values with the query namespace.
|
|
18
|
+
*
|
|
19
|
+
* Accessed via `snaptrude.core.geom.update.profile`.
|
|
20
|
+
*/
|
|
21
|
+
export abstract class PluginGeomUpdateProfileApi {
|
|
22
|
+
constructor() {}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Offset a closed profile inward/outward by a signed distance. Immutable —
|
|
26
|
+
* returns a NEW profile and leaves the input unchanged.
|
|
27
|
+
*
|
|
28
|
+
* @param profile The closed profile to offset
|
|
29
|
+
* @param distance Signed offset distance (outward when positive, inward when negative)
|
|
30
|
+
* @returns The offset profile as a NEW {@linkcode ProfileHandle}
|
|
31
|
+
*
|
|
32
|
+
* @examplePrompt Offset this outline 300mm inward
|
|
33
|
+
* @examplePrompt Inset this boundary by a foot all around
|
|
34
|
+
*
|
|
35
|
+
* # Example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const rect = await snaptrude.core.geom.create.profileRect(10, 8)
|
|
38
|
+
* const inset = await snaptrude.core.geom.update.profile.offset(rect, -0.3)
|
|
39
|
+
* const area = await snaptrude.core.geom.query.profile.getArea(inset)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
public abstract offset(
|
|
43
|
+
profile: ProfileHandle,
|
|
44
|
+
distance: number,
|
|
45
|
+
): PluginApiReturn<ProfileHandle>
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Translate a profile by a vector. Immutable — returns a NEW profile and leaves
|
|
49
|
+
* the input unchanged.
|
|
50
|
+
*
|
|
51
|
+
* @param profile The profile to move
|
|
52
|
+
* @param translation Translation vector to move the profile by
|
|
53
|
+
* @returns The moved profile as a NEW {@linkcode ProfileHandle}
|
|
54
|
+
*
|
|
55
|
+
* @examplePrompt Move this outline 3 metres along the x axis
|
|
56
|
+
* @examplePrompt Shift this boundary to a new position
|
|
57
|
+
*
|
|
58
|
+
* # Example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const rect = await snaptrude.core.geom.create.profileRect(6, 4)
|
|
61
|
+
* const shift = await snaptrude.core.math.vec3.new(3, 0, 0)
|
|
62
|
+
* const moved = await snaptrude.core.geom.update.profile.move(rect, shift)
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
public abstract move(
|
|
66
|
+
profile: ProfileHandle,
|
|
67
|
+
translation: Vec3Handle,
|
|
68
|
+
): PluginApiReturn<ProfileHandle>
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Rotate a profile about an axis through an optional pivot. Immutable — returns a
|
|
72
|
+
* NEW profile and leaves the input unchanged.
|
|
73
|
+
*
|
|
74
|
+
* @param profile The profile to rotate
|
|
75
|
+
* @param axis Rotation axis direction
|
|
76
|
+
* @param angle Rotation angle in radians
|
|
77
|
+
* @param pivot Optional pivot point to rotate about (defaults to the origin)
|
|
78
|
+
* @returns The rotated profile as a NEW {@linkcode ProfileHandle}
|
|
79
|
+
*
|
|
80
|
+
* @examplePrompt Rotate this outline 30 degrees
|
|
81
|
+
* @examplePrompt Turn this boundary about its centre point
|
|
82
|
+
*
|
|
83
|
+
* # Example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const rect = await snaptrude.core.geom.create.profileRect(6, 4)
|
|
86
|
+
* const axis = await snaptrude.core.math.vec3.new(0, 1, 0)
|
|
87
|
+
* const rotated = await snaptrude.core.geom.update.profile.rotate(rect, axis, Math.PI / 6)
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
public abstract rotate(
|
|
91
|
+
profile: ProfileHandle,
|
|
92
|
+
axis: Vec3Handle,
|
|
93
|
+
angle: number,
|
|
94
|
+
pivot?: Vec3Handle,
|
|
95
|
+
): PluginApiReturn<ProfileHandle>
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Scale a profile uniformly or per-axis about an optional pivot. Immutable —
|
|
99
|
+
* returns a NEW profile and leaves the input unchanged.
|
|
100
|
+
*
|
|
101
|
+
* @param profile The profile to scale
|
|
102
|
+
* @param factor Uniform scale factor, or per-axis factors
|
|
103
|
+
* @param pivot Optional pivot point to scale about (defaults to the origin)
|
|
104
|
+
* @returns The scaled profile as a NEW {@linkcode ProfileHandle}
|
|
105
|
+
*
|
|
106
|
+
* @examplePrompt Scale this outline down to half size
|
|
107
|
+
* @examplePrompt Enlarge this boundary by 50 percent
|
|
108
|
+
*
|
|
109
|
+
* # Example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const rect = await snaptrude.core.geom.create.profileRect(6, 4)
|
|
112
|
+
* const half = await snaptrude.core.geom.update.profile.scale(rect, 0.5)
|
|
113
|
+
* const stretched = await snaptrude.core.geom.update.profile.scale(rect, { x: 2, y: 1, z: 1 })
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
public abstract scale(
|
|
117
|
+
profile: ProfileHandle,
|
|
118
|
+
factor: number | Vec3Components,
|
|
119
|
+
pivot?: Vec3Handle,
|
|
120
|
+
): PluginApiReturn<ProfileHandle>
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Mirror a profile across a plane. Immutable — returns a NEW profile and leaves
|
|
124
|
+
* the input unchanged.
|
|
125
|
+
*
|
|
126
|
+
* @param profile The profile to mirror
|
|
127
|
+
* @param plane Mirror plane defined by a point on it and its normal
|
|
128
|
+
* @returns The mirrored profile as a NEW {@linkcode ProfileHandle}
|
|
129
|
+
*
|
|
130
|
+
* @examplePrompt Mirror this outline across the vertical plane
|
|
131
|
+
* @examplePrompt Flip this boundary to its mirror image
|
|
132
|
+
*
|
|
133
|
+
* # Example
|
|
134
|
+
* ```ts
|
|
135
|
+
* const rect = await snaptrude.core.geom.create.profileRect(6, 4)
|
|
136
|
+
* const point = await snaptrude.core.math.vec3.new(0, 0, 0)
|
|
137
|
+
* const normal = await snaptrude.core.math.vec3.new(1, 0, 0)
|
|
138
|
+
* const mirrored = await snaptrude.core.geom.update.profile.mirror(rect, { point, normal })
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
public abstract mirror(
|
|
142
|
+
profile: ProfileHandle,
|
|
143
|
+
plane: { point: Vec3Handle; normal: Vec3Handle },
|
|
144
|
+
): PluginApiReturn<ProfileHandle>
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Append a curve to the start or end of a profile. The curve must connect to the
|
|
148
|
+
* chosen end. Immutable — returns a NEW profile and leaves the input unchanged.
|
|
149
|
+
*
|
|
150
|
+
* @param profile The profile to append to
|
|
151
|
+
* @param curve The curve to append; it must connect to the chosen end
|
|
152
|
+
* @param position Optional end to append at (defaults to `"end"`)
|
|
153
|
+
* @returns The extended profile as a NEW {@linkcode ProfileHandle}
|
|
154
|
+
*
|
|
155
|
+
* # Example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const rect = await snaptrude.core.geom.create.profileRect(4, 3)
|
|
158
|
+
* const open = await snaptrude.core.geom.update.profile.remove(rect, "end")
|
|
159
|
+
* const pts = await snaptrude.core.geom.query.profile.listPoints(open)
|
|
160
|
+
* const last = pts[pts.length - 1]
|
|
161
|
+
* const from = await snaptrude.core.math.vec3.new(last.x, last.y, last.z)
|
|
162
|
+
* const to = await snaptrude.core.math.vec3.new(pts[0].x, pts[0].y, pts[0].z)
|
|
163
|
+
* const closer = await snaptrude.core.geom.create.line(from, to)
|
|
164
|
+
* const closed = await snaptrude.core.geom.update.profile.add(open, closer, "end")
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
public abstract add(
|
|
168
|
+
profile: ProfileHandle,
|
|
169
|
+
curve: CurveHandle,
|
|
170
|
+
position?: "start" | "end",
|
|
171
|
+
): PluginApiReturn<ProfileHandle>
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Remove the curve at the start or end of a profile. Immutable — returns a NEW
|
|
175
|
+
* profile and leaves the input unchanged.
|
|
176
|
+
*
|
|
177
|
+
* @param profile The profile to remove a curve from
|
|
178
|
+
* @param position Optional end to remove from (defaults to `"end"`)
|
|
179
|
+
* @returns The trimmed profile as a NEW {@linkcode ProfileHandle}
|
|
180
|
+
*
|
|
181
|
+
* # Example
|
|
182
|
+
* ```ts
|
|
183
|
+
* const rect = await snaptrude.core.geom.create.profileRect(4, 3)
|
|
184
|
+
* const open = await snaptrude.core.geom.update.profile.remove(rect, "end")
|
|
185
|
+
* const isClosed = await snaptrude.core.geom.query.profile.isClosed(open) // false
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
public abstract remove(
|
|
189
|
+
profile: ProfileHandle,
|
|
190
|
+
position?: "start" | "end",
|
|
191
|
+
): PluginApiReturn<ProfileHandle>
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Reverse the orientation of a profile. Immutable — returns a NEW profile and
|
|
195
|
+
* leaves the input unchanged.
|
|
196
|
+
*
|
|
197
|
+
* @param profile The profile to reverse
|
|
198
|
+
* @returns The reversed profile as a NEW {@linkcode ProfileHandle}
|
|
199
|
+
*
|
|
200
|
+
* # Example
|
|
201
|
+
* ```ts
|
|
202
|
+
* const rect = await snaptrude.core.geom.create.profileRect(4, 3)
|
|
203
|
+
* const reversed = await snaptrude.core.geom.update.profile.reverse(rect)
|
|
204
|
+
* const clockwise = await snaptrude.core.geom.query.profile.isClockwise(reversed)
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
public abstract reverse(
|
|
208
|
+
profile: ProfileHandle,
|
|
209
|
+
): PluginApiReturn<ProfileHandle>
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Simplify a profile by merging collinear/redundant segments. Immutable —
|
|
213
|
+
* returns a NEW profile and leaves the input unchanged.
|
|
214
|
+
*
|
|
215
|
+
* @param profile The profile to simplify
|
|
216
|
+
* @returns The simplified profile as a NEW {@linkcode ProfileHandle}
|
|
217
|
+
*
|
|
218
|
+
* @examplePrompt Clean up this outline by merging collinear segments
|
|
219
|
+
* @examplePrompt Simplify this polyline and remove redundant points
|
|
220
|
+
*
|
|
221
|
+
* # Example
|
|
222
|
+
* ```ts
|
|
223
|
+
* const p0 = await snaptrude.core.math.vec3.new(0, 0, 0)
|
|
224
|
+
* const p1 = await snaptrude.core.math.vec3.new(2, 0, 0) // collinear with p0 and p2
|
|
225
|
+
* const p2 = await snaptrude.core.math.vec3.new(4, 0, 0)
|
|
226
|
+
* const p3 = await snaptrude.core.math.vec3.new(4, 0, 3)
|
|
227
|
+
* const jagged = await snaptrude.core.geom.create.profileFromLinePoints([p0, p1, p2, p3])
|
|
228
|
+
* const clean = await snaptrude.core.geom.update.profile.simplify(jagged)
|
|
229
|
+
* const curves = await snaptrude.core.geom.query.profile.listCurves(clean) // p0→p2 merged
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
public abstract simplify(
|
|
233
|
+
profile: ProfileHandle,
|
|
234
|
+
): PluginApiReturn<ProfileHandle>
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.offset}.
|
|
239
|
+
*
|
|
240
|
+
* | Property | Type | Description |
|
|
241
|
+
* |---|---|---|
|
|
242
|
+
* | `profile` | {@linkcode ProfileHandle} | The closed profile to offset |
|
|
243
|
+
* | `distance` | `number` | Signed offset distance (outward when positive, inward when negative) |
|
|
244
|
+
*/
|
|
245
|
+
export const PluginGeomUpdateProfileOffsetArgs = z.object({
|
|
246
|
+
profile: ProfileHandle,
|
|
247
|
+
distance: z.number(),
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
export type PluginGeomUpdateProfileOffsetArgs = z.infer<typeof PluginGeomUpdateProfileOffsetArgs>
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.move}.
|
|
254
|
+
*
|
|
255
|
+
* | Property | Type | Description |
|
|
256
|
+
* |---|---|---|
|
|
257
|
+
* | `profile` | {@linkcode ProfileHandle} | The profile to move |
|
|
258
|
+
* | `translation` | {@linkcode Vec3Handle} | Translation vector to move the profile by |
|
|
259
|
+
*/
|
|
260
|
+
export const PluginGeomUpdateProfileMoveArgs = z.object({
|
|
261
|
+
profile: ProfileHandle,
|
|
262
|
+
translation: Vec3Handle,
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
export type PluginGeomUpdateProfileMoveArgs = z.infer<typeof PluginGeomUpdateProfileMoveArgs>
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.rotate}.
|
|
269
|
+
*
|
|
270
|
+
* | Property | Type | Description |
|
|
271
|
+
* |---|---|---|
|
|
272
|
+
* | `profile` | {@linkcode ProfileHandle} | The profile to rotate |
|
|
273
|
+
* | `axis` | {@linkcode Vec3Handle} | Rotation axis direction |
|
|
274
|
+
* | `angle` | `number` | Rotation angle in radians |
|
|
275
|
+
* | `pivot` | {@linkcode Vec3Handle} | Optional pivot point to rotate about (defaults to the origin) |
|
|
276
|
+
*/
|
|
277
|
+
export const PluginGeomUpdateProfileRotateArgs = z.object({
|
|
278
|
+
profile: ProfileHandle,
|
|
279
|
+
axis: Vec3Handle,
|
|
280
|
+
angle: z.number(),
|
|
281
|
+
pivot: Vec3Handle.optional(),
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
export type PluginGeomUpdateProfileRotateArgs = z.infer<typeof PluginGeomUpdateProfileRotateArgs>
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.scale}.
|
|
288
|
+
*
|
|
289
|
+
* | Property | Type | Description |
|
|
290
|
+
* |---|---|---|
|
|
291
|
+
* | `profile` | {@linkcode ProfileHandle} | The profile to scale |
|
|
292
|
+
* | `factor` | `number` \| {@linkcode Vec3Components} | Uniform scale factor, or per-axis factors |
|
|
293
|
+
* | `pivot` | {@linkcode Vec3Handle} | Optional pivot point to scale about (defaults to the origin) |
|
|
294
|
+
*/
|
|
295
|
+
export const PluginGeomUpdateProfileScaleArgs = z.object({
|
|
296
|
+
profile: ProfileHandle,
|
|
297
|
+
factor: z.union([z.number(), Vec3Components]),
|
|
298
|
+
pivot: Vec3Handle.optional(),
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
export type PluginGeomUpdateProfileScaleArgs = z.infer<typeof PluginGeomUpdateProfileScaleArgs>
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.mirror}.
|
|
305
|
+
*
|
|
306
|
+
* | Property | Type | Description |
|
|
307
|
+
* |---|---|---|
|
|
308
|
+
* | `profile` | {@linkcode ProfileHandle} | The profile to mirror |
|
|
309
|
+
* | `plane` | `{ point: `{@linkcode Vec3Handle}`, normal: `{@linkcode Vec3Handle}` }` | Mirror plane defined by a point on it and its normal |
|
|
310
|
+
*/
|
|
311
|
+
export const PluginGeomUpdateProfileMirrorArgs = z.object({
|
|
312
|
+
profile: ProfileHandle,
|
|
313
|
+
plane: z.object({
|
|
314
|
+
point: Vec3Handle,
|
|
315
|
+
normal: Vec3Handle,
|
|
316
|
+
}),
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
export type PluginGeomUpdateProfileMirrorArgs = z.infer<typeof PluginGeomUpdateProfileMirrorArgs>
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.add}.
|
|
323
|
+
*
|
|
324
|
+
* | Property | Type | Description |
|
|
325
|
+
* |---|---|---|
|
|
326
|
+
* | `profile` | {@linkcode ProfileHandle} | The profile to append to |
|
|
327
|
+
* | `curve` | {@linkcode CurveHandle} | The curve to append; it must connect to the chosen end |
|
|
328
|
+
* | `position` | `"start"` \| `"end"` | Optional end to append at (defaults to `"end"`) |
|
|
329
|
+
*/
|
|
330
|
+
export const PluginGeomUpdateProfileAddArgs = z.object({
|
|
331
|
+
profile: ProfileHandle,
|
|
332
|
+
curve: CurveHandle,
|
|
333
|
+
position: z.enum(["start", "end"]).optional(),
|
|
334
|
+
})
|
|
335
|
+
|
|
336
|
+
export type PluginGeomUpdateProfileAddArgs = z.infer<typeof PluginGeomUpdateProfileAddArgs>
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.remove}.
|
|
340
|
+
*
|
|
341
|
+
* | Property | Type | Description |
|
|
342
|
+
* |---|---|---|
|
|
343
|
+
* | `profile` | {@linkcode ProfileHandle} | The profile to remove a curve from |
|
|
344
|
+
* | `position` | `"start"` \| `"end"` | Optional end to remove from (defaults to `"end"`) |
|
|
345
|
+
*/
|
|
346
|
+
export const PluginGeomUpdateProfileRemoveArgs = z.object({
|
|
347
|
+
profile: ProfileHandle,
|
|
348
|
+
position: z.enum(["start", "end"]).optional(),
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
export type PluginGeomUpdateProfileRemoveArgs = z.infer<typeof PluginGeomUpdateProfileRemoveArgs>
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.reverse}.
|
|
355
|
+
*
|
|
356
|
+
* | Property | Type | Description |
|
|
357
|
+
* |---|---|---|
|
|
358
|
+
* | `profile` | {@linkcode ProfileHandle} | The profile to reverse |
|
|
359
|
+
*/
|
|
360
|
+
export const PluginGeomUpdateProfileReverseArgs = z.object({
|
|
361
|
+
profile: ProfileHandle,
|
|
362
|
+
})
|
|
363
|
+
|
|
364
|
+
export type PluginGeomUpdateProfileReverseArgs = z.infer<typeof PluginGeomUpdateProfileReverseArgs>
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Arguments for {@linkcode PluginGeomUpdateProfileApi.simplify}.
|
|
368
|
+
*
|
|
369
|
+
* | Property | Type | Description |
|
|
370
|
+
* |---|---|---|
|
|
371
|
+
* | `profile` | {@linkcode ProfileHandle} | The profile to simplify |
|
|
372
|
+
*/
|
|
373
|
+
export const PluginGeomUpdateProfileSimplifyArgs = z.object({
|
|
374
|
+
profile: ProfileHandle,
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
export type PluginGeomUpdateProfileSimplifyArgs = z.infer<typeof PluginGeomUpdateProfileSimplifyArgs>
|