@motionscript/math 0.1.0-alpha.5 → 0.1.0-alpha.7
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/CHANGELOG.md +28 -0
- package/README.md +39 -33
- package/dist/annotate/angle-mark.d.ts +77 -27
- package/dist/annotate/angle-mark.d.ts.map +1 -1
- package/dist/annotate/angle-mark.js +80 -115
- package/dist/annotate/angle-mark.js.map +1 -1
- package/dist/annotate/curly-brace.d.ts +94 -25
- package/dist/annotate/curly-brace.d.ts.map +1 -1
- package/dist/annotate/curly-brace.js +85 -100
- package/dist/annotate/curly-brace.js.map +1 -1
- package/dist/annotate/emphasis-mark.d.ts +69 -9
- package/dist/annotate/emphasis-mark.d.ts.map +1 -1
- package/dist/annotate/emphasis-mark.js +33 -34
- package/dist/annotate/emphasis-mark.js.map +1 -1
- package/dist/browser/chunks/chunk-ABYBW64J.js +2 -0
- package/dist/browser/chunks/chunk-ABYBW64J.js.map +7 -0
- package/dist/browser/chunks/chunk-K77KLQX4.js +2 -0
- package/dist/browser/chunks/chunk-K77KLQX4.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/tex.js +1 -1
- package/dist/browser/tex.js.map +2 -2
- package/dist/engine.d.ts +26 -19
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +17 -14
- package/dist/engine.js.map +1 -1
- package/dist/kit/component.d.ts +51 -0
- package/dist/kit/component.d.ts.map +1 -0
- package/dist/kit/component.js +30 -0
- package/dist/kit/component.js.map +1 -0
- package/dist/kit/curve.d.ts +22 -11
- package/dist/kit/curve.d.ts.map +1 -1
- package/dist/kit/curve.js +25 -18
- package/dist/kit/curve.js.map +1 -1
- package/dist/kit/field-mark.d.ts +56 -35
- package/dist/kit/field-mark.d.ts.map +1 -1
- package/dist/kit/field-mark.js +100 -120
- package/dist/kit/field-mark.js.map +1 -1
- package/dist/kit/follow.d.ts +67 -29
- package/dist/kit/follow.d.ts.map +1 -1
- package/dist/kit/follow.js +114 -110
- package/dist/kit/follow.js.map +1 -1
- package/dist/kit/furniture.d.ts +3 -1
- package/dist/kit/furniture.d.ts.map +1 -1
- package/dist/kit/furniture.js +5 -0
- package/dist/kit/furniture.js.map +1 -1
- package/dist/kit/graph.d.ts +46 -0
- package/dist/kit/graph.d.ts.map +1 -0
- package/dist/kit/graph.js +90 -0
- package/dist/kit/graph.js.map +1 -0
- package/dist/kit/mark.d.ts +64 -39
- package/dist/kit/mark.d.ts.map +1 -1
- package/dist/kit/mark.js +80 -96
- package/dist/kit/mark.js.map +1 -1
- package/dist/kit/place.d.ts +10 -8
- package/dist/kit/place.d.ts.map +1 -1
- package/dist/kit/place.js +28 -30
- package/dist/kit/place.js.map +1 -1
- package/dist/kit/system.d.ts +27 -29
- package/dist/kit/system.d.ts.map +1 -1
- package/dist/kit/system.js +62 -58
- package/dist/kit/system.js.map +1 -1
- package/dist/kit/withdrawn.d.ts +3 -3
- package/dist/kit/withdrawn.js +3 -3
- package/dist/kit/withdrawn.js.map +1 -1
- package/dist/marks/curve-area.d.ts +37 -18
- package/dist/marks/curve-area.d.ts.map +1 -1
- package/dist/marks/curve-area.js +50 -73
- package/dist/marks/curve-area.js.map +1 -1
- package/dist/marks/drop-lines.d.ts +45 -10
- package/dist/marks/drop-lines.d.ts.map +1 -1
- package/dist/marks/drop-lines.js +37 -52
- package/dist/marks/drop-lines.js.map +1 -1
- package/dist/marks/plot-point.d.ts +56 -20
- package/dist/marks/plot-point.d.ts.map +1 -1
- package/dist/marks/plot-point.js +65 -91
- package/dist/marks/plot-point.js.map +1 -1
- package/dist/marks/riemann-sum.d.ts +47 -26
- package/dist/marks/riemann-sum.d.ts.map +1 -1
- package/dist/marks/riemann-sum.js +57 -85
- package/dist/marks/riemann-sum.js.map +1 -1
- package/dist/marks/tangent-line.d.ts +58 -14
- package/dist/marks/tangent-line.d.ts.map +1 -1
- package/dist/marks/tangent-line.js +73 -87
- package/dist/marks/tangent-line.js.map +1 -1
- package/dist/marks/vector-arrow.d.ts +48 -20
- package/dist/marks/vector-arrow.d.ts.map +1 -1
- package/dist/marks/vector-arrow.js +58 -78
- package/dist/marks/vector-arrow.js.map +1 -1
- package/dist/nodes.d.ts +13 -5
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +0 -6
- package/dist/nodes.js.map +1 -1
- package/dist/plots/function-plot.d.ts +135 -43
- package/dist/plots/function-plot.d.ts.map +1 -1
- package/dist/plots/function-plot.js +146 -177
- package/dist/plots/function-plot.js.map +1 -1
- package/dist/plots/points-plot.d.ts +55 -19
- package/dist/plots/points-plot.d.ts.map +1 -1
- package/dist/plots/points-plot.js +31 -58
- package/dist/plots/points-plot.js.map +1 -1
- package/dist/plots/stream-lines.d.ts +60 -19
- package/dist/plots/stream-lines.d.ts.map +1 -1
- package/dist/plots/stream-lines.js +60 -79
- package/dist/plots/stream-lines.js.map +1 -1
- package/dist/plots/traced-path.d.ts +54 -15
- package/dist/plots/traced-path.d.ts.map +1 -1
- package/dist/plots/traced-path.js +33 -48
- package/dist/plots/traced-path.js.map +1 -1
- package/dist/plots/vector-field.d.ts +48 -11
- package/dist/plots/vector-field.d.ts.map +1 -1
- package/dist/plots/vector-field.js +50 -64
- package/dist/plots/vector-field.js.map +1 -1
- package/dist/structures/network-graph.d.ts +140 -49
- package/dist/structures/network-graph.d.ts.map +1 -1
- package/dist/structures/network-graph.js +168 -217
- package/dist/structures/network-graph.js.map +1 -1
- package/dist/structures/sample-space.d.ts +90 -38
- package/dist/structures/sample-space.d.ts.map +1 -1
- package/dist/structures/sample-space.js +132 -170
- package/dist/structures/sample-space.js.map +1 -1
- package/dist/systems/axes2d.d.ts +159 -37
- package/dist/systems/axes2d.d.ts.map +1 -1
- package/dist/systems/axes2d.js +147 -183
- package/dist/systems/axes2d.js.map +1 -1
- package/dist/systems/number-line.d.ts +80 -28
- package/dist/systems/number-line.d.ts.map +1 -1
- package/dist/systems/number-line.js +82 -118
- package/dist/systems/number-line.js.map +1 -1
- package/dist/systems/number-plane.d.ts +140 -31
- package/dist/systems/number-plane.d.ts.map +1 -1
- package/dist/systems/number-plane.js +142 -149
- package/dist/systems/number-plane.js.map +1 -1
- package/dist/systems/polar-plane.d.ts +76 -26
- package/dist/systems/polar-plane.d.ts.map +1 -1
- package/dist/systems/polar-plane.js +107 -133
- package/dist/systems/polar-plane.js.map +1 -1
- package/dist/tex/index.d.ts.map +1 -1
- package/dist/tex/index.js +1 -0
- package/dist/tex/index.js.map +1 -1
- package/dist/tex/matrix.d.ts +88 -18
- package/dist/tex/matrix.d.ts.map +1 -1
- package/dist/tex/matrix.js +33 -50
- package/dist/tex/matrix.js.map +1 -1
- package/dist/tex/node.d.ts +84 -201
- package/dist/tex/node.d.ts.map +1 -1
- package/dist/tex/node.js +23 -593
- package/dist/tex/node.js.map +1 -1
- package/dist/tex/typeset.d.ts +133 -0
- package/dist/tex/typeset.d.ts.map +1 -0
- package/dist/tex/typeset.js +403 -0
- package/dist/tex/typeset.js.map +1 -0
- package/dist/three/axes3d.d.ts +214 -54
- package/dist/three/axes3d.d.ts.map +1 -1
- package/dist/three/axes3d.js +163 -204
- package/dist/three/axes3d.js.map +1 -1
- package/dist/three/curve-plot3d.d.ts +108 -42
- package/dist/three/curve-plot3d.d.ts.map +1 -1
- package/dist/three/curve-plot3d.js +97 -132
- package/dist/three/curve-plot3d.js.map +1 -1
- package/dist/three/entries.d.ts +17 -0
- package/dist/three/entries.d.ts.map +1 -0
- package/dist/three/entries.js +15 -0
- package/dist/three/entries.js.map +1 -0
- package/dist/three/plot-point3d.d.ts +85 -12
- package/dist/three/plot-point3d.d.ts.map +1 -1
- package/dist/three/plot-point3d.js +27 -53
- package/dist/three/plot-point3d.js.map +1 -1
- package/dist/three/space.d.ts +17 -2
- package/dist/three/space.d.ts.map +1 -1
- package/dist/three/space.js +19 -8
- package/dist/three/space.js.map +1 -1
- package/dist/three/surface-plot3d.d.ts +176 -49
- package/dist/three/surface-plot3d.d.ts.map +1 -1
- package/dist/three/surface-plot3d.js +227 -261
- package/dist/three/surface-plot3d.js.map +1 -1
- package/dist/three/vector-arrow3d.d.ts +87 -16
- package/dist/three/vector-arrow3d.d.ts.map +1 -1
- package/dist/three/vector-arrow3d.js +48 -67
- package/dist/three/vector-arrow3d.js.map +1 -1
- package/package.json +4 -4
- package/src/annotate/angle-mark.ts +95 -105
- package/src/annotate/curly-brace.ts +107 -85
- package/src/annotate/emphasis-mark.ts +55 -26
- package/src/engine.ts +35 -21
- package/src/kit/component.ts +57 -0
- package/src/kit/curve.ts +38 -20
- package/src/kit/field-mark.ts +124 -108
- package/src/kit/follow.ts +146 -120
- package/src/kit/furniture.ts +6 -1
- package/src/kit/graph.ts +116 -0
- package/src/kit/mark.ts +135 -114
- package/src/kit/place.ts +32 -56
- package/src/kit/system.ts +77 -71
- package/src/kit/withdrawn.ts +3 -3
- package/src/marks/curve-area.ts +65 -65
- package/src/marks/drop-lines.ts +50 -42
- package/src/marks/plot-point.ts +77 -82
- package/src/marks/riemann-sum.ts +73 -72
- package/src/marks/tangent-line.ts +87 -71
- package/src/marks/vector-arrow.ts +73 -73
- package/src/nodes.ts +41 -5
- package/src/plots/function-plot.ts +155 -171
- package/src/plots/points-plot.ts +46 -50
- package/src/plots/stream-lines.ts +75 -66
- package/src/plots/traced-path.ts +51 -33
- package/src/plots/vector-field.ts +68 -49
- package/src/structures/network-graph.ts +168 -185
- package/src/structures/sample-space.ts +149 -148
- package/src/systems/axes2d.ts +165 -156
- package/src/systems/number-line.ts +91 -92
- package/src/systems/number-plane.ts +149 -120
- package/src/systems/polar-plane.ts +117 -116
- package/src/tex/index.ts +2 -1
- package/src/tex/matrix.ts +62 -40
- package/src/tex/node.ts +54 -621
- package/src/tex/typeset.ts +461 -0
- package/src/three/axes3d.ts +187 -160
- package/src/three/curve-plot3d.ts +107 -110
- package/src/three/entries.ts +42 -0
- package/src/three/plot-point3d.ts +42 -45
- package/src/three/space.ts +34 -9
- package/src/three/surface-plot3d.ts +312 -323
- package/src/three/vector-arrow3d.ts +65 -54
- package/dist/browser/chunks/chunk-3GJB6AVO.js +0 -2
- package/dist/browser/chunks/chunk-3GJB6AVO.js.map +0 -7
- package/dist/browser/chunks/chunk-D5WHCVBC.js +0 -2
- package/dist/browser/chunks/chunk-D5WHCVBC.js.map +0 -7
- package/dist/browser/chunks/chunk-WL4KEX7Y.js +0 -2
- package/dist/browser/chunks/chunk-WL4KEX7Y.js.map +0 -7
- package/src/kit/placement.ts +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Color, type Mesh3DProps, type NodeOf, type Blend3D as _Blend3D, type Faces3D as _Faces3D, type Fill3D as _Fill3D, type Geometry3D as _Geometry3D, type Material3D as _Material3D, type Node3D as _Node3D, type Node3DProps as _Node3DProps, type NormalizedColor as _NormalizedColor, type Shading3D as _Shading3D, type Texture3D as _Texture3D } from "@motionscript/sdk";
|
|
2
2
|
export interface PlotPoint3dProps extends Mesh3DProps {
|
|
3
3
|
radius?: number;
|
|
4
4
|
label?: string;
|
|
@@ -10,17 +10,90 @@ export interface PlotPoint3dProps extends Mesh3DProps {
|
|
|
10
10
|
* A dot at graph coordinates in a 3D graph, with an optional label. Put inside
|
|
11
11
|
* a surface it rides it: its `x` and `y` say where, and its height is the surface's.
|
|
12
12
|
*/
|
|
13
|
-
export declare
|
|
13
|
+
export declare const PlotPoint3d: import("@motionscript/sdk").Component<"plotPoint3d", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
14
14
|
/** In scene units, so a point is the same size whatever the axes show. */
|
|
15
|
-
radius: number
|
|
16
|
-
label: string
|
|
15
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
16
|
+
readonly label: import("@motionscript/sdk").Type<string, string, false>;
|
|
17
17
|
/** The height of the label's text, in scene units. */
|
|
18
|
-
labelSize: number
|
|
19
|
-
labelColor: Color
|
|
20
|
-
fontFamily: string
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
19
|
+
readonly labelColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
20
|
+
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
21
|
+
readonly opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
22
|
+
readonly blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
23
|
+
readonly fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
24
|
+
readonly faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
25
|
+
readonly wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
26
|
+
readonly vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
27
|
+
readonly alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
28
|
+
readonly aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
29
|
+
readonly normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
30
|
+
readonly envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
31
|
+
readonly geometry: import("@motionscript/sdk").Type<_Geometry3D | undefined, _Geometry3D | undefined, false>;
|
|
32
|
+
readonly material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
33
|
+
readonly roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
34
|
+
readonly metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
35
|
+
readonly emission: import("@motionscript/sdk").Type<Color | undefined, _NormalizedColor | undefined, false>;
|
|
36
|
+
readonly emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
37
|
+
readonly roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
38
|
+
readonly metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
39
|
+
readonly shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
40
|
+
readonly unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
41
|
+
}>, {}, null, _Node3D<_Node3DProps>, import("@motionscript/sdk").CallProps3D<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
42
|
+
/** In scene units, so a point is the same size whatever the axes show. */
|
|
43
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
44
|
+
readonly label: import("@motionscript/sdk").Type<string, string, false>;
|
|
45
|
+
/** The height of the label's text, in scene units. */
|
|
46
|
+
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
47
|
+
readonly labelColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
48
|
+
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
49
|
+
readonly opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
50
|
+
readonly blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
51
|
+
readonly fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
52
|
+
readonly faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
53
|
+
readonly wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
54
|
+
readonly vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
55
|
+
readonly alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
56
|
+
readonly aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
57
|
+
readonly normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
58
|
+
readonly envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
59
|
+
readonly geometry: import("@motionscript/sdk").Type<_Geometry3D | undefined, _Geometry3D | undefined, false>;
|
|
60
|
+
readonly material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
61
|
+
readonly roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
62
|
+
readonly metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
63
|
+
readonly emission: import("@motionscript/sdk").Type<Color | undefined, _NormalizedColor | undefined, false>;
|
|
64
|
+
readonly emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
65
|
+
readonly roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
66
|
+
readonly metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
67
|
+
readonly shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
68
|
+
readonly unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
69
|
+
}>, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
70
|
+
/** In scene units, so a point is the same size whatever the axes show. */
|
|
71
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
72
|
+
readonly label: import("@motionscript/sdk").Type<string, string, false>;
|
|
73
|
+
/** The height of the label's text, in scene units. */
|
|
74
|
+
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
75
|
+
readonly labelColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
76
|
+
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
77
|
+
readonly opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
78
|
+
readonly blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
79
|
+
readonly fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
80
|
+
readonly faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
81
|
+
readonly wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
82
|
+
readonly vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
83
|
+
readonly alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
84
|
+
readonly aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
85
|
+
readonly normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
86
|
+
readonly envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
87
|
+
readonly geometry: import("@motionscript/sdk").Type<_Geometry3D | undefined, _Geometry3D | undefined, false>;
|
|
88
|
+
readonly material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
89
|
+
readonly roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
90
|
+
readonly metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
91
|
+
readonly emission: import("@motionscript/sdk").Type<Color | undefined, _NormalizedColor | undefined, false>;
|
|
92
|
+
readonly emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
93
|
+
readonly roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
94
|
+
readonly metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
95
|
+
readonly shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
96
|
+
readonly unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
97
|
+
}>, {}, _Node3D<_Node3DProps>>>>;
|
|
98
|
+
export type PlotPoint3d = NodeOf<typeof PlotPoint3d>;
|
|
26
99
|
//# sourceMappingURL=plot-point3d.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot-point3d.d.ts","sourceRoot":"","sources":["../../src/three/plot-point3d.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"plot-point3d.d.ts","sourceRoot":"","sources":["../../src/three/plot-point3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,MAAM,EAEX,KAAK,OAAO,IAAI,QAAQ,EAExB,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,UAAU,IAAI,WAAW,EAC9B,KAAK,UAAU,IAAI,WAAW,EAC9B,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,eAAe,IAAI,gBAAgB,EACxC,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,SAAS,IAAI,UAAU,EAC/B,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW;IAIhB,0EAA0E;;;IAG1E,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;IAHtD,0EAA0E;;;IAG1E,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;IAHtD,0EAA0E;;;IAG1E,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;gCAiB5D,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -1,60 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { colorProperty, Geo, Mesh3D, node, property, } from "@motionscript/sdk";
|
|
1
|
+
import { component3d, Geo, Material, Types, } from "@motionscript/sdk";
|
|
2
|
+
import { meshEntries } from "./entries.js";
|
|
8
3
|
import { drawLabel3D } from "./label3d.js";
|
|
9
4
|
/**
|
|
10
5
|
* A dot at graph coordinates in a 3D graph, with an optional label. Put inside
|
|
11
6
|
* a surface it rides it: its `x` and `y` say where, and its height is the surface's.
|
|
12
7
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
export const PlotPoint3d = component3d({
|
|
9
|
+
key: "plotPoint3d",
|
|
10
|
+
state: {
|
|
11
|
+
...meshEntries,
|
|
12
|
+
/** In scene units, so a point is the same size whatever the axes show. */
|
|
13
|
+
radius: Types.number(0.1, { min: 0, step: 0.01 }),
|
|
14
|
+
label: Types.text("", { animatable: false }),
|
|
15
|
+
/** The height of the label's text, in scene units. */
|
|
16
|
+
labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),
|
|
17
|
+
labelColor: Types.color("#e5e7eb"),
|
|
18
|
+
fontFamily: Types.text("", { animatable: false }),
|
|
19
|
+
},
|
|
20
|
+
load: (loader, s) => {
|
|
21
|
+
if (s.fontFamily !== "")
|
|
22
|
+
loader.font(s.fontFamily);
|
|
23
|
+
},
|
|
24
|
+
render: (ctx, s) => {
|
|
25
|
+
const g3 = Material.mesh(s, s.radius > 0 ? Geo.sphere({ radius: s.radius, segments: [24, 16] }) : undefined);
|
|
26
|
+
drawLabel3D(g3, s.label, { x: 0, y: s.radius + s.labelSize * 0.85, z: 0 }, {
|
|
27
|
+
size: s.labelSize,
|
|
28
|
+
color: s.labelColor,
|
|
29
|
+
fontFamily: s.fontFamily,
|
|
31
30
|
});
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
__decorate([
|
|
36
|
-
property({ default: 0.1, min: 0, step: 0.01 })
|
|
37
|
-
], PlotPoint3d.prototype, "radius", void 0);
|
|
38
|
-
__decorate([
|
|
39
|
-
property({ default: "", animatable: false })
|
|
40
|
-
], PlotPoint3d.prototype, "label", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
property({ default: 0.26, min: 0.01, step: 0.01 })
|
|
43
|
-
], PlotPoint3d.prototype, "labelSize", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
colorProperty({ default: "#e5e7eb" })
|
|
46
|
-
], PlotPoint3d.prototype, "labelColor", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
property({ default: "", animatable: false })
|
|
49
|
-
], PlotPoint3d.prototype, "fontFamily", void 0);
|
|
50
|
-
PlotPoint3d = __decorate([
|
|
51
|
-
node({
|
|
52
|
-
key: "plotPoint3d",
|
|
53
|
-
within: ["axes3d", "surfacePlot3d"],
|
|
54
|
-
forkable: true,
|
|
55
|
-
layout: { acceptsChildren: false },
|
|
56
|
-
seed: { fill: "#facc15" },
|
|
57
|
-
})
|
|
58
|
-
], PlotPoint3d);
|
|
59
|
-
export { PlotPoint3d };
|
|
31
|
+
ctx.draw(g3);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
60
34
|
//# sourceMappingURL=plot-point3d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot-point3d.js","sourceRoot":"","sources":["../../src/three/plot-point3d.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plot-point3d.js","sourceRoot":"","sources":["../../src/three/plot-point3d.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,GAAG,EACH,QAAQ,EACR,KAAK,GAgBR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAUxC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;IACnC,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE;QACH,GAAG,WAAW;QACd,0EAA0E;QAC1E,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACjD,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;QAC5C,sDAAsD;QACtD,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACxD,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;QAClC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;KACpD;IACD,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAChB,IAAI,CAAC,CAAC,UAAU,KAAK,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACf,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC7G,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,SAAS,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;YACvE,IAAI,EAAE,CAAC,CAAC,SAAS;YACjB,KAAK,EAAE,CAAC,CAAC,UAAU;YACnB,UAAU,EAAE,CAAC,CAAC,UAAU;SAC3B,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import {\r\n component3d,\r\n Geo,\r\n Material,\r\n Types,\r\n type Color,\r\n type Mesh3DProps,\r\n type NodeOf,\r\n // Named so the emitted declaration reaches these through the sdk, not core.\r\n type Blend3D as _Blend3D,\r\n type Color as _Color,\r\n type Faces3D as _Faces3D,\r\n type Fill3D as _Fill3D,\r\n type Geometry3D as _Geometry3D,\r\n type Material3D as _Material3D,\r\n type Node3D as _Node3D,\r\n type Node3DProps as _Node3DProps,\r\n type NormalizedColor as _NormalizedColor,\r\n type Shading3D as _Shading3D,\r\n type Texture3D as _Texture3D,\r\n} from \"@motionscript/sdk\";\r\nimport { meshEntries } from \"./entries\";\r\nimport { drawLabel3D } from \"./label3d\";\r\n\r\nexport interface PlotPoint3dProps extends Mesh3DProps {\r\n radius?: number;\r\n label?: string;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\n/**\r\n * A dot at graph coordinates in a 3D graph, with an optional label. Put inside\r\n * a surface it rides it: its `x` and `y` say where, and its height is the surface's.\r\n */\r\nexport const PlotPoint3d = component3d({\r\n key: \"plotPoint3d\",\r\n state: {\r\n ...meshEntries,\r\n /** In scene units, so a point is the same size whatever the axes show. */\r\n radius: Types.number(0.1, { min: 0, step: 0.01 }),\r\n label: Types.text(\"\", { animatable: false }),\r\n /** The height of the label's text, in scene units. */\r\n labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),\r\n labelColor: Types.color(\"#e5e7eb\"),\r\n fontFamily: Types.text(\"\", { animatable: false }),\r\n },\r\n load: (loader, s) => {\r\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\r\n },\r\n render: (ctx, s) => {\r\n const g3 = Material.mesh(s, s.radius > 0 ? Geo.sphere({ radius: s.radius, segments: [24, 16] }) : undefined);\r\n drawLabel3D(g3, s.label, { x: 0, y: s.radius + s.labelSize * 0.85, z: 0 }, {\r\n size: s.labelSize,\r\n color: s.labelColor,\r\n fontFamily: s.fontFamily,\r\n });\r\n ctx.draw(g3);\r\n },\r\n});\r\n\r\nexport type PlotPoint3d = NodeOf<typeof PlotPoint3d>;\r\n"]}
|
package/dist/three/space.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node3D, type
|
|
1
|
+
import { type ChildSpace3D, type Node3D, type Type, type Vector3, type Context as _Context } from "@motionscript/sdk";
|
|
2
2
|
import type { Interval } from "../kit/coords.js";
|
|
3
3
|
/**
|
|
4
4
|
* A 3D graph's coordinates, as its axes' local space sees them. A graph is
|
|
@@ -16,7 +16,22 @@ export interface GraphSpace extends ChildSpace3D {
|
|
|
16
16
|
}
|
|
17
17
|
/** The space of a box `lengths` on a side, in scene units, showing the three ranges, centred on its node. */
|
|
18
18
|
export declare function graphSpace(xRange: Interval, yRange: Interval, zRange: Interval, lengths: Vector3): GraphSpace;
|
|
19
|
-
/**
|
|
19
|
+
/** A 3D graph, as the marks inside it see it: its coordinates as they stand now. */
|
|
20
|
+
export interface Graph3D {
|
|
21
|
+
space(): GraphSpace;
|
|
22
|
+
}
|
|
23
|
+
/** The graph a mark is inside: `axes3d` provides itself to everything in it. */
|
|
24
|
+
export declare const GRAPH_3D: _Context<Graph3D | null>;
|
|
25
|
+
/**
|
|
26
|
+
* The entry a mark reads the graph it is drawn in through, set from the nearest
|
|
27
|
+
* `axes3d` above it, through any 3D node between; `null` outside one.
|
|
28
|
+
*/
|
|
29
|
+
export declare function graphEntry(): Type<Graph3D | null, Graph3D | null, true>;
|
|
30
|
+
/** The graph space a mark with a {@link graphEntry} is drawn in, or `null` outside a graph. */
|
|
31
|
+
export declare function graphOf(mark: {
|
|
32
|
+
readonly graph: Graph3D | null;
|
|
33
|
+
}): GraphSpace | null;
|
|
34
|
+
/** The graph a 3D node is drawn in: what the nearest `axes3d` above it provides, once it is in the tree. */
|
|
20
35
|
export declare function spaceOf(mark: Node3D): GraphSpace | null;
|
|
21
36
|
/** A unit quaternion turning the scene's +y, the way a cylinder or a cone points, onto `direction`. */
|
|
22
37
|
export declare function aim(direction: Vector3): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/three/space.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/three/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,OAAO,EAEZ,KAAK,OAAO,IAAI,QAAQ,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC5C,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wGAAwG;IACxG,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACpD;AAED,6GAA6G;AAC7G,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,CAe7G;AAOD,oFAAoF;AACpF,MAAM,WAAW,OAAO;IACpB,KAAK,IAAI,UAAU,CAAC;CACvB;AAED,gFAAgF;AAChF,eAAO,MAAM,QAAQ,0BAAsD,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,IAAI,CAAC,CAKvE;AAED,+FAA+F;AAC/F,wBAAgB,OAAO,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,GAAG,UAAU,GAAG,IAAI,CAEnF;AAED,4GAA4G;AAC5G,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAEvD;AAED,uGAAuG;AACvG,wBAAgB,GAAG,CAAC,SAAS,EAAE,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAWtF"}
|
package/dist/three/space.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createContext, Types, } from "@motionscript/sdk";
|
|
2
2
|
/** The space of a box `lengths` on a side, in scene units, showing the three ranges, centred on its node. */
|
|
3
3
|
export function graphSpace(xRange, yRange, zRange, lengths) {
|
|
4
4
|
const ux = unit(xRange, lengths.x);
|
|
@@ -20,14 +20,25 @@ function unit([min, max], length) {
|
|
|
20
20
|
const span = max - min;
|
|
21
21
|
return span > 0 ? length / span : 0;
|
|
22
22
|
}
|
|
23
|
-
/** The graph a
|
|
23
|
+
/** The graph a mark is inside: `axes3d` provides itself to everything in it. */
|
|
24
|
+
export const GRAPH_3D = createContext(null, "math:graph3d");
|
|
25
|
+
/**
|
|
26
|
+
* The entry a mark reads the graph it is drawn in through, set from the nearest
|
|
27
|
+
* `axes3d` above it, through any 3D node between; `null` outside one.
|
|
28
|
+
*/
|
|
29
|
+
export function graphEntry() {
|
|
30
|
+
return Types.custom(null, {
|
|
31
|
+
private: true,
|
|
32
|
+
inherit: (use) => use(GRAPH_3D),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** The graph space a mark with a {@link graphEntry} is drawn in, or `null` outside a graph. */
|
|
36
|
+
export function graphOf(mark) {
|
|
37
|
+
return mark.graph?.space() ?? null;
|
|
38
|
+
}
|
|
39
|
+
/** The graph a 3D node is drawn in: what the nearest `axes3d` above it provides, once it is in the tree. */
|
|
24
40
|
export function spaceOf(mark) {
|
|
25
|
-
|
|
26
|
-
const spaced = at;
|
|
27
|
-
if (typeof spaced._graphSpace === "function")
|
|
28
|
-
return spaced._graphSpace();
|
|
29
|
-
}
|
|
30
|
-
return null;
|
|
41
|
+
return mark.useContext(GRAPH_3D)?.space() ?? null;
|
|
31
42
|
}
|
|
32
43
|
/** A unit quaternion turning the scene's +y, the way a cylinder or a cone points, onto `direction`. */
|
|
33
44
|
export function aim(direction) {
|
package/dist/three/space.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.js","sourceRoot":"","sources":["../../src/three/space.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"space.js","sourceRoot":"","sources":["../../src/three/space.ts"],"names":[],"mappings":"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","sourcesContent":["import {\r\n createContext,\r\n Types,\r\n type ChildSpace3D,\r\n type Node3D,\r\n type Type,\r\n type Vector3,\r\n // Named so the emitted declaration reaches these through the sdk, not core.\r\n type Context as _Context,\r\n} from \"@motionscript/sdk\";\r\nimport type { Interval } from \"../kit/coords\";\r\n\r\n/**\r\n * A 3D graph's coordinates, as its axes' local space sees them. A graph is\r\n * right-handed with z up, and the scene has y up, so graph x, y and z run along\r\n * the scene's z, x and y: looked at head-on, y is to the right and z is up.\r\n */\r\nexport interface GraphSpace extends ChildSpace3D {\r\n readonly xRange: Interval;\r\n readonly yRange: Interval;\r\n readonly zRange: Interval;\r\n /** Changes exactly when the mapping does: what a mark's geometry is cached under. */\r\n readonly revision: string;\r\n /** A step from one graph point to another, as the local one: what a mark's own geometry is drawn in. */\r\n offset(x: number, y: number, z: number): Vector3;\r\n}\r\n\r\n/** The space of a box `lengths` on a side, in scene units, showing the three ranges, centred on its node. */\r\nexport function graphSpace(xRange: Interval, yRange: Interval, zRange: Interval, lengths: Vector3): GraphSpace {\r\n const ux = unit(xRange, lengths.x);\r\n const uy = unit(yRange, lengths.y);\r\n const uz = unit(zRange, lengths.z);\r\n const cx = (xRange[0] + xRange[1]) / 2;\r\n const cy = (yRange[0] + yRange[1]) / 2;\r\n const cz = (zRange[0] + zRange[1]) / 2;\r\n return {\r\n xRange,\r\n yRange,\r\n zRange,\r\n revision: [xRange, yRange, zRange, lengths.x, lengths.y, lengths.z].join(\"|\"),\r\n toLocal: (x, y, z) => ({ x: (y - cy) * uy, y: (z - cz) * uz, z: (x - cx) * ux }),\r\n offset: (x, y, z) => ({ x: y * uy, y: z * uz, z: x * ux }),\r\n };\r\n}\r\n\r\nfunction unit([min, max]: Interval, length: number): number {\r\n const span = max - min;\r\n return span > 0 ? length / span : 0;\r\n}\r\n\r\n/** A 3D graph, as the marks inside it see it: its coordinates as they stand now. */\r\nexport interface Graph3D {\r\n space(): GraphSpace;\r\n}\r\n\r\n/** The graph a mark is inside: `axes3d` provides itself to everything in it. */\r\nexport const GRAPH_3D = createContext<Graph3D | null>(null, \"math:graph3d\");\r\n\r\n/**\r\n * The entry a mark reads the graph it is drawn in through, set from the nearest\r\n * `axes3d` above it, through any 3D node between; `null` outside one.\r\n */\r\nexport function graphEntry(): Type<Graph3D | null, Graph3D | null, true> {\r\n return Types.custom<Graph3D | null, Graph3D | null, { readonly private: true }>(null, {\r\n private: true,\r\n inherit: (use) => use(GRAPH_3D),\r\n });\r\n}\r\n\r\n/** The graph space a mark with a {@link graphEntry} is drawn in, or `null` outside a graph. */\r\nexport function graphOf(mark: { readonly graph: Graph3D | null }): GraphSpace | null {\r\n return mark.graph?.space() ?? null;\r\n}\r\n\r\n/** The graph a 3D node is drawn in: what the nearest `axes3d` above it provides, once it is in the tree. */\r\nexport function spaceOf(mark: Node3D): GraphSpace | null {\r\n return mark.useContext(GRAPH_3D)?.space() ?? null;\r\n}\r\n\r\n/** A unit quaternion turning the scene's +y, the way a cylinder or a cone points, onto `direction`. */\r\nexport function aim(direction: Vector3): { x: number; y: number; z: number; w: number } {\r\n const length = Math.hypot(direction.x, direction.y, direction.z);\r\n if (!(length > 0)) return { x: 0, y: 0, z: 0, w: 1 };\r\n const dx = direction.x / length;\r\n const dy = direction.y / length;\r\n const dz = direction.z / length;\r\n // Straight down is the one turn with no single axis: any in the ground plane will do.\r\n if (dy < -1 + 1e-9) return { x: 1, y: 0, z: 0, w: 0 };\r\n const w = 1 + dy;\r\n const norm = Math.hypot(dz, dx, w);\r\n return { x: dz / norm, y: 0, z: -dx / norm, w: w / norm };\r\n}\r\n"]}
|