@motionscript/math 0.1.0-alpha.4 → 0.1.0-alpha.6
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 +132 -92
- package/README.md +39 -33
- package/dist/annotate/angle-mark.d.ts +52 -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 +59 -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 +43 -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 +58 -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 +24 -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 +28 -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 +37 -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 +30 -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 +38 -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 +30 -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 +107 -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 +34 -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 +38 -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 +34 -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 +31 -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 +99 -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 +69 -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 +126 -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 +51 -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 +92 -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 +47 -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 +56 -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 +55 -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 +140 -54
- package/dist/three/axes3d.d.ts.map +1 -1
- package/dist/three/axes3d.js +159 -204
- package/dist/three/axes3d.js.map +1 -1
- package/dist/three/curve-plot3d.d.ts +70 -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 +57 -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 +131 -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 +58 -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 +182 -161
- 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
package/dist/three/axes3d.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Canvas3DProps, type Color, 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 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
|
-
import { type GraphSpace } from "./space.js";
|
|
4
3
|
export interface Axes3dProps extends Canvas3DProps {
|
|
5
4
|
xRange?: Interval;
|
|
6
5
|
yRange?: Interval;
|
|
@@ -32,56 +31,143 @@ export interface Axes3dProps extends Canvas3DProps {
|
|
|
32
31
|
* does. Its 3D children sit in its graph coordinates: a surface, a space curve,
|
|
33
32
|
* a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.
|
|
34
33
|
*/
|
|
35
|
-
export declare
|
|
36
|
-
xRange: Interval
|
|
37
|
-
yRange: Interval
|
|
38
|
-
zRange: Interval
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
34
|
+
export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
35
|
+
readonly xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
36
|
+
readonly yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
37
|
+
readonly zRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
38
|
+
readonly xLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
39
|
+
readonly yLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
40
|
+
readonly zLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
41
|
+
readonly xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
42
|
+
readonly yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
43
|
+
readonly zStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
44
|
+
readonly color: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
45
|
+
readonly thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
46
|
+
readonly tips: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
47
|
+
readonly ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
48
|
+
readonly tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
49
|
+
readonly grid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
50
|
+
readonly gridLineColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
51
|
+
readonly labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
52
|
+
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
53
|
+
readonly labelColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
54
|
+
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
55
|
+
readonly xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
56
|
+
readonly yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
57
|
+
readonly zLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
58
|
+
readonly orbit: import("@motionscript/sdk").Type<number, number, false>;
|
|
59
|
+
readonly elevation: import("@motionscript/sdk").Type<number, number, false>;
|
|
60
|
+
readonly zoom: import("@motionscript/sdk").Type<number, number, false>;
|
|
61
|
+
readonly fov: import("@motionscript/sdk").Type<number, number, false>;
|
|
62
|
+
readonly ambientIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
63
|
+
readonly ambientColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
64
|
+
readonly keyIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
65
|
+
readonly keyColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
66
|
+
readonly showGrid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
67
|
+
readonly gridSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
68
|
+
readonly gridDivisions: import("@motionscript/sdk").Type<number, number, false>;
|
|
69
|
+
readonly gridMajorEvery: import("@motionscript/sdk").Type<number, number, false>;
|
|
70
|
+
readonly gridColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
71
|
+
readonly gridMajorColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
72
|
+
readonly showAxes: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
73
|
+
readonly axisXColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
74
|
+
readonly axisZColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
75
|
+
readonly gridFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
76
|
+
readonly gridFadeColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
77
|
+
readonly maxPixelRatio: import("@motionscript/sdk").Type<number, number, false>;
|
|
78
|
+
readonly antialias: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
79
|
+
readonly shadows: import("@motionscript/sdk").Type<_Shadows3D, _Shadows3D, false>;
|
|
80
|
+
readonly tone: import("@motionscript/sdk").Type<_ToneMapping3D | undefined, _ToneMapping3D | undefined, false>;
|
|
81
|
+
readonly exposure: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
82
|
+
readonly post: import("@motionscript/sdk").Type<_PostEffect3D | readonly _PostEffect3D[] | undefined, _PostEffect3D | readonly _PostEffect3D[] | undefined, false>;
|
|
83
|
+
readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
|
|
84
|
+
readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
|
|
85
|
+
readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
|
|
86
|
+
readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
|
|
87
|
+
readonly wrap: boolean;
|
|
88
|
+
readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
89
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
90
|
+
readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
|
|
91
|
+
readonly fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
92
|
+
readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
93
|
+
readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
94
|
+
readonly overlay: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
95
|
+
readonly start: import("@motionscript/sdk").Type<number, number, false>;
|
|
96
|
+
readonly end: import("@motionscript/sdk").Type<number, number, false>;
|
|
97
|
+
}>, {
|
|
98
|
+
readonly rangeTo: readonly ["xRange", "yRange", "zRange"];
|
|
99
|
+
readonly orbitTo: readonly ["orbit", "elevation", "zoom"];
|
|
100
|
+
readonly fillTo: readonly ["fill"];
|
|
101
|
+
readonly strokeTo: readonly ["stroke"];
|
|
102
|
+
readonly shadowTo: readonly ["shadow"];
|
|
103
|
+
readonly overlayTo: readonly ["overlay"];
|
|
104
|
+
readonly progressTo: readonly ["start", "end"];
|
|
105
|
+
readonly flash: {
|
|
106
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
107
|
+
};
|
|
108
|
+
}, readonly ["2d", "3d"], _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
109
|
+
readonly xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
110
|
+
readonly yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
111
|
+
readonly zRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
112
|
+
readonly xLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
113
|
+
readonly yLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
114
|
+
readonly zLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
115
|
+
readonly xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
116
|
+
readonly yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
117
|
+
readonly zStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
118
|
+
readonly color: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
119
|
+
readonly thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
120
|
+
readonly tips: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
121
|
+
readonly ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
122
|
+
readonly tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
123
|
+
readonly grid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
124
|
+
readonly gridLineColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
125
|
+
readonly labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
126
|
+
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
127
|
+
readonly labelColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
128
|
+
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
129
|
+
readonly xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
130
|
+
readonly yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
131
|
+
readonly zLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
132
|
+
readonly orbit: import("@motionscript/sdk").Type<number, number, false>;
|
|
133
|
+
readonly elevation: import("@motionscript/sdk").Type<number, number, false>;
|
|
134
|
+
readonly zoom: import("@motionscript/sdk").Type<number, number, false>;
|
|
135
|
+
readonly fov: import("@motionscript/sdk").Type<number, number, false>;
|
|
136
|
+
readonly ambientIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
137
|
+
readonly ambientColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
138
|
+
readonly keyIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
139
|
+
readonly keyColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
140
|
+
readonly showGrid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
141
|
+
readonly gridSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
142
|
+
readonly gridDivisions: import("@motionscript/sdk").Type<number, number, false>;
|
|
143
|
+
readonly gridMajorEvery: import("@motionscript/sdk").Type<number, number, false>;
|
|
144
|
+
readonly gridColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
145
|
+
readonly gridMajorColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
146
|
+
readonly showAxes: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
147
|
+
readonly axisXColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
148
|
+
readonly axisZColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
149
|
+
readonly gridFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
150
|
+
readonly gridFadeColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
151
|
+
readonly maxPixelRatio: import("@motionscript/sdk").Type<number, number, false>;
|
|
152
|
+
readonly antialias: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
153
|
+
readonly shadows: import("@motionscript/sdk").Type<_Shadows3D, _Shadows3D, false>;
|
|
154
|
+
readonly tone: import("@motionscript/sdk").Type<_ToneMapping3D | undefined, _ToneMapping3D | undefined, false>;
|
|
155
|
+
readonly exposure: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
156
|
+
readonly post: import("@motionscript/sdk").Type<_PostEffect3D | readonly _PostEffect3D[] | undefined, _PostEffect3D | readonly _PostEffect3D[] | undefined, false>;
|
|
157
|
+
readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
|
|
158
|
+
readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
|
|
159
|
+
readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
|
|
160
|
+
readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
|
|
161
|
+
readonly wrap: boolean;
|
|
162
|
+
readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
163
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
164
|
+
readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
|
|
165
|
+
readonly fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
166
|
+
readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
167
|
+
readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
168
|
+
readonly overlay: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
169
|
+
readonly start: import("@motionscript/sdk").Type<number, number, false>;
|
|
170
|
+
readonly end: import("@motionscript/sdk").Type<number, number, false>;
|
|
171
|
+
}>, readonly ["2d", "3d"]>>;
|
|
172
|
+
export type Axes3d = NodeOf<typeof Axes3d>;
|
|
87
173
|
//# sourceMappingURL=axes3d.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axes3d.d.ts","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"axes3d.d.ts","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAWH,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,MAAM,EAMX,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,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;AAO9C,MAAM,WAAW,WAAY,SAAQ,aAAa;IAC9C,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAsDD;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAoBjB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/three/axes3d.js
CHANGED
|
@@ -1,228 +1,183 @@
|
|
|
1
|
-
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
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 { Canvas3D, colorProperty, command, Geo, Graphics3D, Mat, node, property, } from "@motionscript/sdk";
|
|
1
|
+
import { component2d, Flow, Geo, Graphics3D, Mat, Paint, provides, Shapes, Types, View3D, } from "@motionscript/sdk";
|
|
8
2
|
import { AXIS_COLOR, lerpInterval, readInterval } from "../kit/furniture.js";
|
|
9
|
-
import { clamp
|
|
3
|
+
import { clamp } from "../kit/geometry.js";
|
|
10
4
|
import { formatTick, ticksFor } from "../kit/ticks.js";
|
|
11
5
|
import { drawLabel3D } from "./label3d.js";
|
|
12
|
-
import { graphSpace } from "./space.js";
|
|
6
|
+
import { GRAPH_3D, graphSpace } from "./space.js";
|
|
13
7
|
/** How many pixels of a 2D axis one scene unit counts as, when an axis picks its own tick spacing. */
|
|
14
8
|
const UNIT_AS_PIXELS = 64;
|
|
15
9
|
/** The turn that lays a shape built along the scene's +y along each graph axis. */
|
|
16
10
|
const ALONG = { x: [90, 0, 0], y: [0, 0, -90], z: [0, 0, 0] };
|
|
17
11
|
/** The graph axis each axis's tick marks lie along. */
|
|
18
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
|
+
/** The axes' own entries, beside a 3D canvas's. */
|
|
17
|
+
const own = {
|
|
18
|
+
xRange: range([-3, 3]),
|
|
19
|
+
yRange: range([-3, 3]),
|
|
20
|
+
zRange: range([-2, 2]),
|
|
21
|
+
/** How long each axis is drawn, in scene units. */
|
|
22
|
+
xLength: Types.number(6, { min: 0.01, step: 0.1 }),
|
|
23
|
+
yLength: Types.number(6, { min: 0.01, step: 0.1 }),
|
|
24
|
+
zLength: Types.number(4, { min: 0.01, step: 0.1 }),
|
|
25
|
+
/** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */
|
|
26
|
+
xStep: Types.number(0, { min: 0 }),
|
|
27
|
+
yStep: Types.number(0, { min: 0 }),
|
|
28
|
+
zStep: Types.number(0, { min: 0 }),
|
|
29
|
+
color: Types.color(AXIS_COLOR),
|
|
30
|
+
/** The radius of an axis line, in scene units. */
|
|
31
|
+
thickness: Types.number(0.02, { min: 0, step: 0.005 }),
|
|
32
|
+
tips: Types.boolean(true, { animatable: false }),
|
|
33
|
+
ticks: Types.boolean(true, { animatable: false }),
|
|
34
|
+
tickSize: Types.number(0.16, { min: 0, step: 0.01 }),
|
|
35
|
+
/** Lines across the plane the x and y axes lie in, at each of their ticks. */
|
|
36
|
+
grid: Types.boolean(false, { animatable: false }),
|
|
37
|
+
/** (`gridColor` is the viewport's own reference grid.) */
|
|
38
|
+
gridLineColor: Types.color("#374151"),
|
|
39
|
+
/** A number at each tick. */
|
|
40
|
+
labels: Types.boolean(false, { animatable: false }),
|
|
41
|
+
/** The height of a label's text, in scene units. */
|
|
42
|
+
labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),
|
|
43
|
+
labelColor: Types.color(AXIS_COLOR),
|
|
44
|
+
fontFamily: Types.text("", { animatable: false }),
|
|
45
|
+
/** A title at the positive end of each axis. */
|
|
46
|
+
xLabel: Types.text("x", { animatable: false }),
|
|
47
|
+
yLabel: Types.text("y", { animatable: false }),
|
|
48
|
+
zLabel: Types.text("z", { animatable: false }),
|
|
49
|
+
};
|
|
19
50
|
/**
|
|
20
51
|
* A 3D graph: three axes through a box of graph coordinates, z up, seen through
|
|
21
52
|
* a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`
|
|
22
53
|
* does. Its 3D children sit in its graph coordinates: a surface, a space curve,
|
|
23
54
|
* a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.
|
|
24
55
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
moved.y += by;
|
|
88
|
-
}
|
|
89
|
-
return { x: local.x + moved.x, y: local.y + moved.y, z: local.z + moved.z };
|
|
90
|
-
};
|
|
91
|
-
const { thickness, tickSize } = this;
|
|
92
|
-
const paint = Mat.basic({ color: this.color });
|
|
93
|
-
const style = { size: this.labelSize, color: this.labelColor, fontFamily: this.fontFamily };
|
|
94
|
-
const tipLength = this.tips ? thickness * 9 : 0;
|
|
95
|
-
const marks = [];
|
|
96
|
-
const plane = [];
|
|
97
|
-
for (const axis of ["x", "y", "z"]) {
|
|
98
|
-
const [min, max] = ranges[axis];
|
|
99
|
-
const length = lengths[axis];
|
|
100
|
-
if (!(max > min) || !(length > 0))
|
|
56
|
+
export const Axes3d = component2d({
|
|
57
|
+
key: "axes3d",
|
|
58
|
+
state: { ...Paint.state, ...Flow.state, ...Shapes.corners, ...View3D.state, ...own },
|
|
59
|
+
defaults: { width: "fill", height: "fill" },
|
|
60
|
+
commands: {
|
|
61
|
+
...Paint.commands,
|
|
62
|
+
...View3D.commands,
|
|
63
|
+
/** Animate the window of values the axes show; everything drawn in them follows. */
|
|
64
|
+
rangeTo: { args: ["xRange", "yRange", "zRange"] },
|
|
65
|
+
},
|
|
66
|
+
allowedChildren: ["2d", "3d"],
|
|
67
|
+
load: (loader, s) => {
|
|
68
|
+
View3D.load(loader);
|
|
69
|
+
if (s.fontFamily !== "")
|
|
70
|
+
loader.font(s.fontFamily);
|
|
71
|
+
},
|
|
72
|
+
provide: (s) => [provides(GRAPH_3D, graphOfAxes(s))],
|
|
73
|
+
space: (s) => axesSpace(s),
|
|
74
|
+
measure: (measurer, s, children) => Flow.measure(measurer, s, children, Paint.inset(s)),
|
|
75
|
+
layout: (box, s, children) => Flow.layout(box, s, children, Paint.inset(s)),
|
|
76
|
+
render: (ctx, s) => View3D.draw(ctx, s, (scene) => scene.draw(furniture(s))),
|
|
77
|
+
});
|
|
78
|
+
/** The last space worked out for each axes, kept while its ranges and lengths are unchanged. */
|
|
79
|
+
const spaces = new WeakMap();
|
|
80
|
+
/** The coordinates of a 3D graph: what its children's `x`, `y` and `z` are in. */
|
|
81
|
+
function axesSpace(s) {
|
|
82
|
+
const { xRange, yRange, zRange, xLength, yLength, zLength } = s;
|
|
83
|
+
const key = [xRange, yRange, zRange, xLength, yLength, zLength].join("|");
|
|
84
|
+
let kept = spaces.get(s);
|
|
85
|
+
if (kept?.key !== key)
|
|
86
|
+
spaces.set(s, (kept = { key, space: graphSpace(xRange, yRange, zRange, { x: xLength, y: yLength, z: zLength }) }));
|
|
87
|
+
return kept.space;
|
|
88
|
+
}
|
|
89
|
+
// One per axes, so the context its subtree holds is the same from frame to frame.
|
|
90
|
+
const graphs = new WeakMap();
|
|
91
|
+
function graphOfAxes(s) {
|
|
92
|
+
let graph = graphs.get(s);
|
|
93
|
+
if (!graph)
|
|
94
|
+
graphs.set(s, (graph = { space: () => axesSpace(s) }));
|
|
95
|
+
return graph;
|
|
96
|
+
}
|
|
97
|
+
/** The axes, their ticks, numbers and titles, and the grid, in the scene's units. */
|
|
98
|
+
function furniture(s) {
|
|
99
|
+
const space = axesSpace(s);
|
|
100
|
+
const g3 = new Graphics3D();
|
|
101
|
+
const ranges = { x: space.xRange, y: space.yRange, z: space.zRange };
|
|
102
|
+
const lengths = { x: s.xLength, y: s.yLength, z: s.zLength };
|
|
103
|
+
const steps = { x: s.xStep, y: s.yStep, z: s.zStep };
|
|
104
|
+
const titles = { x: s.xLabel, y: s.yLabel, z: s.zLabel };
|
|
105
|
+
// Where each axis is crossed by the other two: their zero, or the nearest end of a range without one.
|
|
106
|
+
const cross = {
|
|
107
|
+
x: clamp(0, ranges.x[0], ranges.x[1]),
|
|
108
|
+
y: clamp(0, ranges.y[0], ranges.y[1]),
|
|
109
|
+
z: clamp(0, ranges.z[0], ranges.z[1]),
|
|
110
|
+
};
|
|
111
|
+
const at = (axis, value, shift = {}) => {
|
|
112
|
+
const point = { ...cross, [axis]: value };
|
|
113
|
+
const local = space.toLocal(point.x, point.y, point.z);
|
|
114
|
+
const moved = space.offset(0, 0, 0);
|
|
115
|
+
for (const key of ["x", "y", "z"]) {
|
|
116
|
+
const by = shift[key];
|
|
117
|
+
if (by === undefined)
|
|
101
118
|
continue;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
119
|
+
// A shift is in scene units, along the graph axis it names.
|
|
120
|
+
if (key === "x")
|
|
121
|
+
moved.z += by;
|
|
122
|
+
else if (key === "y")
|
|
123
|
+
moved.x += by;
|
|
124
|
+
else
|
|
125
|
+
moved.y += by;
|
|
126
|
+
}
|
|
127
|
+
return { x: local.x + moved.x, y: local.y + moved.y, z: local.z + moved.z };
|
|
128
|
+
};
|
|
129
|
+
const { thickness, tickSize } = s;
|
|
130
|
+
const paint = Mat.basic({ color: s.color });
|
|
131
|
+
const style = { size: s.labelSize, color: s.labelColor, fontFamily: s.fontFamily };
|
|
132
|
+
const tipLength = s.tips ? thickness * 9 : 0;
|
|
133
|
+
const marks = [];
|
|
134
|
+
const plane = [];
|
|
135
|
+
for (const axis of ["x", "y", "z"]) {
|
|
136
|
+
const [min, max] = ranges[axis];
|
|
137
|
+
const length = lengths[axis];
|
|
138
|
+
if (!(max > min) || !(length > 0))
|
|
139
|
+
continue;
|
|
140
|
+
if (thickness > 0) {
|
|
141
|
+
const from = at(axis, min);
|
|
142
|
+
const to = at(axis, max);
|
|
143
|
+
g3.mesh(Geo.cylinder({ radius: thickness, height: length, segments: [12, 1] }), paint, {
|
|
144
|
+
position: { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2, z: (from.z + to.z) / 2 },
|
|
145
|
+
rotation: ALONG[axis],
|
|
146
|
+
});
|
|
147
|
+
if (s.tips) {
|
|
148
|
+
g3.mesh(Geo.cone({ radius: thickness * 3.2, height: tipLength, segments: [16, 1] }), paint, {
|
|
149
|
+
position: at(axis, max, { [axis]: tipLength / 2 }),
|
|
107
150
|
rotation: ALONG[axis],
|
|
108
151
|
});
|
|
109
|
-
if (this.tips) {
|
|
110
|
-
g3.mesh(Geo.cone({ radius: thickness * 3.2, height: tipLength, segments: [16, 1] }), paint, {
|
|
111
|
-
position: at(axis, max, { [axis]: tipLength / 2 }),
|
|
112
|
-
rotation: ALONG[axis],
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const ticks = ticksFor(ranges[axis], steps[axis], length * UNIT_AS_PIXELS);
|
|
117
|
-
const side = TICK_ALONG[axis];
|
|
118
|
-
for (const value of ticks.values) {
|
|
119
|
-
// The crossing is marked by the other axes, and the far end by the tip.
|
|
120
|
-
if (Math.abs(value - cross[axis]) < 1e-9 || (this.tips && Math.abs(value - max) < 1e-9))
|
|
121
|
-
continue;
|
|
122
|
-
if (this.ticks && tickSize > 0)
|
|
123
|
-
marks.push({ position: at(axis, value), rotation: ALONG[side] });
|
|
124
|
-
if (this.labels) {
|
|
125
|
-
drawLabel3D(g3, formatTick(value, ticks.step), at(axis, value, { [side]: -(tickSize / 2 + style.size * 0.8) }), style);
|
|
126
|
-
}
|
|
127
152
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
153
|
+
}
|
|
154
|
+
const ticks = ticksFor(ranges[axis], steps[axis], length * UNIT_AS_PIXELS);
|
|
155
|
+
const side = TICK_ALONG[axis];
|
|
156
|
+
for (const value of ticks.values) {
|
|
157
|
+
// The crossing is marked by the other axes, and the far end by the tip.
|
|
158
|
+
if (Math.abs(value - cross[axis]) < 1e-9 || (s.tips && Math.abs(value - max) < 1e-9))
|
|
159
|
+
continue;
|
|
160
|
+
if (s.ticks && tickSize > 0)
|
|
161
|
+
marks.push({ position: at(axis, value), rotation: ALONG[side] });
|
|
162
|
+
if (s.labels) {
|
|
163
|
+
drawLabel3D(g3, formatTick(value, ticks.step), at(axis, value, { [side]: -(tickSize / 2 + style.size * 0.8) }), style);
|
|
136
164
|
}
|
|
137
165
|
}
|
|
138
|
-
|
|
139
|
-
|
|
166
|
+
drawLabel3D(g3, titles[axis], at(axis, max, { [axis]: tipLength + style.size * 0.9 }), style);
|
|
167
|
+
if (s.grid && axis !== "z") {
|
|
168
|
+
const other = axis === "x" ? "y" : "x";
|
|
169
|
+
for (const value of ticks.values) {
|
|
170
|
+
const a = { x: 0, y: 0, z: cross.z, [axis]: value, [other]: ranges[other][0] };
|
|
171
|
+
const b = { ...a, [other]: ranges[other][1] };
|
|
172
|
+
plane.push(space.toLocal(a.x, a.y, a.z), space.toLocal(b.x, b.y, b.z));
|
|
173
|
+
}
|
|
140
174
|
}
|
|
141
|
-
if (plane.length > 0)
|
|
142
|
-
g3.line({ points: plane, segments: true, stroke: { fill: this.gridLineColor } });
|
|
143
|
-
return g3;
|
|
144
175
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
__decorate([
|
|
153
|
-
property({ default: [-2, 2], mapper: readInterval, tween: lerpInterval })
|
|
154
|
-
], Axes3d.prototype, "zRange", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
property({ default: 6, min: 0.01, step: 0.1 })
|
|
157
|
-
], Axes3d.prototype, "xLength", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
property({ default: 6, min: 0.01, step: 0.1 })
|
|
160
|
-
], Axes3d.prototype, "yLength", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
property({ default: 4, min: 0.01, step: 0.1 })
|
|
163
|
-
], Axes3d.prototype, "zLength", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
property({ default: 0, min: 0 })
|
|
166
|
-
], Axes3d.prototype, "xStep", void 0);
|
|
167
|
-
__decorate([
|
|
168
|
-
property({ default: 0, min: 0 })
|
|
169
|
-
], Axes3d.prototype, "yStep", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
property({ default: 0, min: 0 })
|
|
172
|
-
], Axes3d.prototype, "zStep", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
colorProperty({ default: AXIS_COLOR })
|
|
175
|
-
], Axes3d.prototype, "color", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
property({ default: 0.02, min: 0, step: 0.005 })
|
|
178
|
-
], Axes3d.prototype, "thickness", void 0);
|
|
179
|
-
__decorate([
|
|
180
|
-
property({ default: true, animatable: false })
|
|
181
|
-
], Axes3d.prototype, "tips", void 0);
|
|
182
|
-
__decorate([
|
|
183
|
-
property({ default: true, animatable: false })
|
|
184
|
-
], Axes3d.prototype, "ticks", void 0);
|
|
185
|
-
__decorate([
|
|
186
|
-
property({ default: 0.16, min: 0, step: 0.01 })
|
|
187
|
-
], Axes3d.prototype, "tickSize", void 0);
|
|
188
|
-
__decorate([
|
|
189
|
-
property({ default: false, animatable: false })
|
|
190
|
-
], Axes3d.prototype, "grid", void 0);
|
|
191
|
-
__decorate([
|
|
192
|
-
colorProperty({ default: "#374151" })
|
|
193
|
-
], Axes3d.prototype, "gridLineColor", void 0);
|
|
194
|
-
__decorate([
|
|
195
|
-
property({ default: false, animatable: false })
|
|
196
|
-
], Axes3d.prototype, "labels", void 0);
|
|
197
|
-
__decorate([
|
|
198
|
-
property({ default: 0.26, min: 0.01, step: 0.01 })
|
|
199
|
-
], Axes3d.prototype, "labelSize", void 0);
|
|
200
|
-
__decorate([
|
|
201
|
-
colorProperty({ default: AXIS_COLOR })
|
|
202
|
-
], Axes3d.prototype, "labelColor", void 0);
|
|
203
|
-
__decorate([
|
|
204
|
-
property({ default: "", animatable: false })
|
|
205
|
-
], Axes3d.prototype, "fontFamily", void 0);
|
|
206
|
-
__decorate([
|
|
207
|
-
property({ default: "x", animatable: false })
|
|
208
|
-
], Axes3d.prototype, "xLabel", void 0);
|
|
209
|
-
__decorate([
|
|
210
|
-
property({ default: "y", animatable: false })
|
|
211
|
-
], Axes3d.prototype, "yLabel", void 0);
|
|
212
|
-
__decorate([
|
|
213
|
-
property({ default: "z", animatable: false })
|
|
214
|
-
], Axes3d.prototype, "zLabel", void 0);
|
|
215
|
-
__decorate([
|
|
216
|
-
command({ args: ["xRange", "yRange", "zRange"] })
|
|
217
|
-
], Axes3d.prototype, "rangeTo", null);
|
|
218
|
-
Axes3d = __decorate([
|
|
219
|
-
node({
|
|
220
|
-
key: "axes3d",
|
|
221
|
-
parentKey: "canvas3d",
|
|
222
|
-
forkable: true,
|
|
223
|
-
layout: { defaultWidthMode: "fixed", defaultHeightMode: "fixed", acceptsChildren: true },
|
|
224
|
-
seed: { width: 800, height: 500 },
|
|
225
|
-
})
|
|
226
|
-
], Axes3d);
|
|
227
|
-
export { Axes3d };
|
|
176
|
+
if (marks.length > 0) {
|
|
177
|
+
g3.instances(Geo.cylinder({ radius: Math.max(thickness * 0.7, 0.008), height: tickSize, segments: [8, 1] }), paint, marks);
|
|
178
|
+
}
|
|
179
|
+
if (plane.length > 0)
|
|
180
|
+
g3.line({ points: plane, segments: true, stroke: { fill: s.gridLineColor } });
|
|
181
|
+
return g3;
|
|
182
|
+
}
|
|
228
183
|
//# sourceMappingURL=axes3d.js.map
|