@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
|
@@ -1,187 +1,170 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { PluginApiReturn } from "../../../types";
|
|
2
|
+
import { Vec3Handle, QuatHandle, QuatComponents } from "../../../handles";
|
|
3
3
|
/**
|
|
4
|
-
* Quaternion operations
|
|
4
|
+
* Quaternion operations (all-handle model, §11).
|
|
5
5
|
*
|
|
6
|
-
* Quaternions
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Accessed via `snaptrude.core.math.quat`.
|
|
6
|
+
* Quaternions are opaque {@linkcode QuatHandle}s; every operation is a host call
|
|
7
|
+
* returning a new handle. Read primitive components back with
|
|
8
|
+
* {@linkcode PluginQuatApi.components}. Accessed via `snaptrude.core.math.quat`.
|
|
11
9
|
*/
|
|
12
10
|
export declare abstract class PluginQuatApi {
|
|
13
11
|
constructor();
|
|
14
12
|
/**
|
|
15
|
-
* Create a
|
|
16
|
-
*
|
|
17
|
-
* For most use cases prefer {@linkcode PluginQuatApi.fromAxisAngle}
|
|
18
|
-
* or {@linkcode PluginQuatApi.fromEuler} instead.
|
|
13
|
+
* Create a quaternion from primitive components.
|
|
19
14
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
15
|
+
* # Example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const q = await snaptrude.core.math.quat.new(0, 0, 0, 1)
|
|
18
|
+
* const { x, y, z, w } = await snaptrude.core.math.quat.components(q)
|
|
19
|
+
* ```
|
|
25
20
|
*/
|
|
26
|
-
new(x: number, y: number, z: number, w: number):
|
|
21
|
+
abstract new(x: number, y: number, z: number, w: number): PluginApiReturn<QuatHandle>;
|
|
27
22
|
/**
|
|
28
|
-
*
|
|
23
|
+
* Return the identity quaternion (no rotation).
|
|
29
24
|
*
|
|
30
|
-
*
|
|
25
|
+
* # Example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const noRotation = await snaptrude.core.math.quat.identity()
|
|
28
|
+
* ```
|
|
31
29
|
*/
|
|
32
|
-
identity():
|
|
30
|
+
abstract identity(): PluginApiReturn<QuatHandle>;
|
|
33
31
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @param axis - The rotation axis as a {@linkcode PVec3} (will be normalized internally)
|
|
37
|
-
* @param angle - The rotation angle in **radians**
|
|
38
|
-
* @returns A new unit {@linkcode PQuat}, or identity if {@linkcode axis} has zero length
|
|
32
|
+
* Build a quaternion from a rotation axis and an angle in radians.
|
|
39
33
|
*
|
|
40
34
|
* # Example
|
|
41
35
|
* ```ts
|
|
42
|
-
* const
|
|
43
|
-
*
|
|
44
|
-
* const rot = quat.fromAxisAngle(vec3.new(0, 1, 0), Math.PI / 2)
|
|
36
|
+
* const axis = await snaptrude.core.math.vec3.new(0, 0, 1)
|
|
37
|
+
* const quarterTurn = await snaptrude.core.math.quat.fromAxisAngle(axis, Math.PI / 2)
|
|
45
38
|
* ```
|
|
46
39
|
*/
|
|
47
|
-
fromAxisAngle(axis:
|
|
40
|
+
abstract fromAxisAngle(axis: Vec3Handle, angle: number): PluginApiReturn<QuatHandle>;
|
|
48
41
|
/**
|
|
49
|
-
*
|
|
42
|
+
* Build a quaternion from Euler angles in radians.
|
|
50
43
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
44
|
+
* # Example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const q = await snaptrude.core.math.quat.fromEuler(0, Math.PI / 2, 0)
|
|
47
|
+
* ```
|
|
55
48
|
*/
|
|
56
|
-
fromEuler(x: number, y: number, z: number):
|
|
49
|
+
abstract fromEuler(x: number, y: number, z: number): PluginApiReturn<QuatHandle>;
|
|
57
50
|
/**
|
|
58
|
-
*
|
|
51
|
+
* Compose two rotations with the Hamilton product `a * b` (apply `b` then `a`).
|
|
59
52
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
53
|
+
* # Example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const a = await snaptrude.core.math.quat.fromEuler(0, Math.PI / 2, 0)
|
|
56
|
+
* const b = await snaptrude.core.math.quat.fromEuler(Math.PI / 4, 0, 0)
|
|
57
|
+
* const combined = await snaptrude.core.math.quat.multiply(a, b) // b first, then a
|
|
58
|
+
* ```
|
|
66
59
|
*/
|
|
67
|
-
multiply(a:
|
|
60
|
+
abstract multiply(a: QuatHandle, b: QuatHandle): PluginApiReturn<QuatHandle>;
|
|
68
61
|
/**
|
|
69
|
-
* Compute the conjugate of a quaternion.
|
|
70
|
-
*
|
|
71
|
-
* For unit quaternions the conjugate equals the inverse.
|
|
62
|
+
* Compute the conjugate of a quaternion (negated vector part).
|
|
72
63
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
64
|
+
* # Example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const q = await snaptrude.core.math.quat.fromEuler(0, Math.PI / 4, 0)
|
|
67
|
+
* const conj = await snaptrude.core.math.quat.conjugate(q)
|
|
68
|
+
* ```
|
|
75
69
|
*/
|
|
76
|
-
conjugate(q:
|
|
70
|
+
abstract conjugate(q: QuatHandle): PluginApiReturn<QuatHandle>;
|
|
77
71
|
/**
|
|
78
|
-
* Compute the
|
|
72
|
+
* Compute the magnitude (norm) of a quaternion.
|
|
79
73
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
74
|
+
* # Example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const q = await snaptrude.core.math.quat.new(0, 0, 0, 1)
|
|
77
|
+
* const len = await snaptrude.core.math.quat.length(q) // 1
|
|
78
|
+
* ```
|
|
82
79
|
*/
|
|
83
|
-
length(q:
|
|
80
|
+
abstract length(q: QuatHandle): PluginApiReturn<number>;
|
|
84
81
|
/**
|
|
85
82
|
* Normalize a quaternion to unit length.
|
|
86
83
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* Compute the inverse of a quaternion.
|
|
93
|
-
*
|
|
94
|
-
* The inverse satisfies `q * inverse(q) = identity`.
|
|
95
|
-
*
|
|
96
|
-
* @param q - The quaternion to invert
|
|
97
|
-
* @returns A new {@linkcode PQuat} that is the multiplicative inverse,
|
|
98
|
-
* or identity if the input has zero length
|
|
84
|
+
* # Example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const q = await snaptrude.core.math.quat.new(0, 0, 1, 1)
|
|
87
|
+
* const unit = await snaptrude.core.math.quat.normalize(q)
|
|
88
|
+
* ```
|
|
99
89
|
*/
|
|
100
|
-
|
|
90
|
+
abstract normalize(q: QuatHandle): PluginApiReturn<QuatHandle>;
|
|
101
91
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* Computes `q * v * conjugate(q)` using the Hamilton product.
|
|
105
|
-
*
|
|
106
|
-
* @param q - The rotation quaternion (should be unit-length)
|
|
107
|
-
* @param v - The vector to rotate as a {@linkcode PVec3}
|
|
108
|
-
* @returns A new rotated {@linkcode PVec3}
|
|
92
|
+
* Compute the inverse quaternion — the rotation that undoes `q`.
|
|
109
93
|
*
|
|
110
94
|
* # Example
|
|
111
95
|
* ```ts
|
|
112
|
-
* const
|
|
113
|
-
* const
|
|
114
|
-
* const rotated = quat.rotateVec3(rot, vec3.new(1, 0, 0))
|
|
115
|
-
* // ≈ { x: 0, y: 0, z: -1 }
|
|
96
|
+
* const q = await snaptrude.core.math.quat.fromEuler(0, Math.PI / 2, 0)
|
|
97
|
+
* const undo = await snaptrude.core.math.quat.inverse(q)
|
|
116
98
|
* ```
|
|
117
99
|
*/
|
|
118
|
-
|
|
100
|
+
abstract inverse(q: QuatHandle): PluginApiReturn<QuatHandle>;
|
|
119
101
|
/**
|
|
120
|
-
*
|
|
102
|
+
* Decompose a quaternion into its rotation axis and angle (radians).
|
|
121
103
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
104
|
+
* # Example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const q = await snaptrude.core.math.quat.fromEuler(0, Math.PI / 3, 0)
|
|
107
|
+
* const { axis, angle } = await snaptrude.core.math.quat.toAxisAngle(q)
|
|
108
|
+
* const { x, y, z } = await snaptrude.core.math.vec3.components(axis)
|
|
109
|
+
* ```
|
|
127
110
|
*/
|
|
128
|
-
toAxisAngle(q:
|
|
129
|
-
axis:
|
|
111
|
+
abstract toAxisAngle(q: QuatHandle): PluginApiReturn<{
|
|
112
|
+
axis: Vec3Handle;
|
|
130
113
|
angle: number;
|
|
131
|
-
}
|
|
114
|
+
}>;
|
|
132
115
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* Produces smooth constant-speed rotation between {@linkcode a} and {@linkcode b}.
|
|
116
|
+
* Spherically interpolate (slerp) between two rotations by factor `t`.
|
|
136
117
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
118
|
+
* # Example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const start = await snaptrude.core.math.quat.identity()
|
|
121
|
+
* const end = await snaptrude.core.math.quat.fromEuler(0, Math.PI, 0)
|
|
122
|
+
* const halfway = await snaptrude.core.math.quat.slerp(start, end, 0.5)
|
|
123
|
+
* ```
|
|
141
124
|
*/
|
|
142
|
-
slerp(a:
|
|
125
|
+
abstract slerp(a: QuatHandle, b: QuatHandle, t: number): PluginApiReturn<QuatHandle>;
|
|
143
126
|
/**
|
|
144
127
|
* Compute the dot product of two quaternions.
|
|
145
128
|
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
129
|
+
* # Example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const a = await snaptrude.core.math.quat.identity()
|
|
132
|
+
* const b = await snaptrude.core.math.quat.fromEuler(0, Math.PI / 2, 0)
|
|
133
|
+
* const d = await snaptrude.core.math.quat.dot(a, b)
|
|
134
|
+
* ```
|
|
152
135
|
*/
|
|
153
|
-
dot(a:
|
|
136
|
+
abstract dot(a: QuatHandle, b: QuatHandle): PluginApiReturn<number>;
|
|
154
137
|
/**
|
|
155
|
-
*
|
|
138
|
+
* Test whether two quaternions have exactly equal components.
|
|
156
139
|
*
|
|
157
|
-
*
|
|
140
|
+
* # Example
|
|
141
|
+
* ```ts
|
|
142
|
+
* const a = await snaptrude.core.math.quat.new(0, 0, 0, 1)
|
|
143
|
+
* const b = await snaptrude.core.math.quat.identity()
|
|
144
|
+
* const same = await snaptrude.core.math.quat.equals(a, b) // true
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
abstract equals(a: QuatHandle, b: QuatHandle): PluginApiReturn<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Test whether two quaternions are equal within a tolerance `epsilon` (default `1e-6`).
|
|
158
150
|
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
151
|
+
* # Example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const a = await snaptrude.core.math.quat.fromEuler(0, Math.PI / 2, 0)
|
|
154
|
+
* const b = await snaptrude.core.math.quat.fromEuler(0, 1.5711, 0)
|
|
155
|
+
* const close = await snaptrude.core.math.quat.equalsApprox(a, b, 1e-3) // true
|
|
156
|
+
* ```
|
|
162
157
|
*/
|
|
163
|
-
|
|
158
|
+
abstract equalsApprox(a: QuatHandle, b: QuatHandle, epsilon?: number): PluginApiReturn<boolean>;
|
|
164
159
|
/**
|
|
165
|
-
*
|
|
160
|
+
* Read the primitive `{ x, y, z, w }` components of a quaternion handle.
|
|
166
161
|
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
162
|
+
* # Example
|
|
163
|
+
* ```ts
|
|
164
|
+
* const q = await snaptrude.core.math.quat.fromEuler(0, Math.PI / 2, 0)
|
|
165
|
+
* const { x, y, z, w } = await snaptrude.core.math.quat.components(q)
|
|
166
|
+
* ```
|
|
171
167
|
*/
|
|
172
|
-
|
|
168
|
+
abstract components(q: QuatHandle): PluginApiReturn<QuatComponents>;
|
|
173
169
|
}
|
|
174
|
-
/**
|
|
175
|
-
* A quaternion with `x`, `y`, `z`, and `w` components.
|
|
176
|
-
*
|
|
177
|
-
* Used for representing 3D rotations without gimbal lock.
|
|
178
|
-
* Equivalent to `BABYLON.Quaternion`.
|
|
179
|
-
*/
|
|
180
|
-
export declare const PQuat: z.ZodObject<{
|
|
181
|
-
x: z.ZodNumber;
|
|
182
|
-
y: z.ZodNumber;
|
|
183
|
-
z: z.ZodNumber;
|
|
184
|
-
w: z.ZodNumber;
|
|
185
|
-
}, z.core.$strip>;
|
|
186
|
-
export type PQuat = z.infer<typeof PQuat>;
|
|
187
170
|
//# sourceMappingURL=quat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quat.d.ts","sourceRoot":"","sources":["../../../../src/api/core/math/quat.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"quat.d.ts","sourceRoot":"","sources":["../../../../src/api/core/math/quat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,UAA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AE,UAAU,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACzF;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC;IACpF;;;;;;;;;OASG;IACH,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC;IACnE;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC;IACvE;;;;;;;;;OASG;IACH,QAAQ,CAAC,YAAY,CACnB,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,EACb,OAAO,CAAC,EAAE,MAAM,GACf,eAAe,CAAC,OAAO,CAAC;IAC3B;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,eAAe,CAAC,cAAc,CAAC;CACpE"}
|
|
@@ -1,156 +1,174 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PluginApiReturn } from "../../../types";
|
|
2
|
+
import { Vec3Handle, Vec3Components } from "../../../handles";
|
|
2
3
|
/**
|
|
3
|
-
* 3D vector operations
|
|
4
|
+
* 3D vector operations (all-handle model, §11).
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Accessed via `snaptrude.core.math.vec3`.
|
|
6
|
+
* Vectors are opaque {@linkcode Vec3Handle}s; every operation is a host call
|
|
7
|
+
* returning a new handle (vectors are immutable). Read primitive components back
|
|
8
|
+
* with {@linkcode PluginVec3Api.components}. Accessed via `snaptrude.core.math.vec3`.
|
|
9
9
|
*/
|
|
10
10
|
export declare abstract class PluginVec3Api {
|
|
11
11
|
constructor();
|
|
12
12
|
/**
|
|
13
|
-
* Create a
|
|
14
|
-
*
|
|
15
|
-
* @param x - The X component
|
|
16
|
-
* @param y - The Y component
|
|
17
|
-
* @param z - The Z component
|
|
18
|
-
* @returns A new {@linkcode PVec3}
|
|
13
|
+
* Create a vector from primitive components.
|
|
19
14
|
*
|
|
20
15
|
* # Example
|
|
21
16
|
* ```ts
|
|
22
|
-
* const
|
|
23
|
-
*
|
|
17
|
+
* const v = await snaptrude.core.math.vec3.new(10, 0, 5)
|
|
18
|
+
* const { x, y, z } = await snaptrude.core.math.vec3.components(v)
|
|
24
19
|
* ```
|
|
25
20
|
*/
|
|
26
|
-
new(x: number, y: number, z: number):
|
|
21
|
+
abstract new(x: number, y: number, z: number): PluginApiReturn<Vec3Handle>;
|
|
27
22
|
/**
|
|
28
|
-
* Add two vectors component-wise.
|
|
23
|
+
* Add two vectors component-wise (`a + b`).
|
|
29
24
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
25
|
+
* # Example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const a = await snaptrude.core.math.vec3.new(1, 0, 0)
|
|
28
|
+
* const b = await snaptrude.core.math.vec3.new(0, 1, 0)
|
|
29
|
+
* const sum = await snaptrude.core.math.vec3.add(a, b)
|
|
30
|
+
* ```
|
|
33
31
|
*/
|
|
34
|
-
add(a:
|
|
32
|
+
abstract add(a: Vec3Handle, b: Vec3Handle): PluginApiReturn<Vec3Handle>;
|
|
35
33
|
/**
|
|
36
|
-
* Subtract vector
|
|
34
|
+
* Subtract vector `b` from `a` component-wise (`a - b`).
|
|
37
35
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* # Example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const a = await snaptrude.core.math.vec3.new(3, 2, 1)
|
|
39
|
+
* const b = await snaptrude.core.math.vec3.new(1, 1, 1)
|
|
40
|
+
* const diff = await snaptrude.core.math.vec3.subtract(a, b)
|
|
41
|
+
* ```
|
|
41
42
|
*/
|
|
42
|
-
subtract(a:
|
|
43
|
+
abstract subtract(a: Vec3Handle, b: Vec3Handle): PluginApiReturn<Vec3Handle>;
|
|
43
44
|
/**
|
|
44
|
-
* Scale
|
|
45
|
+
* Scale `v` by a scalar.
|
|
45
46
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
47
|
+
* # Example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const v = await snaptrude.core.math.vec3.new(1, 2, 3)
|
|
50
|
+
* const doubled = await snaptrude.core.math.vec3.scale(v, 2)
|
|
51
|
+
* ```
|
|
49
52
|
*/
|
|
50
|
-
scale(v:
|
|
53
|
+
abstract scale(v: Vec3Handle, scalar: number): PluginApiReturn<Vec3Handle>;
|
|
51
54
|
/**
|
|
52
55
|
* Compute the dot product of two vectors.
|
|
53
56
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @returns The scalar dot product
|
|
57
|
+
* # Example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const a = await snaptrude.core.math.vec3.new(1, 0, 0)
|
|
60
|
+
* const b = await snaptrude.core.math.vec3.new(0.5, 0.5, 0)
|
|
61
|
+
* const d = await snaptrude.core.math.vec3.dot(a, b) // 0.5
|
|
62
|
+
* ```
|
|
61
63
|
*/
|
|
62
|
-
dot(a:
|
|
64
|
+
abstract dot(a: Vec3Handle, b: Vec3Handle): PluginApiReturn<number>;
|
|
63
65
|
/**
|
|
64
|
-
* Compute the cross product
|
|
65
|
-
*
|
|
66
|
-
* The result is a vector perpendicular to both inputs, with magnitude
|
|
67
|
-
* equal to the area of the parallelogram they span. Useful for computing
|
|
68
|
-
* surface normals.
|
|
66
|
+
* Compute the cross product `a × b` — the vector perpendicular to both.
|
|
69
67
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
68
|
+
* # Example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const a = await snaptrude.core.math.vec3.new(1, 0, 0)
|
|
71
|
+
* const b = await snaptrude.core.math.vec3.new(0, 1, 0)
|
|
72
|
+
* const perpendicular = await snaptrude.core.math.vec3.cross(a, b)
|
|
73
|
+
* ```
|
|
73
74
|
*/
|
|
74
|
-
cross(a:
|
|
75
|
+
abstract cross(a: Vec3Handle, b: Vec3Handle): PluginApiReturn<Vec3Handle>;
|
|
75
76
|
/**
|
|
76
|
-
* Compute the length (magnitude) of a vector.
|
|
77
|
+
* Compute the Euclidean length (magnitude) of a vector.
|
|
77
78
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
79
|
+
* # Example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const v = await snaptrude.core.math.vec3.new(3, 4, 0)
|
|
82
|
+
* const len = await snaptrude.core.math.vec3.length(v) // 5
|
|
83
|
+
* ```
|
|
80
84
|
*/
|
|
81
|
-
length(v:
|
|
85
|
+
abstract length(v: Vec3Handle): PluginApiReturn<number>;
|
|
82
86
|
/**
|
|
83
|
-
* Compute the squared length of a vector.
|
|
84
|
-
*
|
|
85
|
-
* Avoids the `sqrt` call — prefer this over {@linkcode PluginVec3Api.length}
|
|
86
|
-
* when comparing relative magnitudes.
|
|
87
|
+
* Compute the squared Euclidean length of a vector (avoids the sqrt).
|
|
87
88
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
89
|
+
* # Example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const v = await snaptrude.core.math.vec3.new(3, 4, 0)
|
|
92
|
+
* const sq = await snaptrude.core.math.vec3.lengthSquared(v) // 25
|
|
93
|
+
* ```
|
|
90
94
|
*/
|
|
91
|
-
lengthSquared(v:
|
|
95
|
+
abstract lengthSquared(v: Vec3Handle): PluginApiReturn<number>;
|
|
92
96
|
/**
|
|
93
|
-
*
|
|
97
|
+
* Return the unit vector in the same direction (the zero vector if length is 0).
|
|
94
98
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
99
|
+
* # Example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const v = await snaptrude.core.math.vec3.new(0, 0, 10)
|
|
102
|
+
* const unit = await snaptrude.core.math.vec3.normalize(v) // (0, 0, 1)
|
|
103
|
+
* ```
|
|
98
104
|
*/
|
|
99
|
-
normalize(v:
|
|
105
|
+
abstract normalize(v: Vec3Handle): PluginApiReturn<Vec3Handle>;
|
|
100
106
|
/**
|
|
101
|
-
*
|
|
107
|
+
* Measure the straight-line (Euclidean) distance between two points.
|
|
102
108
|
*
|
|
103
|
-
* @
|
|
104
|
-
* @
|
|
105
|
-
*
|
|
109
|
+
* @examplePrompt What is the distance between these two points?
|
|
110
|
+
* @examplePrompt Measure how far apart these two points are
|
|
111
|
+
*
|
|
112
|
+
* # Example
|
|
113
|
+
* ```ts
|
|
114
|
+
* const a = await snaptrude.core.math.vec3.new(0, 0, 0)
|
|
115
|
+
* const b = await snaptrude.core.math.vec3.new(3, 4, 0)
|
|
116
|
+
* const dist = await snaptrude.core.math.vec3.distance(a, b) // 5
|
|
117
|
+
* ```
|
|
106
118
|
*/
|
|
107
|
-
distance(a:
|
|
119
|
+
abstract distance(a: Vec3Handle, b: Vec3Handle): PluginApiReturn<number>;
|
|
108
120
|
/**
|
|
109
|
-
* Linearly interpolate between two vectors
|
|
121
|
+
* Linearly interpolate between two vectors: `a + (b - a) * t`.
|
|
110
122
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
123
|
+
* # Example
|
|
124
|
+
* ```ts
|
|
125
|
+
* const a = await snaptrude.core.math.vec3.new(0, 0, 0)
|
|
126
|
+
* const b = await snaptrude.core.math.vec3.new(10, 0, 0)
|
|
127
|
+
* const midpoint = await snaptrude.core.math.vec3.lerp(a, b, 0.5)
|
|
128
|
+
* ```
|
|
115
129
|
*/
|
|
116
|
-
lerp(a:
|
|
130
|
+
abstract lerp(a: Vec3Handle, b: Vec3Handle, t: number): PluginApiReturn<Vec3Handle>;
|
|
117
131
|
/**
|
|
118
|
-
* Negate a vector
|
|
132
|
+
* Negate a vector, reversing its direction.
|
|
119
133
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
134
|
+
* # Example
|
|
135
|
+
* ```ts
|
|
136
|
+
* const v = await snaptrude.core.math.vec3.new(1, -2, 3)
|
|
137
|
+
* const reversed = await snaptrude.core.math.vec3.negate(v) // (-1, 2, -3)
|
|
138
|
+
* ```
|
|
122
139
|
*/
|
|
123
|
-
negate(v:
|
|
140
|
+
abstract negate(v: Vec3Handle): PluginApiReturn<Vec3Handle>;
|
|
124
141
|
/**
|
|
125
|
-
*
|
|
142
|
+
* Test whether two vectors have exactly equal components.
|
|
126
143
|
*
|
|
127
|
-
*
|
|
144
|
+
* # Example
|
|
145
|
+
* ```ts
|
|
146
|
+
* const a = await snaptrude.core.math.vec3.new(1, 2, 3)
|
|
147
|
+
* const b = await snaptrude.core.math.vec3.new(1, 2, 3)
|
|
148
|
+
* const same = await snaptrude.core.math.vec3.equals(a, b) // true
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
abstract equals(a: Vec3Handle, b: Vec3Handle): PluginApiReturn<boolean>;
|
|
152
|
+
/**
|
|
153
|
+
* Test whether two vectors are equal within a tolerance `epsilon` (default `1e-6`).
|
|
128
154
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
155
|
+
* # Example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const a = await snaptrude.core.math.vec3.new(1, 2, 3)
|
|
158
|
+
* const b = await snaptrude.core.math.vec3.new(1.0004, 2, 3)
|
|
159
|
+
* const close = await snaptrude.core.math.vec3.equalsApprox(a, b, 1e-3) // true
|
|
160
|
+
* ```
|
|
132
161
|
*/
|
|
133
|
-
|
|
162
|
+
abstract equalsApprox(a: Vec3Handle, b: Vec3Handle, epsilon?: number): PluginApiReturn<boolean>;
|
|
134
163
|
/**
|
|
135
|
-
*
|
|
164
|
+
* Read the primitive `{ x, y, z }` components of a vector handle.
|
|
136
165
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
166
|
+
* # Example
|
|
167
|
+
* ```ts
|
|
168
|
+
* const v = await snaptrude.core.math.vec3.new(1, 2, 3)
|
|
169
|
+
* const { x, y, z } = await snaptrude.core.math.vec3.components(v)
|
|
170
|
+
* ```
|
|
141
171
|
*/
|
|
142
|
-
|
|
172
|
+
abstract components(v: Vec3Handle): PluginApiReturn<Vec3Components>;
|
|
143
173
|
}
|
|
144
|
-
/**
|
|
145
|
-
* A 3D vector with `x`, `y`, and `z` components.
|
|
146
|
-
*
|
|
147
|
-
* Used throughout the plugin API for positions, directions, displacements,
|
|
148
|
-
* and Euler rotation angles. Equivalent to `BABYLON.Vector3`.
|
|
149
|
-
*/
|
|
150
|
-
export declare const PVec3: z.ZodObject<{
|
|
151
|
-
x: z.ZodNumber;
|
|
152
|
-
y: z.ZodNumber;
|
|
153
|
-
z: z.ZodNumber;
|
|
154
|
-
}, z.core.$strip>;
|
|
155
|
-
export type PVec3 = z.infer<typeof PVec3>;
|
|
156
174
|
//# sourceMappingURL=vec3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vec3.d.ts","sourceRoot":"","sources":["../../../../src/api/core/math/vec3.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"vec3.d.ts","sourceRoot":"","sources":["../../../../src/api/core/math/vec3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE7D;;;;;;GAMG;AACH,8BAAsB,aAAa;;IAGjC;;;;;;;;OAQG;IACH,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,UAAU,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