@motionscript/math 0.1.0 → 0.1.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/annotate/angle-mark.d.ts +4 -14
- package/dist/annotate/angle-mark.d.ts.map +1 -1
- package/dist/annotate/angle-mark.js +2 -1
- package/dist/annotate/angle-mark.js.map +1 -1
- package/dist/annotate/curly-brace.d.ts +4 -16
- package/dist/annotate/curly-brace.d.ts.map +1 -1
- package/dist/annotate/curly-brace.js.map +1 -1
- package/dist/annotate/emphasis-mark.d.ts +0 -5
- package/dist/annotate/emphasis-mark.d.ts.map +1 -1
- package/dist/annotate/emphasis-mark.js.map +1 -1
- package/dist/browser/chunks/chunk-FZ2YBTPL.js +2 -0
- package/dist/browser/chunks/chunk-FZ2YBTPL.js.map +7 -0
- package/dist/browser/chunks/chunk-T42HWKBC.js +2 -0
- package/dist/browser/chunks/chunk-T42HWKBC.js.map +7 -0
- package/dist/browser/chunks/{mathjax-WV55AC2P.js → mathjax-SOM6RSPV.js} +1 -1
- package/dist/browser/chunks/{mathjax-WV55AC2P.js.map → mathjax-SOM6RSPV.js.map} +2 -2
- 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/engine.d.ts +3 -4
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +3 -4
- package/dist/engine.js.map +1 -1
- package/dist/kit/cache.d.ts +10 -21
- package/dist/kit/cache.d.ts.map +1 -1
- package/dist/kit/cache.js +33 -24
- package/dist/kit/cache.js.map +1 -1
- package/dist/kit/component.d.ts +5 -14
- package/dist/kit/component.d.ts.map +1 -1
- package/dist/kit/component.js +1 -8
- package/dist/kit/component.js.map +1 -1
- package/dist/kit/coords.d.ts +1 -1
- package/dist/kit/coords.d.ts.map +1 -1
- package/dist/kit/coords.js +2 -1
- package/dist/kit/coords.js.map +1 -1
- package/dist/kit/curve.d.ts +1 -5
- package/dist/kit/curve.d.ts.map +1 -1
- package/dist/kit/curve.js.map +1 -1
- package/dist/kit/equation.d.ts +10 -30
- package/dist/kit/equation.d.ts.map +1 -1
- package/dist/kit/equation.js +9 -44
- package/dist/kit/equation.js.map +1 -1
- package/dist/kit/equation3d.d.ts +3 -3
- package/dist/kit/equation3d.d.ts.map +1 -1
- package/dist/kit/equation3d.js +27 -59
- package/dist/kit/equation3d.js.map +1 -1
- package/dist/kit/expression.d.ts +7 -7
- package/dist/kit/expression.d.ts.map +1 -1
- package/dist/kit/expression.js +18 -17
- package/dist/kit/expression.js.map +1 -1
- package/dist/kit/field-mark.d.ts +0 -7
- package/dist/kit/field-mark.d.ts.map +1 -1
- package/dist/kit/field-mark.js.map +1 -1
- package/dist/kit/field.d.ts +2 -2
- package/dist/kit/field.d.ts.map +1 -1
- package/dist/kit/field.js +11 -31
- package/dist/kit/field.js.map +1 -1
- package/dist/kit/follow.d.ts +3 -10
- package/dist/kit/follow.d.ts.map +1 -1
- package/dist/kit/follow.js +5 -11
- package/dist/kit/follow.js.map +1 -1
- package/dist/kit/furniture.d.ts +2 -1
- package/dist/kit/furniture.d.ts.map +1 -1
- package/dist/kit/furniture.js +6 -3
- package/dist/kit/furniture.js.map +1 -1
- package/dist/kit/geometry.d.ts +1 -0
- package/dist/kit/geometry.d.ts.map +1 -1
- package/dist/kit/geometry.js +3 -0
- package/dist/kit/geometry.js.map +1 -1
- package/dist/kit/mark.d.ts +4 -10
- package/dist/kit/mark.d.ts.map +1 -1
- package/dist/kit/mark.js.map +1 -1
- package/dist/kit/place.d.ts +3 -5
- package/dist/kit/place.d.ts.map +1 -1
- package/dist/kit/place.js +3 -5
- package/dist/kit/place.js.map +1 -1
- package/dist/kit/sampler.d.ts +0 -5
- package/dist/kit/sampler.d.ts.map +1 -1
- package/dist/kit/sampler.js.map +1 -1
- package/dist/kit/system.d.ts +0 -1
- package/dist/kit/system.d.ts.map +1 -1
- package/dist/kit/system.js +3 -10
- package/dist/kit/system.js.map +1 -1
- package/dist/marks/curve-area.d.ts +2 -12
- package/dist/marks/curve-area.d.ts.map +1 -1
- package/dist/marks/curve-area.js +4 -9
- package/dist/marks/curve-area.js.map +1 -1
- package/dist/marks/drop-lines.d.ts +1 -5
- package/dist/marks/drop-lines.d.ts.map +1 -1
- package/dist/marks/drop-lines.js.map +1 -1
- package/dist/marks/plot-point.d.ts +4 -13
- package/dist/marks/plot-point.d.ts.map +1 -1
- package/dist/marks/plot-point.js.map +1 -1
- package/dist/marks/riemann-sum.d.ts +1 -7
- package/dist/marks/riemann-sum.d.ts.map +1 -1
- package/dist/marks/riemann-sum.js +2 -2
- package/dist/marks/riemann-sum.js.map +1 -1
- package/dist/marks/tangent-line.d.ts +2 -12
- package/dist/marks/tangent-line.d.ts.map +1 -1
- package/dist/marks/tangent-line.js +1 -5
- package/dist/marks/tangent-line.js.map +1 -1
- package/dist/marks/vector-arrow.d.ts +2 -11
- package/dist/marks/vector-arrow.d.ts.map +1 -1
- package/dist/marks/vector-arrow.js +3 -6
- package/dist/marks/vector-arrow.js.map +1 -1
- package/dist/nodes.d.ts +1 -12
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js.map +1 -1
- package/dist/plots/function-plot.d.ts +1 -6
- package/dist/plots/function-plot.d.ts.map +1 -1
- package/dist/plots/function-plot.js +1 -5
- package/dist/plots/function-plot.js.map +1 -1
- package/dist/plots/points-plot.d.ts +1 -6
- package/dist/plots/points-plot.d.ts.map +1 -1
- package/dist/plots/points-plot.js.map +1 -1
- package/dist/plots/stream-lines.d.ts +0 -7
- package/dist/plots/stream-lines.d.ts.map +1 -1
- package/dist/plots/stream-lines.js.map +1 -1
- package/dist/plots/traced-path.d.ts +1 -12
- package/dist/plots/traced-path.d.ts.map +1 -1
- package/dist/plots/traced-path.js +1 -6
- package/dist/plots/traced-path.js.map +1 -1
- package/dist/plots/vector-field.d.ts +1 -10
- package/dist/plots/vector-field.d.ts.map +1 -1
- package/dist/plots/vector-field.js +3 -6
- package/dist/plots/vector-field.js.map +1 -1
- package/dist/structures/network-graph.d.ts +15 -34
- package/dist/structures/network-graph.d.ts.map +1 -1
- package/dist/structures/network-graph.js +2 -5
- package/dist/structures/network-graph.js.map +1 -1
- package/dist/structures/sample-space.d.ts +8 -22
- package/dist/structures/sample-space.d.ts.map +1 -1
- package/dist/structures/sample-space.js +3 -5
- package/dist/structures/sample-space.js.map +1 -1
- package/dist/systems/axes2d.d.ts +0 -1
- package/dist/systems/axes2d.d.ts.map +1 -1
- package/dist/systems/axes2d.js +3 -4
- package/dist/systems/axes2d.js.map +1 -1
- package/dist/systems/number-line.d.ts +7 -22
- package/dist/systems/number-line.d.ts.map +1 -1
- package/dist/systems/number-line.js +2 -2
- package/dist/systems/number-line.js.map +1 -1
- package/dist/systems/number-plane.d.ts +12 -27
- package/dist/systems/number-plane.d.ts.map +1 -1
- package/dist/systems/number-plane.js +1 -7
- package/dist/systems/number-plane.js.map +1 -1
- package/dist/systems/polar-plane.d.ts +11 -26
- package/dist/systems/polar-plane.d.ts.map +1 -1
- package/dist/systems/polar-plane.js +7 -10
- package/dist/systems/polar-plane.js.map +1 -1
- package/dist/tex/geometry.d.ts +5 -24
- package/dist/tex/geometry.d.ts.map +1 -1
- package/dist/tex/geometry.js +19 -90
- package/dist/tex/geometry.js.map +1 -1
- package/dist/tex/mathjax.d.ts +0 -13
- package/dist/tex/mathjax.d.ts.map +1 -1
- package/dist/tex/mathjax.js +4 -24
- package/dist/tex/mathjax.js.map +1 -1
- package/dist/tex/matrix.d.ts +1 -10
- package/dist/tex/matrix.d.ts.map +1 -1
- package/dist/tex/matrix.js +1 -5
- package/dist/tex/matrix.js.map +1 -1
- package/dist/tex/tween.d.ts +9 -30
- package/dist/tex/tween.d.ts.map +1 -1
- package/dist/tex/tween.js +19 -67
- package/dist/tex/tween.js.map +1 -1
- package/dist/tex/typeset.d.ts +2 -23
- package/dist/tex/typeset.d.ts.map +1 -1
- package/dist/tex/typeset.js +4 -30
- package/dist/tex/typeset.js.map +1 -1
- package/dist/three/axes3d.d.ts +32 -62
- package/dist/three/axes3d.d.ts.map +1 -1
- package/dist/three/axes3d.js +5 -13
- package/dist/three/axes3d.js.map +1 -1
- package/dist/three/curve-plot3d.d.ts +4 -15
- package/dist/three/curve-plot3d.d.ts.map +1 -1
- package/dist/three/curve-plot3d.js.map +1 -1
- package/dist/three/plot-point3d.d.ts +7 -14
- package/dist/three/plot-point3d.d.ts.map +1 -1
- package/dist/three/plot-point3d.js.map +1 -1
- package/dist/three/space.d.ts +3 -8
- package/dist/three/space.d.ts.map +1 -1
- package/dist/three/space.js +1 -8
- package/dist/three/space.js.map +1 -1
- package/dist/three/surface-plot3d.d.ts +9 -23
- package/dist/three/surface-plot3d.d.ts.map +1 -1
- package/dist/three/surface-plot3d.js.map +1 -1
- package/dist/three/vector-arrow3d.d.ts +1 -7
- package/dist/three/vector-arrow3d.d.ts.map +1 -1
- package/dist/three/vector-arrow3d.js.map +1 -1
- package/package.json +4 -4
- package/src/annotate/angle-mark.ts +4 -14
- package/src/annotate/curly-brace.ts +2 -14
- package/src/annotate/emphasis-mark.ts +1 -6
- package/src/engine.ts +3 -4
- package/src/kit/cache.ts +33 -25
- package/src/kit/component.ts +5 -19
- package/src/kit/coords.ts +2 -2
- package/src/kit/curve.ts +1 -5
- package/src/kit/equation.ts +12 -50
- package/src/kit/equation3d.ts +23 -59
- package/src/kit/expression.ts +18 -23
- package/src/kit/field-mark.ts +1 -7
- package/src/kit/field.ts +10 -26
- package/src/kit/follow.ts +5 -13
- package/src/kit/furniture.ts +7 -4
- package/src/kit/geometry.ts +4 -0
- package/src/kit/mark.ts +4 -11
- package/src/kit/place.ts +3 -5
- package/src/kit/sampler.ts +0 -6
- package/src/kit/system.ts +3 -12
- package/src/marks/curve-area.ts +3 -16
- package/src/marks/drop-lines.ts +0 -6
- package/src/marks/plot-point.ts +2 -12
- package/src/marks/riemann-sum.ts +2 -10
- package/src/marks/tangent-line.ts +1 -13
- package/src/marks/vector-arrow.ts +3 -13
- package/src/nodes.ts +1 -12
- package/src/plots/function-plot.ts +1 -6
- package/src/plots/points-plot.ts +0 -7
- package/src/plots/stream-lines.ts +1 -8
- package/src/plots/traced-path.ts +2 -13
- package/src/plots/vector-field.ts +4 -12
- package/src/structures/network-graph.ts +6 -25
- package/src/structures/sample-space.ts +5 -20
- package/src/systems/axes2d.ts +3 -6
- package/src/systems/number-line.ts +4 -20
- package/src/systems/number-plane.ts +4 -19
- package/src/systems/polar-plane.ts +11 -25
- package/src/tex/geometry.ts +24 -126
- package/src/tex/mathjax.ts +4 -26
- package/src/tex/matrix.ts +1 -11
- package/src/tex/tween.ts +21 -75
- package/src/tex/typeset.ts +4 -37
- package/src/three/axes3d.ts +7 -42
- package/src/three/curve-plot3d.ts +0 -12
- package/src/three/plot-point3d.ts +0 -10
- package/src/three/space.ts +2 -11
- package/src/three/surface-plot3d.ts +0 -15
- package/src/three/vector-arrow3d.ts +0 -8
- package/dist/browser/chunks/chunk-IRZCG6PM.js +0 -2
- package/dist/browser/chunks/chunk-IRZCG6PM.js.map +0 -7
- package/dist/browser/chunks/chunk-WMVW6ZIV.js +0 -2
- package/dist/browser/chunks/chunk-WMVW6ZIV.js.map +0 -7
- package/dist/kit/withdrawn.d.ts +0 -9
- package/dist/kit/withdrawn.d.ts.map +0 -1
- package/dist/kit/withdrawn.js +0 -9
- package/dist/kit/withdrawn.js.map +0 -1
- package/src/kit/withdrawn.ts +0 -8
package/dist/three/axes3d.d.ts
CHANGED
|
@@ -1,36 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type NodeOf, type Alignment as _Alignment, type CornerRadiusResolved as _CornerRadiusResolved, type CornerStyleResolved as _CornerStyleResolved, type Fill as _Fill, type FillResolved as _FillResolved, type FlowMode as _FlowMode, type FlowResolved as _FlowResolved, type GapSize as _GapSize, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type Color as _Color, type NormalizedColor as _NormalizedColor, type PostEffect3D as _PostEffect3D, type RectCornerRadius as _RectCornerRadius, type RectCornerStyle as _RectCornerStyle, type Shadow as _Shadow, type ShadowResolved as _ShadowResolved, type Shadows3D as _Shadows3D, type Stroke as _Stroke, type StrokeResolved as _StrokeResolved, type ToneMapping3D as _ToneMapping3D, type Vector2 as _Vector2 } from "@motionscript/sdk";
|
|
2
2
|
import type { Interval } from "../kit/coords.js";
|
|
3
|
-
|
|
4
|
-
xRange?: Interval;
|
|
5
|
-
yRange?: Interval;
|
|
6
|
-
zRange?: Interval;
|
|
7
|
-
xLength?: number;
|
|
8
|
-
yLength?: number;
|
|
9
|
-
zLength?: number;
|
|
10
|
-
xStep?: number;
|
|
11
|
-
yStep?: number;
|
|
12
|
-
zStep?: number;
|
|
13
|
-
color?: Color;
|
|
14
|
-
thickness?: number;
|
|
15
|
-
tips?: boolean;
|
|
16
|
-
ticks?: boolean;
|
|
17
|
-
tickSize?: number;
|
|
18
|
-
grid?: boolean;
|
|
19
|
-
gridLineColor?: Color;
|
|
20
|
-
labels?: boolean;
|
|
21
|
-
labelSize?: number;
|
|
22
|
-
labelColor?: Color;
|
|
23
|
-
fontFamily?: string;
|
|
24
|
-
xLabel?: string;
|
|
25
|
-
yLabel?: string;
|
|
26
|
-
zLabel?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* A 3D graph: three axes through a box of graph coordinates, z up, seen through
|
|
30
|
-
* a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`
|
|
31
|
-
* does. Its 3D children sit in its graph coordinates: a surface, a space curve,
|
|
32
|
-
* a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.
|
|
33
|
-
*/
|
|
3
|
+
/** A 3D graph: three axes through a box of graph coordinates, z up, seen through its own camera. Its 3D children sit in graph coordinates. */
|
|
34
4
|
export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
35
5
|
readonly xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
36
6
|
readonly yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
@@ -41,16 +11,16 @@ export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", imp
|
|
|
41
11
|
readonly xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
42
12
|
readonly yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
43
13
|
readonly zStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
44
|
-
readonly color: import("@motionscript/sdk").Type<
|
|
14
|
+
readonly color: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
45
15
|
readonly thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
46
16
|
readonly tips: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
47
17
|
readonly ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
48
18
|
readonly tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
49
19
|
readonly grid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
50
|
-
readonly gridLineColor: import("@motionscript/sdk").Type<
|
|
20
|
+
readonly gridLineColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
51
21
|
readonly labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
52
22
|
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
53
|
-
readonly labelColor: import("@motionscript/sdk").Type<
|
|
23
|
+
readonly labelColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
54
24
|
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
55
25
|
readonly xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
56
26
|
readonly yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
@@ -60,20 +30,20 @@ export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", imp
|
|
|
60
30
|
readonly zoom: import("@motionscript/sdk").Type<number, number, false>;
|
|
61
31
|
readonly fov: import("@motionscript/sdk").Type<number, number, false>;
|
|
62
32
|
readonly ambientIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
63
|
-
readonly ambientColor: import("@motionscript/sdk").Type<
|
|
33
|
+
readonly ambientColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
64
34
|
readonly keyIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
65
|
-
readonly keyColor: import("@motionscript/sdk").Type<
|
|
35
|
+
readonly keyColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
66
36
|
readonly showGrid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
67
37
|
readonly gridSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
68
38
|
readonly gridDivisions: import("@motionscript/sdk").Type<number, number, false>;
|
|
69
39
|
readonly gridMajorEvery: import("@motionscript/sdk").Type<number, number, false>;
|
|
70
|
-
readonly gridColor: import("@motionscript/sdk").Type<
|
|
71
|
-
readonly gridMajorColor: import("@motionscript/sdk").Type<
|
|
40
|
+
readonly gridColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
41
|
+
readonly gridMajorColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
72
42
|
readonly showAxes: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
73
|
-
readonly axisXColor: import("@motionscript/sdk").Type<
|
|
74
|
-
readonly axisZColor: import("@motionscript/sdk").Type<
|
|
43
|
+
readonly axisXColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
44
|
+
readonly axisZColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
75
45
|
readonly gridFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
76
|
-
readonly gridFadeColor: import("@motionscript/sdk").Type<
|
|
46
|
+
readonly gridFadeColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
77
47
|
readonly maxPixelRatio: import("@motionscript/sdk").Type<number, number, false>;
|
|
78
48
|
readonly antialias: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
79
49
|
readonly shadows: import("@motionscript/sdk").Type<_Shadows3D, _Shadows3D, false>;
|
|
@@ -115,16 +85,16 @@ export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", imp
|
|
|
115
85
|
readonly xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
116
86
|
readonly yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
117
87
|
readonly zStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
118
|
-
readonly color: import("@motionscript/sdk").Type<
|
|
88
|
+
readonly color: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
119
89
|
readonly thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
120
90
|
readonly tips: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
121
91
|
readonly ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
122
92
|
readonly tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
123
93
|
readonly grid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
124
|
-
readonly gridLineColor: import("@motionscript/sdk").Type<
|
|
94
|
+
readonly gridLineColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
125
95
|
readonly labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
126
96
|
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
127
|
-
readonly labelColor: import("@motionscript/sdk").Type<
|
|
97
|
+
readonly labelColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
128
98
|
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
129
99
|
readonly xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
130
100
|
readonly yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
@@ -134,20 +104,20 @@ export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", imp
|
|
|
134
104
|
readonly zoom: import("@motionscript/sdk").Type<number, number, false>;
|
|
135
105
|
readonly fov: import("@motionscript/sdk").Type<number, number, false>;
|
|
136
106
|
readonly ambientIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
137
|
-
readonly ambientColor: import("@motionscript/sdk").Type<
|
|
107
|
+
readonly ambientColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
138
108
|
readonly keyIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
139
|
-
readonly keyColor: import("@motionscript/sdk").Type<
|
|
109
|
+
readonly keyColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
140
110
|
readonly showGrid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
141
111
|
readonly gridSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
142
112
|
readonly gridDivisions: import("@motionscript/sdk").Type<number, number, false>;
|
|
143
113
|
readonly gridMajorEvery: import("@motionscript/sdk").Type<number, number, false>;
|
|
144
|
-
readonly gridColor: import("@motionscript/sdk").Type<
|
|
145
|
-
readonly gridMajorColor: import("@motionscript/sdk").Type<
|
|
114
|
+
readonly gridColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
115
|
+
readonly gridMajorColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
146
116
|
readonly showAxes: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
147
|
-
readonly axisXColor: import("@motionscript/sdk").Type<
|
|
148
|
-
readonly axisZColor: import("@motionscript/sdk").Type<
|
|
117
|
+
readonly axisXColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
118
|
+
readonly axisZColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
149
119
|
readonly gridFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
150
|
-
readonly gridFadeColor: import("@motionscript/sdk").Type<
|
|
120
|
+
readonly gridFadeColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
151
121
|
readonly maxPixelRatio: import("@motionscript/sdk").Type<number, number, false>;
|
|
152
122
|
readonly antialias: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
153
123
|
readonly shadows: import("@motionscript/sdk").Type<_Shadows3D, _Shadows3D, false>;
|
|
@@ -178,16 +148,16 @@ export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", imp
|
|
|
178
148
|
readonly xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
179
149
|
readonly yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
180
150
|
readonly zStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
181
|
-
readonly color: import("@motionscript/sdk").Type<
|
|
151
|
+
readonly color: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
182
152
|
readonly thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
183
153
|
readonly tips: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
184
154
|
readonly ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
185
155
|
readonly tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
186
156
|
readonly grid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
187
|
-
readonly gridLineColor: import("@motionscript/sdk").Type<
|
|
157
|
+
readonly gridLineColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
188
158
|
readonly labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
189
159
|
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
190
|
-
readonly labelColor: import("@motionscript/sdk").Type<
|
|
160
|
+
readonly labelColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
191
161
|
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
192
162
|
readonly xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
193
163
|
readonly yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
@@ -197,20 +167,20 @@ export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", imp
|
|
|
197
167
|
readonly zoom: import("@motionscript/sdk").Type<number, number, false>;
|
|
198
168
|
readonly fov: import("@motionscript/sdk").Type<number, number, false>;
|
|
199
169
|
readonly ambientIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
200
|
-
readonly ambientColor: import("@motionscript/sdk").Type<
|
|
170
|
+
readonly ambientColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
201
171
|
readonly keyIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
202
|
-
readonly keyColor: import("@motionscript/sdk").Type<
|
|
172
|
+
readonly keyColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
203
173
|
readonly showGrid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
204
174
|
readonly gridSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
205
175
|
readonly gridDivisions: import("@motionscript/sdk").Type<number, number, false>;
|
|
206
176
|
readonly gridMajorEvery: import("@motionscript/sdk").Type<number, number, false>;
|
|
207
|
-
readonly gridColor: import("@motionscript/sdk").Type<
|
|
208
|
-
readonly gridMajorColor: import("@motionscript/sdk").Type<
|
|
177
|
+
readonly gridColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
178
|
+
readonly gridMajorColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
209
179
|
readonly showAxes: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
210
|
-
readonly axisXColor: import("@motionscript/sdk").Type<
|
|
211
|
-
readonly axisZColor: import("@motionscript/sdk").Type<
|
|
180
|
+
readonly axisXColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
181
|
+
readonly axisZColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
212
182
|
readonly gridFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
213
|
-
readonly gridFadeColor: import("@motionscript/sdk").Type<
|
|
183
|
+
readonly gridFadeColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
214
184
|
readonly maxPixelRatio: import("@motionscript/sdk").Type<number, number, false>;
|
|
215
185
|
readonly antialias: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
216
186
|
readonly shadows: import("@motionscript/sdk").Type<_Shadows3D, _Shadows3D, false>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axes3d.d.ts","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAWH,KAAK,
|
|
1
|
+
{"version":3,"file":"axes3d.d.ts","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAWH,KAAK,MAAM,EAOX,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,oBAAoB,IAAI,qBAAqB,EAClD,KAAK,mBAAmB,IAAI,oBAAoB,EAChD,KAAK,IAAI,IAAI,KAAK,EAClB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,QAAQ,IAAI,SAAS,EAC1B,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,KAAK,IAAI,MAAM,EAEpB,KAAK,eAAe,IAAI,gBAAgB,EACxC,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,gBAAgB,IAAI,iBAAiB,EAC1C,KAAK,eAAe,IAAI,gBAAgB,EACxC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACtC,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACtC,KAAK,aAAa,IAAI,cAAc,EACpC,KAAK,OAAO,IAAI,QAAQ,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAuD9C,8IAA8I;AAC9I,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAoBjB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/three/axes3d.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { component2d, Flow, Geo, Graphics3D, Mat, Paint, provides, Shapes, Types, View3D, } from "@motionscript/sdk";
|
|
2
|
-
import { AXIS_COLOR,
|
|
2
|
+
import { AXIS_COLOR, intervalEntry } from "../kit/furniture.js";
|
|
3
3
|
import { clamp } from "../kit/geometry.js";
|
|
4
4
|
import { formatTick, ticksFor } from "../kit/ticks.js";
|
|
5
5
|
import { drawLabel3D } from "./label3d.js";
|
|
@@ -10,14 +10,11 @@ const UNIT_AS_PIXELS = 64;
|
|
|
10
10
|
const ALONG = { x: [90, 0, 0], y: [0, 0, -90], z: [0, 0, 0] };
|
|
11
11
|
/** The graph axis each axis's tick marks lie along. */
|
|
12
12
|
const TICK_ALONG = { x: "y", y: "x", z: "y" };
|
|
13
|
-
function range(initial) {
|
|
14
|
-
return Types.custom(initial, { resolve: readInterval, lerp: lerpInterval });
|
|
15
|
-
}
|
|
16
13
|
/** The axes' own entries, beside a 3D canvas's. */
|
|
17
14
|
const own = {
|
|
18
|
-
xRange:
|
|
19
|
-
yRange:
|
|
20
|
-
zRange:
|
|
15
|
+
xRange: intervalEntry([-3, 3]),
|
|
16
|
+
yRange: intervalEntry([-3, 3]),
|
|
17
|
+
zRange: intervalEntry([-2, 2]),
|
|
21
18
|
/** How long each axis is drawn, in scene units. */
|
|
22
19
|
xLength: Types.number(6, { min: 0.01, step: 0.1 }),
|
|
23
20
|
yLength: Types.number(6, { min: 0.01, step: 0.1 }),
|
|
@@ -47,12 +44,7 @@ const own = {
|
|
|
47
44
|
yLabel: Types.text("y", { animatable: false }),
|
|
48
45
|
zLabel: Types.text("z", { animatable: false }),
|
|
49
46
|
};
|
|
50
|
-
/**
|
|
51
|
-
* A 3D graph: three axes through a box of graph coordinates, z up, seen through
|
|
52
|
-
* a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`
|
|
53
|
-
* does. Its 3D children sit in its graph coordinates: a surface, a space curve,
|
|
54
|
-
* a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.
|
|
55
|
-
*/
|
|
47
|
+
/** A 3D graph: three axes through a box of graph coordinates, z up, seen through its own camera. Its 3D children sit in graph coordinates. */
|
|
56
48
|
export const Axes3d = component2d({
|
|
57
49
|
key: "axes3d",
|
|
58
50
|
state: { ...Paint.state, ...Flow.state, ...Shapes.corners, ...View3D.state, ...own },
|
package/dist/three/axes3d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axes3d.js","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,IAAI,EACJ,GAAG,EACH,UAAU,EACV,GAAG,EACH,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,GA+BT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAqB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAiC,MAAM,SAAS,CAAC;AA4B9E,sGAAsG;AACtG,MAAM,cAAc,GAA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sourcesContent":["import {\n component2d,\n Flow,\n Geo,\n Graphics3D,\n Mat,\n Paint,\n provides,\n Shapes,\n Types,\n View3D,\n type Canvas3DProps,\n type Color,\n type NodeOf,\n type Scene3D,\n type Transform3D,\n type Values,\n type Vector3,\n type Vector3Input,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type CornerRadiusResolved as _CornerRadiusResolved,\n type CornerStyleResolved as _CornerStyleResolved,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type NormalizedColor as _NormalizedColor,\n type PostEffect3D as _PostEffect3D,\n type RectCornerRadius as _RectCornerRadius,\n type RectCornerStyle as _RectCornerStyle,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Shadows3D as _Shadows3D,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n type ToneMapping3D as _ToneMapping3D,\n type Vector2 as _Vector2,\n} from \"@motionscript/sdk\";\nimport type { Interval } from \"../kit/coords\";\nimport { AXIS_COLOR, lerpInterval, readInterval } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { formatTick, ticksFor } from \"../kit/ticks\";\nimport { drawLabel3D, type LabelStyle3D } from \"./label3d\";\nimport { GRAPH_3D, graphSpace, type Graph3D, type GraphSpace } from \"./space\";\n\nexport interface Axes3dProps extends Canvas3DProps {\n xRange?: Interval;\n yRange?: Interval;\n zRange?: Interval;\n xLength?: number;\n yLength?: number;\n zLength?: number;\n xStep?: number;\n yStep?: number;\n zStep?: number;\n color?: Color;\n thickness?: number;\n tips?: boolean;\n ticks?: boolean;\n tickSize?: number;\n grid?: boolean;\n gridLineColor?: Color;\n labels?: boolean;\n labelSize?: number;\n labelColor?: Color;\n fontFamily?: string;\n xLabel?: string;\n yLabel?: string;\n zLabel?: string;\n}\n\n/** How many pixels of a 2D axis one scene unit counts as, when an axis picks its own tick spacing. */\nconst UNIT_AS_PIXELS = 64;\n\ntype AxisName = \"x\" | \"y\" | \"z\";\n\n/** The turn that lays a shape built along the scene's +y along each graph axis. */\nconst ALONG: Record<AxisName, Vector3Input> = { x: [90, 0, 0], y: [0, 0, -90], z: [0, 0, 0] };\n\n/** The graph axis each axis's tick marks lie along. */\nconst TICK_ALONG: Record<AxisName, AxisName> = { x: \"y\", y: \"x\", z: \"y\" };\n\nfunction range(initial: Interval) {\n return Types.custom<Interval>(initial, { resolve: readInterval, lerp: lerpInterval });\n}\n\n/** The axes' own entries, beside a 3D canvas's. */\nconst own = {\n xRange: range([-3, 3]),\n yRange: range([-3, 3]),\n zRange: range([-2, 2]),\n /** How long each axis is drawn, in scene units. */\n xLength: Types.number(6, { min: 0.01, step: 0.1 }),\n yLength: Types.number(6, { min: 0.01, step: 0.1 }),\n zLength: Types.number(4, { min: 0.01, step: 0.1 }),\n /** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */\n xStep: Types.number(0, { min: 0 }),\n yStep: Types.number(0, { min: 0 }),\n zStep: Types.number(0, { min: 0 }),\n color: Types.color(AXIS_COLOR),\n /** The radius of an axis line, in scene units. */\n thickness: Types.number(0.02, { min: 0, step: 0.005 }),\n tips: Types.boolean(true, { animatable: false }),\n ticks: Types.boolean(true, { animatable: false }),\n tickSize: Types.number(0.16, { min: 0, step: 0.01 }),\n /** Lines across the plane the x and y axes lie in, at each of their ticks. */\n grid: Types.boolean(false, { animatable: false }),\n /** (`gridColor` is the viewport's own reference grid.) */\n gridLineColor: Types.color(\"#374151\"),\n /** A number at each tick. */\n labels: Types.boolean(false, { animatable: false }),\n /** The height of a label's text, in scene units. */\n labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),\n labelColor: Types.color(AXIS_COLOR),\n fontFamily: Types.text(\"\", { animatable: false }),\n /** A title at the positive end of each axis. */\n xLabel: Types.text(\"x\", { animatable: false }),\n yLabel: Types.text(\"y\", { animatable: false }),\n zLabel: Types.text(\"z\", { animatable: false }),\n};\n\ntype AxesValues = Values<typeof own>;\n\n/**\n * A 3D graph: three axes through a box of graph coordinates, z up, seen through\n * a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`\n * does. Its 3D children sit in its graph coordinates: a surface, a space curve,\n * a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.\n */\nexport const Axes3d = component2d({\n key: \"axes3d\",\n state: { ...Paint.state, ...Flow.state, ...Shapes.corners, ...View3D.state, ...own },\n defaults: { width: \"fill\", height: \"fill\" },\n commands: {\n ...Paint.commands,\n ...View3D.commands,\n /** Animate the window of values the axes show; everything drawn in them follows. */\n rangeTo: { args: [\"xRange\", \"yRange\", \"zRange\"] },\n },\n allowedChildren: [\"2d\", \"3d\"],\n load: (loader, s) => {\n View3D.load(loader, furnish(s));\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n },\n provide: (s) => [provides(GRAPH_3D, graphOfAxes(s))],\n space: (s) => axesSpace(s),\n measure: (measurer, s, children) => Flow.measure(measurer, s, children, Paint.inset(s)),\n layout: (box, s, children) => Flow.layout(box, s, children, Paint.inset(s)),\n render: (ctx, s) => View3D.draw(ctx, s, furnish(s)),\n});\n\nexport type Axes3d = NodeOf<typeof Axes3d>;\n\n/** The axes' own drawing, added to the scene: what `render` draws and `load` declares. */\nfunction furnish(s: AxesValues): (scene: Scene3D) => void {\n return (scene) => scene.draw(furniture(s));\n}\n\n/** The last space worked out for each axes, kept while its ranges and lengths are unchanged. */\nconst spaces = new WeakMap<object, { readonly key: string; readonly space: GraphSpace }>();\n\n/** The coordinates of a 3D graph: what its children's `x`, `y` and `z` are in. */\nfunction axesSpace(s: AxesValues): GraphSpace {\n const { xRange, yRange, zRange, xLength, yLength, zLength } = s;\n const key = [xRange, yRange, zRange, xLength, yLength, zLength].join(\"|\");\n let kept = spaces.get(s);\n if (kept?.key !== key) spaces.set(s, (kept = { key, space: graphSpace(xRange, yRange, zRange, { x: xLength, y: yLength, z: zLength }) }));\n return kept.space;\n}\n\n// One per axes, so the context its subtree holds is the same from frame to frame.\nconst graphs = new WeakMap<object, Graph3D>();\n\nfunction graphOfAxes(s: AxesValues): Graph3D {\n let graph = graphs.get(s);\n if (!graph) graphs.set(s, (graph = { space: () => axesSpace(s) }));\n return graph;\n}\n\n/** The axes, their ticks, numbers and titles, and the grid, in the scene's units. */\nfunction furniture(s: AxesValues): Graphics3D {\n const space = axesSpace(s);\n const g3 = new Graphics3D();\n const ranges: Record<AxisName, Interval> = { x: space.xRange, y: space.yRange, z: space.zRange };\n const lengths: Record<AxisName, number> = { x: s.xLength, y: s.yLength, z: s.zLength };\n const steps: Record<AxisName, number> = { x: s.xStep, y: s.yStep, z: s.zStep };\n const titles: Record<AxisName, string> = { x: s.xLabel, y: s.yLabel, z: s.zLabel };\n // Where each axis is crossed by the other two: their zero, or the nearest end of a range without one.\n const cross: Record<AxisName, number> = {\n x: clamp(0, ranges.x[0], ranges.x[1]),\n y: clamp(0, ranges.y[0], ranges.y[1]),\n z: clamp(0, ranges.z[0], ranges.z[1]),\n };\n const at = (axis: AxisName, value: number, shift: Partial<Record<AxisName, number>> = {}): Vector3 => {\n const point = { ...cross, [axis]: value };\n const local = space.toLocal(point.x, point.y, point.z);\n const moved = space.offset(0, 0, 0);\n for (const key of [\"x\", \"y\", \"z\"] as const) {\n const by = shift[key];\n if (by === undefined) continue;\n // A shift is in scene units, along the graph axis it names.\n if (key === \"x\") moved.z += by;\n else if (key === \"y\") moved.x += by;\n else moved.y += by;\n }\n return { x: local.x + moved.x, y: local.y + moved.y, z: local.z + moved.z };\n };\n\n const { thickness, tickSize } = s;\n const paint = Mat.basic({ color: s.color });\n const style: LabelStyle3D = { size: s.labelSize, color: s.labelColor, fontFamily: s.fontFamily };\n const tipLength = s.tips ? thickness * 9 : 0;\n const marks: Transform3D[] = [];\n const plane: Vector3[] = [];\n\n for (const axis of [\"x\", \"y\", \"z\"] as const) {\n const [min, max] = ranges[axis];\n const length = lengths[axis];\n if (!(max > min) || !(length > 0)) continue;\n\n if (thickness > 0) {\n const from = at(axis, min);\n const to = at(axis, max);\n g3.mesh(Geo.cylinder({ radius: thickness, height: length, segments: [12, 1] }), paint, {\n position: { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2, z: (from.z + to.z) / 2 },\n rotation: ALONG[axis],\n });\n if (s.tips) {\n g3.mesh(Geo.cone({ radius: thickness * 3.2, height: tipLength, segments: [16, 1] }), paint, {\n position: at(axis, max, { [axis]: tipLength / 2 }),\n rotation: ALONG[axis],\n });\n }\n }\n\n const ticks = ticksFor(ranges[axis], steps[axis], length * UNIT_AS_PIXELS);\n const side = TICK_ALONG[axis];\n for (const value of ticks.values) {\n // The crossing is marked by the other axes, and the far end by the tip.\n if (Math.abs(value - cross[axis]) < 1e-9 || (s.tips && Math.abs(value - max) < 1e-9)) continue;\n if (s.ticks && tickSize > 0) marks.push({ position: at(axis, value), rotation: ALONG[side] });\n if (s.labels) {\n drawLabel3D(g3, formatTick(value, ticks.step), at(axis, value, { [side]: -(tickSize / 2 + style.size * 0.8) }), style);\n }\n }\n drawLabel3D(g3, titles[axis], at(axis, max, { [axis]: tipLength + style.size * 0.9 }), style);\n\n if (s.grid && axis !== \"z\") {\n const other = axis === \"x\" ? \"y\" : \"x\";\n for (const value of ticks.values) {\n const a = { x: 0, y: 0, z: cross.z, [axis]: value, [other]: ranges[other][0] };\n const b = { ...a, [other]: ranges[other][1] };\n plane.push(space.toLocal(a.x, a.y, a.z), space.toLocal(b.x, b.y, b.z));\n }\n }\n }\n\n if (marks.length > 0) {\n g3.instances(Geo.cylinder({ radius: Math.max(thickness * 0.7, 0.008), height: tickSize, segments: [8, 1] }), paint, marks);\n }\n if (plane.length > 0) g3.line({ points: plane, segments: true, stroke: { fill: s.gridLineColor } });\n return g3;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"axes3d.js","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,IAAI,EACJ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C,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/H,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACpG,OAAO,EAAE,CAAC;AACd,CAAC","sourcesContent":["import {\n component2d,\n Flow,\n Geo,\n Graphics3D,\n Mat,\n Paint,\n provides,\n Shapes,\n Types,\n View3D,\n type NodeOf,\n type Scene3D,\n type Transform3D,\n type Values,\n type Vector3,\n type Vector3Input,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type CornerRadiusResolved as _CornerRadiusResolved,\n type CornerStyleResolved as _CornerStyleResolved,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Color as _Color,\n\n type NormalizedColor as _NormalizedColor,\n type PostEffect3D as _PostEffect3D,\n type RectCornerRadius as _RectCornerRadius,\n type RectCornerStyle as _RectCornerStyle,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Shadows3D as _Shadows3D,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n type ToneMapping3D as _ToneMapping3D,\n type Vector2 as _Vector2,\n} from \"@motionscript/sdk\";\nimport type { Interval } from \"../kit/coords\";\nimport { AXIS_COLOR, intervalEntry } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { formatTick, ticksFor } from \"../kit/ticks\";\nimport { drawLabel3D, type LabelStyle3D } from \"./label3d\";\nimport { GRAPH_3D, graphSpace, type Graph3D, type GraphSpace } from \"./space\";\n\n/** How many pixels of a 2D axis one scene unit counts as, when an axis picks its own tick spacing. */\nconst UNIT_AS_PIXELS = 64;\n\ntype AxisName = \"x\" | \"y\" | \"z\";\n\n/** The turn that lays a shape built along the scene's +y along each graph axis. */\nconst ALONG: Record<AxisName, Vector3Input> = { x: [90, 0, 0], y: [0, 0, -90], z: [0, 0, 0] };\n\n/** The graph axis each axis's tick marks lie along. */\nconst TICK_ALONG: Record<AxisName, AxisName> = { x: \"y\", y: \"x\", z: \"y\" };\n\n/** The axes' own entries, beside a 3D canvas's. */\nconst own = {\n xRange: intervalEntry([-3, 3]),\n yRange: intervalEntry([-3, 3]),\n zRange: intervalEntry([-2, 2]),\n /** How long each axis is drawn, in scene units. */\n xLength: Types.number(6, { min: 0.01, step: 0.1 }),\n yLength: Types.number(6, { min: 0.01, step: 0.1 }),\n zLength: Types.number(4, { min: 0.01, step: 0.1 }),\n /** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */\n xStep: Types.number(0, { min: 0 }),\n yStep: Types.number(0, { min: 0 }),\n zStep: Types.number(0, { min: 0 }),\n color: Types.color(AXIS_COLOR),\n /** The radius of an axis line, in scene units. */\n thickness: Types.number(0.02, { min: 0, step: 0.005 }),\n tips: Types.boolean(true, { animatable: false }),\n ticks: Types.boolean(true, { animatable: false }),\n tickSize: Types.number(0.16, { min: 0, step: 0.01 }),\n /** Lines across the plane the x and y axes lie in, at each of their ticks. */\n grid: Types.boolean(false, { animatable: false }),\n /** (`gridColor` is the viewport's own reference grid.) */\n gridLineColor: Types.color(\"#374151\"),\n /** A number at each tick. */\n labels: Types.boolean(false, { animatable: false }),\n /** The height of a label's text, in scene units. */\n labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),\n labelColor: Types.color(AXIS_COLOR),\n fontFamily: Types.text(\"\", { animatable: false }),\n /** A title at the positive end of each axis. */\n xLabel: Types.text(\"x\", { animatable: false }),\n yLabel: Types.text(\"y\", { animatable: false }),\n zLabel: Types.text(\"z\", { animatable: false }),\n};\n\ntype AxesValues = Values<typeof own>;\n\n/** A 3D graph: three axes through a box of graph coordinates, z up, seen through its own camera. Its 3D children sit in graph coordinates. */\nexport const Axes3d = component2d({\n key: \"axes3d\",\n state: { ...Paint.state, ...Flow.state, ...Shapes.corners, ...View3D.state, ...own },\n defaults: { width: \"fill\", height: \"fill\" },\n commands: {\n ...Paint.commands,\n ...View3D.commands,\n /** Animate the window of values the axes show; everything drawn in them follows. */\n rangeTo: { args: [\"xRange\", \"yRange\", \"zRange\"] },\n },\n allowedChildren: [\"2d\", \"3d\"],\n load: (loader, s) => {\n View3D.load(loader, furnish(s));\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n },\n provide: (s) => [provides(GRAPH_3D, graphOfAxes(s))],\n space: (s) => axesSpace(s),\n measure: (measurer, s, children) => Flow.measure(measurer, s, children, Paint.inset(s)),\n layout: (box, s, children) => Flow.layout(box, s, children, Paint.inset(s)),\n render: (ctx, s) => View3D.draw(ctx, s, furnish(s)),\n});\n\nexport type Axes3d = NodeOf<typeof Axes3d>;\n\n/** The axes' own drawing, added to the scene: what `render` draws and `load` declares. */\nfunction furnish(s: AxesValues): (scene: Scene3D) => void {\n return (scene) => scene.draw(furniture(s));\n}\n\n/** The last space worked out for each axes, kept while its ranges and lengths are unchanged. */\nconst spaces = new WeakMap<object, { readonly key: string; readonly space: GraphSpace }>();\n\n/** The coordinates of a 3D graph: what its children's `x`, `y` and `z` are in. */\nfunction axesSpace(s: AxesValues): GraphSpace {\n const { xRange, yRange, zRange, xLength, yLength, zLength } = s;\n const key = [xRange, yRange, zRange, xLength, yLength, zLength].join(\"|\");\n let kept = spaces.get(s);\n if (kept?.key !== key) spaces.set(s, (kept = { key, space: graphSpace(xRange, yRange, zRange, { x: xLength, y: yLength, z: zLength }) }));\n return kept.space;\n}\n\n// One per axes, so the context its subtree holds is the same from frame to frame.\nconst graphs = new WeakMap<object, Graph3D>();\n\nfunction graphOfAxes(s: AxesValues): Graph3D {\n let graph = graphs.get(s);\n if (!graph) graphs.set(s, (graph = { space: () => axesSpace(s) }));\n return graph;\n}\n\n/** The axes, their ticks, numbers and titles, and the grid, in the scene's units. */\nfunction furniture(s: AxesValues): Graphics3D {\n const space = axesSpace(s);\n const g3 = new Graphics3D();\n const ranges: Record<AxisName, Interval> = { x: space.xRange, y: space.yRange, z: space.zRange };\n const lengths: Record<AxisName, number> = { x: s.xLength, y: s.yLength, z: s.zLength };\n const steps: Record<AxisName, number> = { x: s.xStep, y: s.yStep, z: s.zStep };\n const titles: Record<AxisName, string> = { x: s.xLabel, y: s.yLabel, z: s.zLabel };\n // Where each axis is crossed by the other two: their zero, or the nearest end of a range without one.\n const cross: Record<AxisName, number> = {\n x: clamp(0, ranges.x[0], ranges.x[1]),\n y: clamp(0, ranges.y[0], ranges.y[1]),\n z: clamp(0, ranges.z[0], ranges.z[1]),\n };\n const at = (axis: AxisName, value: number, shift: Partial<Record<AxisName, number>> = {}): Vector3 => {\n const point = { ...cross, [axis]: value };\n const local = space.toLocal(point.x, point.y, point.z);\n const moved = space.offset(0, 0, 0);\n for (const key of [\"x\", \"y\", \"z\"] as const) {\n const by = shift[key];\n if (by === undefined) continue;\n // A shift is in scene units, along the graph axis it names.\n if (key === \"x\") moved.z += by;\n else if (key === \"y\") moved.x += by;\n else moved.y += by;\n }\n return { x: local.x + moved.x, y: local.y + moved.y, z: local.z + moved.z };\n };\n\n const { thickness, tickSize } = s;\n const paint = Mat.basic({ color: s.color });\n const style: LabelStyle3D = { size: s.labelSize, color: s.labelColor, fontFamily: s.fontFamily };\n const tipLength = s.tips ? thickness * 9 : 0;\n const marks: Transform3D[] = [];\n const plane: Vector3[] = [];\n\n for (const axis of [\"x\", \"y\", \"z\"] as const) {\n const [min, max] = ranges[axis];\n const length = lengths[axis];\n if (!(max > min) || !(length > 0)) continue;\n\n if (thickness > 0) {\n const from = at(axis, min);\n const to = at(axis, max);\n g3.mesh(Geo.cylinder({ radius: thickness, height: length, segments: [12, 1] }), paint, {\n position: { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2, z: (from.z + to.z) / 2 },\n rotation: ALONG[axis],\n });\n if (s.tips) {\n g3.mesh(Geo.cone({ radius: thickness * 3.2, height: tipLength, segments: [16, 1] }), paint, {\n position: at(axis, max, { [axis]: tipLength / 2 }),\n rotation: ALONG[axis],\n });\n }\n }\n\n const ticks = ticksFor(ranges[axis], steps[axis], length * UNIT_AS_PIXELS);\n const side = TICK_ALONG[axis];\n for (const value of ticks.values) {\n // The crossing is marked by the other axes, and the far end by the tip.\n if (Math.abs(value - cross[axis]) < 1e-9 || (s.tips && Math.abs(value - max) < 1e-9)) continue;\n if (s.ticks && tickSize > 0) marks.push({ position: at(axis, value), rotation: ALONG[side] });\n if (s.labels) {\n drawLabel3D(g3, formatTick(value, ticks.step), at(axis, value, { [side]: -(tickSize / 2 + style.size * 0.8) }), style);\n }\n }\n drawLabel3D(g3, titles[axis], at(axis, max, { [axis]: tipLength + style.size * 0.9 }), style);\n\n if (s.grid && axis !== \"z\") {\n const other = axis === \"x\" ? \"y\" : \"x\";\n for (const value of ticks.values) {\n const a = { x: 0, y: 0, z: cross.z, [axis]: value, [other]: ranges[other][0] };\n const b = { ...a, [other]: ranges[other][1] };\n plane.push(space.toLocal(a.x, a.y, a.z), space.toLocal(b.x, b.y, b.z));\n }\n }\n }\n\n if (marks.length > 0) {\n g3.instances(Geo.cylinder({ radius: Math.max(thickness * 0.7, 0.008), height: tickSize, segments: [8, 1] }), paint, marks);\n }\n if (plane.length > 0) g3.line({ points: plane, segments: true, stroke: { fill: s.gridLineColor } });\n return g3;\n}\n"]}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import { type Geometry3D, type
|
|
2
|
-
import type { Interval } from "../kit/coords.js";
|
|
3
|
-
import type { ExpressionScope } from "../kit/expression.js";
|
|
1
|
+
import { type Geometry3D, type NodeOf, type Blend3D as _Blend3D, type Color as _Color, type Faces3D as _Faces3D, type Fill3D as _Fill3D, 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";
|
|
4
2
|
import { type PlotSource } from "../kit/source.js";
|
|
5
|
-
export interface CurvePlot3dProps extends Mesh3DProps {
|
|
6
|
-
expression?: string | PlotSource;
|
|
7
|
-
domain?: Interval | null;
|
|
8
|
-
params?: ExpressionScope;
|
|
9
|
-
samples?: number;
|
|
10
|
-
thickness?: number;
|
|
11
|
-
start?: number;
|
|
12
|
-
end?: number;
|
|
13
|
-
}
|
|
14
3
|
/** A curve through a 3D graph, three parts in `t`: `(cos(t), sin(t), t / 4)`. */
|
|
15
4
|
export declare const CurvePlot3d: import("@motionscript/sdk").Component<"curvePlot3d", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
16
5
|
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
17
6
|
/** The span of `t` that is drawn; 0 to 1 when left out. */
|
|
18
|
-
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
7
|
+
domain: import("@motionscript/sdk").Type<import("../index.js").Interval | null, import("../index.js").Interval | null, false>;
|
|
19
8
|
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
20
9
|
/** How many points the curve is drawn through. */
|
|
21
10
|
samples: import("@motionscript/sdk").Type<number, number, false>;
|
|
@@ -53,7 +42,7 @@ export declare const CurvePlot3d: import("@motionscript/sdk").Component<"curvePl
|
|
|
53
42
|
}, null, _Node3D<_Node3DProps>, import("@motionscript/sdk").CallProps3D<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
54
43
|
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
55
44
|
/** The span of `t` that is drawn; 0 to 1 when left out. */
|
|
56
|
-
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
45
|
+
domain: import("@motionscript/sdk").Type<import("../index.js").Interval | null, import("../index.js").Interval | null, false>;
|
|
57
46
|
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
58
47
|
/** How many points the curve is drawn through. */
|
|
59
48
|
samples: import("@motionscript/sdk").Type<number, number, false>;
|
|
@@ -86,7 +75,7 @@ export declare const CurvePlot3d: import("@motionscript/sdk").Component<"curvePl
|
|
|
86
75
|
}>, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
87
76
|
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
88
77
|
/** The span of `t` that is drawn; 0 to 1 when left out. */
|
|
89
|
-
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
78
|
+
domain: import("@motionscript/sdk").Type<import("../index.js").Interval | null, import("../index.js").Interval | null, false>;
|
|
90
79
|
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
91
80
|
/** How many points the curve is drawn through. */
|
|
92
81
|
samples: import("@motionscript/sdk").Type<number, number, false>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curve-plot3d.d.ts","sourceRoot":"","sources":["../../src/three/curve-plot3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,KAAK,UAAU,EACf,KAAK,
|
|
1
|
+
{"version":3,"file":"curve-plot3d.d.ts","sourceRoot":"","sources":["../../src/three/curve-plot3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,KAAK,UAAU,EACf,KAAK,MAAM,EAIX,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,KAAK,IAAI,MAAM,EACpB,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,MAAM,IAAI,OAAO,EACtB,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,IA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,OAAO,IAAI,CAAC;IAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC;IAC7B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;QACd,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC7B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACxB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACxB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC,CAAC;AACN,CAAC;AAED,SAAS,UAAU,CAAC,MAAc;IAC9B,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IACnE,OAAO,QAAQ,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvD,CAAC","sourcesContent":["import {\n component3d,\n Geo,\n Graphics3D,\n Material,\n Types,\n type Geometry3D,\n type Mesh3DProps,\n type NodeOf,\n type Values,\n type Vector3,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Blend3D as _Blend3D,\n type Color as _Color,\n type Faces3D as _Faces3D,\n type Fill3D as _Fill3D,\n type Material3D as _Material3D,\n type Node3D as _Node3D,\n type Node3DProps as _Node3DProps,\n type NormalizedColor as _NormalizedColor,\n type Shading3D as _Shading3D,\n type Texture3D as _Texture3D,\n} from \"@motionscript/sdk\";\nimport type { Interval } from \"../kit/coords\";\nimport { parseSpaceCurve, spaceCurveParams, type SpaceCurveEquation } from \"../kit/equation3d\";\nimport type { ExpressionScope } from \"../kit/expression\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { lerpParams, lerpSource, readSource, scopeFor, type PlotSource } from \"../kit/source\";\nimport { domainEntry, meshEntries } from \"./entries\";\nimport { graphEntry, graphOf, type GraphSpace } from \"./space\";\n\nexport interface CurvePlot3dProps extends Mesh3DProps {\n expression?: string | PlotSource;\n domain?: Interval | null;\n params?: ExpressionScope;\n samples?: number;\n thickness?: number;\n start?: number;\n end?: number;\n}\n\nconst state = {\n ...meshEntries,\n expression: Types.custom<string | PlotSource, PlotSource>(\"\", {\n resolve: readSource,\n lerp: lerpSource,\n kind: \"spaceCurveEquation\",\n }),\n /** The span of `t` that is drawn; 0 to 1 when left out. */\n domain: domainEntry(0, 1),\n params: Types.custom<ExpressionScope>({}, { lerp: lerpParams }),\n /** How many points the curve is drawn through. */\n samples: Types.number(160, { min: 2, max: 2000, step: 1, animatable: false }),\n /** The radius of the line, in scene units. */\n thickness: Types.number(0.04, { min: 0.001, step: 0.005 }),\n /** The part of the curve that is drawn, as shares of its length in `t`. */\n start: Types.number(0, { min: 0, max: 1, step: 0.01 }),\n end: Types.number(1, { min: 0, max: 1, step: 0.01 }),\n graph: graphEntry(),\n};\n\ntype CurveValues = Values<typeof state>;\n\n/** A curve through a 3D graph, three parts in `t`: `(cos(t), sin(t), t / 4)`. */\nexport const CurvePlot3d = component3d({\n key: \"curvePlot3d\",\n state,\n defaults: { fill: PLOT_COLOR },\n commands: {\n /** Change the equation, the curve bending from the one into the other. */\n morphTo: { args: [\"expression\"] },\n /** Animate the equation's named values. */\n paramsTo: { args: [\"params\"] },\n /** Animate the span of `t` that is drawn. */\n domainTo: { args: [\"domain\"] },\n /** Draw the curve on, or wipe it off: animates `start` and `end`. */\n progressTo: { args: [\"start\", \"end\"] },\n },\n // Declaring, its paint on a stand-in: only a material loads, and the curve's points are not sampled.\n render: (ctx, s) => ctx.draw(ctx.declaring ? new Graphics3D().plane(Material.shorthand(s)) : Material.mesh(s, curveGeometry(s))),\n});\n\nexport type CurvePlot3d = NodeOf<typeof CurvePlot3d>;\n\nfunction curveGeometry(s: CurveValues): Geometry3D | undefined {\n const space = graphOf(s);\n if (!space) return undefined;\n const points = pointsOf(s, space);\n if (points.length < 2) return undefined;\n return Geo.tube({ points, radius: s.thickness, segments: [points.length - 1, 8] });\n}\n\n/** The last run drawn for each curve, kept while what it is drawn from is unchanged. */\nconst runs = new WeakMap<object, { readonly key: string; readonly run: Vector3[] }>();\n\nfunction pointsOf(s: CurveValues, space: GraphSpace): Vector3[] {\n const { source, blend } = s.expression;\n const start = clamp(s.start, 0, 1);\n const end = clamp(s.end, 0, 1);\n const samples = Math.max(2, Math.round(s.samples));\n const key = [source, blend?.from, blend?.t, space.revision, s.domain, JSON.stringify(s.params), start, end, samples].join(\"|\");\n const kept = runs.get(s);\n if (kept?.key === key) return kept.run;\n const run: Vector3[] = [];\n runs.set(s, { key, run });\n const to = curveOf(s, source);\n if (!to || !(end > start)) return run;\n const from = blend ? curveOf(s, blend.from) : null;\n const steps = Math.max(1, Math.round(samples * (end - start)));\n const a: Vector3 = { x: 0, y: 0, z: 0 };\n const b: Vector3 = { x: 0, y: 0, z: 0 };\n for (let i = 0; i <= steps; i++) {\n const u = start + ((end - start) * i) / steps;\n if (!to(u, b)) continue;\n if (from && blend) {\n if (!from(u, a)) continue;\n b.x = a.x + (b.x - a.x) * blend.t;\n b.y = a.y + (b.y - a.y) * blend.t;\n b.z = a.z + (b.z - a.z) * blend.t;\n }\n run.push(space.offset(b.x, b.y, b.z));\n }\n return run;\n}\n\n/** `source` as a graph point for a share `u` of its span, or `false` where it has none. */\nfunction curveOf(s: CurveValues, source: string): ((u: number, out: Vector3) => boolean) | null {\n const equation = equationOf(source);\n if (!equation) return null;\n const params = scopeFor(spaceCurveParams(source), s.params);\n const [t0, t1] = s.domain ?? [0, 1];\n const { x, y, z } = equation;\n return (u, out) => {\n const t = t0 + (t1 - t0) * u;\n out.x = x(t, 0, params);\n out.y = y(t, 0, params);\n out.z = z(t, 0, params);\n return Number.isFinite(out.x) && Number.isFinite(out.y) && Number.isFinite(out.z);\n };\n}\n\nfunction equationOf(source: string): SpaceCurveEquation | null {\n const equation = parseSpaceCurve(source, spaceCurveParams(source));\n return equation instanceof Error ? null : equation;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"curve-plot3d.js","sourceRoot":"","sources":["../../src/three/curve-plot3d.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,GAAG,EACH,UAAU,EACV,QAAQ,EACR,KAAK,GAgBR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAA2B,MAAM,mBAAmB,CAAC;AAE/F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAmB,MAAM,SAAS,CAAC;AAE/D,MAAM,KAAK,GAAG;IACV,GAAG,WAAW;IACd,UAAU,EAAE,KAAK,CAAC,MAAM,CAAkC,EAAE,EAAE;QAC1D,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE,UAAU;Q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;IAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC;IAC7B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;QACd,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC7B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACxB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACxB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC,CAAC;AACN,CAAC;AAED,SAAS,UAAU,CAAC,MAAc;IAC9B,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IACnE,OAAO,QAAQ,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvD,CAAC","sourcesContent":["import {\n component3d,\n Geo,\n Graphics3D,\n Material,\n Types,\n type Geometry3D,\n type NodeOf,\n type Values,\n type Vector3,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Blend3D as _Blend3D,\n type Color as _Color,\n type Faces3D as _Faces3D,\n type Fill3D as _Fill3D,\n type Material3D as _Material3D,\n type Node3D as _Node3D,\n type Node3DProps as _Node3DProps,\n type NormalizedColor as _NormalizedColor,\n type Shading3D as _Shading3D,\n type Texture3D as _Texture3D,\n} from \"@motionscript/sdk\";\nimport { parseSpaceCurve, spaceCurveParams, type SpaceCurveEquation } from \"../kit/equation3d\";\nimport type { ExpressionScope } from \"../kit/expression\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { lerpParams, lerpSource, readSource, scopeFor, type PlotSource } from \"../kit/source\";\nimport { domainEntry, meshEntries } from \"./entries\";\nimport { graphEntry, graphOf, type GraphSpace } from \"./space\";\n\nconst state = {\n ...meshEntries,\n expression: Types.custom<string | PlotSource, PlotSource>(\"\", {\n resolve: readSource,\n lerp: lerpSource,\n kind: \"spaceCurveEquation\",\n }),\n /** The span of `t` that is drawn; 0 to 1 when left out. */\n domain: domainEntry(0, 1),\n params: Types.custom<ExpressionScope>({}, { lerp: lerpParams }),\n /** How many points the curve is drawn through. */\n samples: Types.number(160, { min: 2, max: 2000, step: 1, animatable: false }),\n /** The radius of the line, in scene units. */\n thickness: Types.number(0.04, { min: 0.001, step: 0.005 }),\n /** The part of the curve that is drawn, as shares of its length in `t`. */\n start: Types.number(0, { min: 0, max: 1, step: 0.01 }),\n end: Types.number(1, { min: 0, max: 1, step: 0.01 }),\n graph: graphEntry(),\n};\n\ntype CurveValues = Values<typeof state>;\n\n/** A curve through a 3D graph, three parts in `t`: `(cos(t), sin(t), t / 4)`. */\nexport const CurvePlot3d = component3d({\n key: \"curvePlot3d\",\n state,\n defaults: { fill: PLOT_COLOR },\n commands: {\n /** Change the equation, the curve bending from the one into the other. */\n morphTo: { args: [\"expression\"] },\n /** Animate the equation's named values. */\n paramsTo: { args: [\"params\"] },\n /** Animate the span of `t` that is drawn. */\n domainTo: { args: [\"domain\"] },\n /** Draw the curve on, or wipe it off: animates `start` and `end`. */\n progressTo: { args: [\"start\", \"end\"] },\n },\n // Declaring, its paint on a stand-in: only a material loads, and the curve's points are not sampled.\n render: (ctx, s) => ctx.draw(ctx.declaring ? new Graphics3D().plane(Material.shorthand(s)) : Material.mesh(s, curveGeometry(s))),\n});\n\nexport type CurvePlot3d = NodeOf<typeof CurvePlot3d>;\n\nfunction curveGeometry(s: CurveValues): Geometry3D | undefined {\n const space = graphOf(s);\n if (!space) return undefined;\n const points = pointsOf(s, space);\n if (points.length < 2) return undefined;\n return Geo.tube({ points, radius: s.thickness, segments: [points.length - 1, 8] });\n}\n\n/** The last run drawn for each curve, kept while what it is drawn from is unchanged. */\nconst runs = new WeakMap<object, { readonly key: string; readonly run: Vector3[] }>();\n\nfunction pointsOf(s: CurveValues, space: GraphSpace): Vector3[] {\n const { source, blend } = s.expression;\n const start = clamp(s.start, 0, 1);\n const end = clamp(s.end, 0, 1);\n const samples = Math.max(2, Math.round(s.samples));\n const key = [source, blend?.from, blend?.t, space.revision, s.domain, JSON.stringify(s.params), start, end, samples].join(\"|\");\n const kept = runs.get(s);\n if (kept?.key === key) return kept.run;\n const run: Vector3[] = [];\n runs.set(s, { key, run });\n const to = curveOf(s, source);\n if (!to || !(end > start)) return run;\n const from = blend ? curveOf(s, blend.from) : null;\n const steps = Math.max(1, Math.round(samples * (end - start)));\n const a: Vector3 = { x: 0, y: 0, z: 0 };\n const b: Vector3 = { x: 0, y: 0, z: 0 };\n for (let i = 0; i <= steps; i++) {\n const u = start + ((end - start) * i) / steps;\n if (!to(u, b)) continue;\n if (from && blend) {\n if (!from(u, a)) continue;\n b.x = a.x + (b.x - a.x) * blend.t;\n b.y = a.y + (b.y - a.y) * blend.t;\n b.z = a.z + (b.z - a.z) * blend.t;\n }\n run.push(space.offset(b.x, b.y, b.z));\n }\n return run;\n}\n\n/** `source` as a graph point for a share `u` of its span, or `false` where it has none. */\nfunction curveOf(s: CurveValues, source: string): ((u: number, out: Vector3) => boolean) | null {\n const equation = equationOf(source);\n if (!equation) return null;\n const params = scopeFor(spaceCurveParams(source), s.params);\n const [t0, t1] = s.domain ?? [0, 1];\n const { x, y, z } = equation;\n return (u, out) => {\n const t = t0 + (t1 - t0) * u;\n out.x = x(t, 0, params);\n out.y = y(t, 0, params);\n out.z = z(t, 0, params);\n return Number.isFinite(out.x) && Number.isFinite(out.y) && Number.isFinite(out.z);\n };\n}\n\nfunction equationOf(source: string): SpaceCurveEquation | null {\n const equation = parseSpaceCurve(source, spaceCurveParams(source));\n return equation instanceof Error ? null : equation;\n}\n"]}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export interface PlotPoint3dProps extends Mesh3DProps {
|
|
3
|
-
radius?: number;
|
|
4
|
-
label?: string;
|
|
5
|
-
labelSize?: number;
|
|
6
|
-
labelColor?: Color;
|
|
7
|
-
fontFamily?: string;
|
|
8
|
-
}
|
|
1
|
+
import { type NodeOf, type Blend3D as _Blend3D, type Color as _Color, 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";
|
|
9
2
|
/**
|
|
10
3
|
* A dot at graph coordinates in a 3D graph, with an optional label. Put inside
|
|
11
4
|
* a surface it rides it: its `x` and `y` say where, and its height is the surface's.
|
|
@@ -16,7 +9,7 @@ export declare const PlotPoint3d: import("@motionscript/sdk").Component<"plotPoi
|
|
|
16
9
|
readonly label: import("@motionscript/sdk").Type<string, string, false>;
|
|
17
10
|
/** The height of the label's text, in scene units. */
|
|
18
11
|
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
19
|
-
readonly labelColor: import("@motionscript/sdk").Type<
|
|
12
|
+
readonly labelColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
20
13
|
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
21
14
|
readonly fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
22
15
|
readonly blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
@@ -25,7 +18,7 @@ export declare const PlotPoint3d: import("@motionscript/sdk").Component<"plotPoi
|
|
|
25
18
|
readonly material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
26
19
|
readonly roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
27
20
|
readonly metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
28
|
-
readonly emission: import("@motionscript/sdk").Type<
|
|
21
|
+
readonly emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
29
22
|
readonly emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
30
23
|
readonly normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
31
24
|
readonly roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
@@ -44,7 +37,7 @@ export declare const PlotPoint3d: import("@motionscript/sdk").Component<"plotPoi
|
|
|
44
37
|
readonly label: import("@motionscript/sdk").Type<string, string, false>;
|
|
45
38
|
/** The height of the label's text, in scene units. */
|
|
46
39
|
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
47
|
-
readonly labelColor: import("@motionscript/sdk").Type<
|
|
40
|
+
readonly labelColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
48
41
|
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
49
42
|
readonly fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
50
43
|
readonly blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
@@ -53,7 +46,7 @@ export declare const PlotPoint3d: import("@motionscript/sdk").Component<"plotPoi
|
|
|
53
46
|
readonly material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
54
47
|
readonly roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
55
48
|
readonly metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
56
|
-
readonly emission: import("@motionscript/sdk").Type<
|
|
49
|
+
readonly emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
57
50
|
readonly emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
58
51
|
readonly normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
59
52
|
readonly roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
@@ -72,7 +65,7 @@ export declare const PlotPoint3d: import("@motionscript/sdk").Component<"plotPoi
|
|
|
72
65
|
readonly label: import("@motionscript/sdk").Type<string, string, false>;
|
|
73
66
|
/** The height of the label's text, in scene units. */
|
|
74
67
|
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
75
|
-
readonly labelColor: import("@motionscript/sdk").Type<
|
|
68
|
+
readonly labelColor: import("@motionscript/sdk").Type<_Color, _NormalizedColor, false>;
|
|
76
69
|
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
77
70
|
readonly fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
78
71
|
readonly blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
@@ -81,7 +74,7 @@ export declare const PlotPoint3d: import("@motionscript/sdk").Component<"plotPoi
|
|
|
81
74
|
readonly material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
82
75
|
readonly roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
83
76
|
readonly metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
84
|
-
readonly emission: import("@motionscript/sdk").Type<
|
|
77
|
+
readonly emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
85
78
|
readonly emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
86
79
|
readonly normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
87
80
|
readonly roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot-point3d.d.ts","sourceRoot":"","sources":["../../src/three/plot-point3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,
|
|
1
|
+
{"version":3,"file":"plot-point3d.d.ts","sourceRoot":"","sources":["../../src/three/plot-point3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,MAAM,EAEX,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,KAAK,IAAI,MAAM,EACpB,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;;;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 +1 @@
|
|
|
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,
|
|
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,GAcR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;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 {\n component3d,\n Geo,\n Material,\n Types,\n type NodeOf,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Blend3D as _Blend3D,\n type Color as _Color,\n type Faces3D as _Faces3D,\n type Fill3D as _Fill3D,\n type Geometry3D as _Geometry3D,\n type Material3D as _Material3D,\n type Node3D as _Node3D,\n type Node3DProps as _Node3DProps,\n type NormalizedColor as _NormalizedColor,\n type Shading3D as _Shading3D,\n type Texture3D as _Texture3D,\n} from \"@motionscript/sdk\";\nimport { meshEntries } from \"./entries\";\nimport { drawLabel3D } from \"./label3d\";\n\n/**\n * A dot at graph coordinates in a 3D graph, with an optional label. Put inside\n * a surface it rides it: its `x` and `y` say where, and its height is the surface's.\n */\nexport const PlotPoint3d = component3d({\n key: \"plotPoint3d\",\n state: {\n ...meshEntries,\n /** In scene units, so a point is the same size whatever the axes show. */\n radius: Types.number(0.1, { min: 0, step: 0.01 }),\n label: Types.text(\"\", { animatable: false }),\n /** The height of the label's text, in scene units. */\n labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),\n labelColor: Types.color(\"#e5e7eb\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n },\n load: (loader, s) => {\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n },\n render: (ctx, s) => {\n const g3 = Material.mesh(s, s.radius > 0 ? Geo.sphere({ radius: s.radius, segments: [24, 16] }) : undefined);\n drawLabel3D(g3, s.label, { x: 0, y: s.radius + s.labelSize * 0.85, z: 0 }, {\n size: s.labelSize,\n color: s.labelColor,\n fontFamily: s.fontFamily,\n });\n ctx.draw(g3);\n },\n});\n\nexport type PlotPoint3d = NodeOf<typeof PlotPoint3d>;\n"]}
|
package/dist/three/space.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChildSpace3D, type
|
|
1
|
+
import { type ChildSpace3D, 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
|
|
@@ -11,7 +11,7 @@ export interface GraphSpace extends ChildSpace3D {
|
|
|
11
11
|
readonly zRange: Interval;
|
|
12
12
|
/** Changes exactly when the mapping does: what a mark's geometry is cached under. */
|
|
13
13
|
readonly revision: string;
|
|
14
|
-
/** A
|
|
14
|
+
/** A graph step as a local one: what a mark's own geometry is drawn in. */
|
|
15
15
|
offset(x: number, y: number, z: number): Vector3;
|
|
16
16
|
}
|
|
17
17
|
/** The space of a box `lengths` on a side, in scene units, showing the three ranges, centred on its node. */
|
|
@@ -22,17 +22,12 @@ export interface Graph3D {
|
|
|
22
22
|
}
|
|
23
23
|
/** The graph a mark is inside: `axes3d` provides itself to everything in it. */
|
|
24
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
|
-
*/
|
|
25
|
+
/** The entry a mark reads its graph through, set from the nearest `axes3d` above it; `null` outside one. */
|
|
29
26
|
export declare function graphEntry(): Type<Graph3D | null, Graph3D | null, true>;
|
|
30
27
|
/** The graph space a mark with a {@link graphEntry} is drawn in, or `null` outside a graph. */
|
|
31
28
|
export declare function graphOf(mark: {
|
|
32
29
|
readonly graph: Graph3D | null;
|
|
33
30
|
}): GraphSpace | null;
|
|
34
|
-
/** The graph a 3D node is drawn in: what the nearest `axes3d` above it provides, once it is in the tree. */
|
|
35
|
-
export declare function spaceOf(mark: Node3D): GraphSpace | null;
|
|
36
31
|
/** A unit quaternion turning the scene's +y, the way a cylinder or a cone points, onto `direction`. */
|
|
37
32
|
export declare function aim(direction: Vector3): {
|
|
38
33
|
x: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/three/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,YAAY,EACjB,KAAK,
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/three/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,YAAY,EACjB,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;I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