@motionscript/math 0.0.0-stage → 0.1.0-alpha.5
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 +110 -0
- package/LICENSE +201 -0
- package/NOTICE +48 -0
- package/README.md +385 -3
- package/dist/annotate/angle-mark.d.ts +46 -0
- package/dist/annotate/angle-mark.d.ts.map +1 -0
- package/dist/annotate/angle-mark.js +132 -0
- package/dist/annotate/angle-mark.js.map +1 -0
- package/dist/annotate/curly-brace.d.ts +46 -0
- package/dist/annotate/curly-brace.d.ts.map +1 -0
- package/dist/annotate/curly-brace.js +114 -0
- package/dist/annotate/curly-brace.js.map +1 -0
- package/dist/annotate/emphasis-mark.d.ts +20 -0
- package/dist/annotate/emphasis-mark.d.ts.map +1 -0
- package/dist/annotate/emphasis-mark.js +81 -0
- package/dist/annotate/emphasis-mark.js.map +1 -0
- package/dist/browser/THIRD_PARTY_LICENSES.txt +420 -0
- package/dist/browser/chunks/chunk-3GJB6AVO.js +2 -0
- package/dist/browser/chunks/chunk-3GJB6AVO.js.map +7 -0
- package/dist/browser/chunks/chunk-D5WHCVBC.js +2 -0
- package/dist/browser/chunks/chunk-D5WHCVBC.js.map +7 -0
- package/dist/browser/chunks/chunk-WL4KEX7Y.js +2 -0
- package/dist/browser/chunks/chunk-WL4KEX7Y.js.map +7 -0
- package/dist/browser/chunks/mathjax-DNP3YRES.js +61 -0
- package/dist/browser/chunks/mathjax-DNP3YRES.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +30 -0
- package/dist/browser/tex.js +2 -0
- package/dist/browser/tex.js.map +7 -0
- package/dist/engine.d.ts +64 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +42 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/brace.d.ts +8 -0
- package/dist/kit/brace.d.ts.map +1 -0
- package/dist/kit/brace.js +36 -0
- package/dist/kit/brace.js.map +1 -0
- package/dist/kit/cache.d.ts +30 -0
- package/dist/kit/cache.d.ts.map +1 -0
- package/dist/kit/cache.js +53 -0
- package/dist/kit/cache.js.map +1 -0
- package/dist/kit/contour.d.ts +8 -0
- package/dist/kit/contour.d.ts.map +1 -0
- package/dist/kit/contour.js +93 -0
- package/dist/kit/contour.js.map +1 -0
- package/dist/kit/coords.d.ts +69 -0
- package/dist/kit/coords.d.ts.map +1 -0
- package/dist/kit/coords.js +224 -0
- package/dist/kit/coords.js.map +1 -0
- package/dist/kit/curve.d.ts +17 -0
- package/dist/kit/curve.d.ts.map +1 -0
- package/dist/kit/curve.js +22 -0
- package/dist/kit/curve.js.map +1 -0
- package/dist/kit/equation.d.ts +61 -0
- package/dist/kit/equation.d.ts.map +1 -0
- package/dist/kit/equation.js +168 -0
- package/dist/kit/equation.js.map +1 -0
- package/dist/kit/equation3d.d.ts +50 -0
- package/dist/kit/equation3d.d.ts.map +1 -0
- package/dist/kit/equation3d.js +103 -0
- package/dist/kit/equation3d.js.map +1 -0
- package/dist/kit/expression.d.ts +35 -0
- package/dist/kit/expression.d.ts.map +1 -0
- package/dist/kit/expression.js +124 -0
- package/dist/kit/expression.js.map +1 -0
- package/dist/kit/field-mark.d.ts +58 -0
- package/dist/kit/field-mark.d.ts.map +1 -0
- package/dist/kit/field-mark.js +129 -0
- package/dist/kit/field-mark.js.map +1 -0
- package/dist/kit/field.d.ts +14 -0
- package/dist/kit/field.d.ts.map +1 -0
- package/dist/kit/field.js +46 -0
- package/dist/kit/field.js.map +1 -0
- package/dist/kit/follow.d.ts +71 -0
- package/dist/kit/follow.d.ts.map +1 -0
- package/dist/kit/follow.js +159 -0
- package/dist/kit/follow.js.map +1 -0
- package/dist/kit/furniture.d.ts +30 -0
- package/dist/kit/furniture.d.ts.map +1 -0
- package/dist/kit/furniture.js +87 -0
- package/dist/kit/furniture.js.map +1 -0
- package/dist/kit/geometry.d.ts +13 -0
- package/dist/kit/geometry.d.ts.map +1 -0
- package/dist/kit/geometry.js +54 -0
- package/dist/kit/geometry.js.map +1 -0
- package/dist/kit/mark.d.ts +47 -0
- package/dist/kit/mark.d.ts.map +1 -0
- package/dist/kit/mark.js +103 -0
- package/dist/kit/mark.js.map +1 -0
- package/dist/kit/part-fills.d.ts +23 -0
- package/dist/kit/part-fills.d.ts.map +1 -0
- package/dist/kit/part-fills.js +46 -0
- package/dist/kit/part-fills.js.map +1 -0
- package/dist/kit/place.d.ts +18 -0
- package/dist/kit/place.d.ts.map +1 -0
- package/dist/kit/place.js +68 -0
- package/dist/kit/place.js.map +1 -0
- package/dist/kit/placement.d.ts +8 -0
- package/dist/kit/placement.d.ts.map +1 -0
- package/dist/kit/placement.js +8 -0
- package/dist/kit/placement.js.map +1 -0
- package/dist/kit/sampler.d.ts +17 -0
- package/dist/kit/sampler.d.ts.map +1 -0
- package/dist/kit/sampler.js +250 -0
- package/dist/kit/sampler.js.map +1 -0
- package/dist/kit/scale.d.ts +12 -0
- package/dist/kit/scale.d.ts.map +1 -0
- package/dist/kit/scale.js +37 -0
- package/dist/kit/scale.js.map +1 -0
- package/dist/kit/source.d.ts +22 -0
- package/dist/kit/source.d.ts.map +1 -0
- package/dist/kit/source.js +45 -0
- package/dist/kit/source.js.map +1 -0
- package/dist/kit/system.d.ts +33 -0
- package/dist/kit/system.d.ts.map +1 -0
- package/dist/kit/system.js +67 -0
- package/dist/kit/system.js.map +1 -0
- package/dist/kit/ticks.d.ts +19 -0
- package/dist/kit/ticks.d.ts.map +1 -0
- package/dist/kit/ticks.js +78 -0
- package/dist/kit/ticks.js.map +1 -0
- package/dist/kit/withdrawn.d.ts +9 -0
- package/dist/kit/withdrawn.d.ts.map +1 -0
- package/dist/kit/withdrawn.js +9 -0
- package/dist/kit/withdrawn.js.map +1 -0
- package/dist/marks/curve-area.d.ts +32 -0
- package/dist/marks/curve-area.d.ts.map +1 -0
- package/dist/marks/curve-area.js +82 -0
- package/dist/marks/curve-area.js.map +1 -0
- package/dist/marks/drop-lines.d.ts +22 -0
- package/dist/marks/drop-lines.d.ts.map +1 -0
- package/dist/marks/drop-lines.js +58 -0
- package/dist/marks/drop-lines.js.map +1 -0
- package/dist/marks/plot-point.d.ts +35 -0
- package/dist/marks/plot-point.d.ts.map +1 -0
- package/dist/marks/plot-point.js +97 -0
- package/dist/marks/plot-point.js.map +1 -0
- package/dist/marks/riemann-sum.d.ts +37 -0
- package/dist/marks/riemann-sum.d.ts.map +1 -0
- package/dist/marks/riemann-sum.js +91 -0
- package/dist/marks/riemann-sum.js.map +1 -0
- package/dist/marks/tangent-line.d.ts +27 -0
- package/dist/marks/tangent-line.d.ts.map +1 -0
- package/dist/marks/tangent-line.js +103 -0
- package/dist/marks/tangent-line.js.map +1 -0
- package/dist/marks/vector-arrow.d.ts +32 -0
- package/dist/marks/vector-arrow.d.ts.map +1 -0
- package/dist/marks/vector-arrow.js +87 -0
- package/dist/marks/vector-arrow.js.map +1 -0
- package/dist/nodes.d.ts +35 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +63 -0
- package/dist/nodes.js.map +1 -0
- package/dist/plots/function-plot.d.ts +67 -0
- package/dist/plots/function-plot.d.ts.map +1 -0
- package/dist/plots/function-plot.js +215 -0
- package/dist/plots/function-plot.js.map +1 -0
- package/dist/plots/points-plot.d.ts +28 -0
- package/dist/plots/points-plot.d.ts.map +1 -0
- package/dist/plots/points-plot.js +99 -0
- package/dist/plots/points-plot.js.map +1 -0
- package/dist/plots/stream-lines.d.ts +35 -0
- package/dist/plots/stream-lines.d.ts.map +1 -0
- package/dist/plots/stream-lines.js +141 -0
- package/dist/plots/stream-lines.js.map +1 -0
- package/dist/plots/traced-path.d.ts +31 -0
- package/dist/plots/traced-path.d.ts.map +1 -0
- package/dist/plots/traced-path.js +56 -0
- package/dist/plots/traced-path.js.map +1 -0
- package/dist/plots/vector-field.d.ts +23 -0
- package/dist/plots/vector-field.d.ts.map +1 -0
- package/dist/plots/vector-field.js +91 -0
- package/dist/plots/vector-field.js.map +1 -0
- package/dist/structures/graph-layout.d.ts +11 -0
- package/dist/structures/graph-layout.d.ts.map +1 -0
- package/dist/structures/graph-layout.js +135 -0
- package/dist/structures/graph-layout.js.map +1 -0
- package/dist/structures/network-graph.d.ts +83 -0
- package/dist/structures/network-graph.d.ts.map +1 -0
- package/dist/structures/network-graph.js +289 -0
- package/dist/structures/network-graph.js.map +1 -0
- package/dist/structures/sample-space.d.ts +62 -0
- package/dist/structures/sample-space.d.ts.map +1 -0
- package/dist/structures/sample-space.js +199 -0
- package/dist/structures/sample-space.js.map +1 -0
- package/dist/systems/axes2d.d.ts +75 -0
- package/dist/systems/axes2d.d.ts.map +1 -0
- package/dist/systems/axes2d.js +193 -0
- package/dist/systems/axes2d.js.map +1 -0
- package/dist/systems/number-line.d.ts +49 -0
- package/dist/systems/number-line.d.ts.map +1 -0
- package/dist/systems/number-line.js +127 -0
- package/dist/systems/number-line.js.map +1 -0
- package/dist/systems/number-plane.d.ts +59 -0
- package/dist/systems/number-plane.d.ts.map +1 -0
- package/dist/systems/number-plane.js +193 -0
- package/dist/systems/number-plane.js.map +1 -0
- package/dist/systems/polar-plane.d.ts +48 -0
- package/dist/systems/polar-plane.d.ts.map +1 -0
- package/dist/systems/polar-plane.js +165 -0
- package/dist/systems/polar-plane.js.map +1 -0
- package/dist/tex/geometry.d.ts +85 -0
- package/dist/tex/geometry.d.ts.map +1 -0
- package/dist/tex/geometry.js +632 -0
- package/dist/tex/geometry.js.map +1 -0
- package/dist/tex/index.d.ts +11 -0
- package/dist/tex/index.d.ts.map +1 -0
- package/dist/tex/index.js +9 -0
- package/dist/tex/index.js.map +1 -0
- package/dist/tex/mathjax.d.ts +33 -0
- package/dist/tex/mathjax.d.ts.map +1 -0
- package/dist/tex/mathjax.js +74 -0
- package/dist/tex/mathjax.js.map +1 -0
- package/dist/tex/matrix.d.ts +31 -0
- package/dist/tex/matrix.d.ts.map +1 -0
- package/dist/tex/matrix.js +73 -0
- package/dist/tex/matrix.js.map +1 -0
- package/dist/tex/node.d.ts +215 -0
- package/dist/tex/node.d.ts.map +1 -0
- package/dist/tex/node.js +595 -0
- package/dist/tex/node.js.map +1 -0
- package/dist/tex/tween.d.ts +50 -0
- package/dist/tex/tween.d.ts.map +1 -0
- package/dist/tex/tween.js +253 -0
- package/dist/tex/tween.js.map +1 -0
- package/dist/three/axes3d.d.ts +87 -0
- package/dist/three/axes3d.d.ts.map +1 -0
- package/dist/three/axes3d.js +228 -0
- package/dist/three/axes3d.js.map +1 -0
- package/dist/three/curve-plot3d.d.ts +60 -0
- package/dist/three/curve-plot3d.d.ts.map +1 -0
- package/dist/three/curve-plot3d.js +143 -0
- package/dist/three/curve-plot3d.js.map +1 -0
- package/dist/three/label3d.d.ts +11 -0
- package/dist/three/label3d.d.ts.map +1 -0
- package/dist/three/label3d.js +40 -0
- package/dist/three/label3d.js.map +1 -0
- package/dist/three/plot-point3d.d.ts +26 -0
- package/dist/three/plot-point3d.d.ts.map +1 -0
- package/dist/three/plot-point3d.js +60 -0
- package/dist/three/plot-point3d.js.map +1 -0
- package/dist/three/space.d.ts +28 -0
- package/dist/three/space.d.ts.map +1 -0
- package/dist/three/space.js +47 -0
- package/dist/three/space.js.map +1 -0
- package/dist/three/surface-plot3d.d.ts +80 -0
- package/dist/three/surface-plot3d.d.ts.map +1 -0
- package/dist/three/surface-plot3d.js +290 -0
- package/dist/three/surface-plot3d.js.map +1 -0
- package/dist/three/vector-arrow3d.d.ts +25 -0
- package/dist/three/vector-arrow3d.d.ts.map +1 -0
- package/dist/three/vector-arrow3d.js +72 -0
- package/dist/three/vector-arrow3d.js.map +1 -0
- package/package.json +79 -3
- package/registry.json +251 -0
- package/src/annotate/angle-mark.ts +147 -0
- package/src/annotate/curly-brace.ts +126 -0
- package/src/annotate/emphasis-mark.ts +89 -0
- package/src/engine.ts +72 -0
- package/src/index.ts +29 -0
- package/src/kit/brace.ts +37 -0
- package/src/kit/cache.ts +61 -0
- package/src/kit/contour.ts +94 -0
- package/src/kit/coords.ts +278 -0
- package/src/kit/curve.ts +29 -0
- package/src/kit/equation.ts +181 -0
- package/src/kit/equation3d.ts +137 -0
- package/src/kit/expression.ts +159 -0
- package/src/kit/field-mark.ts +155 -0
- package/src/kit/field.ts +50 -0
- package/src/kit/follow.ts +203 -0
- package/src/kit/furniture.ts +108 -0
- package/src/kit/geometry.ts +49 -0
- package/src/kit/mark.ts +131 -0
- package/src/kit/part-fills.ts +61 -0
- package/src/kit/place.ts +101 -0
- package/src/kit/placement.ts +8 -0
- package/src/kit/sampler.ts +281 -0
- package/src/kit/scale.ts +39 -0
- package/src/kit/source.ts +57 -0
- package/src/kit/system.ts +99 -0
- package/src/kit/ticks.ts +85 -0
- package/src/kit/withdrawn.ts +8 -0
- package/src/marks/curve-area.ts +89 -0
- package/src/marks/drop-lines.ts +63 -0
- package/src/marks/plot-point.ts +107 -0
- package/src/marks/riemann-sum.ts +98 -0
- package/src/marks/tangent-line.ts +103 -0
- package/src/marks/vector-arrow.ts +98 -0
- package/src/nodes.ts +63 -0
- package/src/plots/function-plot.ts +236 -0
- package/src/plots/points-plot.ts +107 -0
- package/src/plots/stream-lines.ts +151 -0
- package/src/plots/traced-path.ts +52 -0
- package/src/plots/vector-field.ts +88 -0
- package/src/structures/graph-layout.ts +145 -0
- package/src/structures/network-graph.ts +308 -0
- package/src/structures/sample-space.ts +209 -0
- package/src/systems/axes2d.ts +217 -0
- package/src/systems/number-line.ts +131 -0
- package/src/systems/number-plane.ts +203 -0
- package/src/systems/polar-plane.ts +176 -0
- package/src/tex/geometry.ts +703 -0
- package/src/tex/index.ts +14 -0
- package/src/tex/mathjax.ts +82 -0
- package/src/tex/matrix.ts +75 -0
- package/src/tex/node.ts +641 -0
- package/src/tex/tween.ts +308 -0
- package/src/three/axes3d.ts +240 -0
- package/src/three/curve-plot3d.ts +147 -0
- package/src/three/label3d.ts +50 -0
- package/src/three/plot-point3d.ts +66 -0
- package/src/three/space.ts +67 -0
- package/src/three/surface-plot3d.ts +323 -0
- package/src/three/vector-arrow3d.ts +77 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
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 { colorProperty, Geo, Mesh3D, node, property, } from "@motionscript/sdk";
|
|
8
|
+
import { drawLabel3D } from "./label3d.js";
|
|
9
|
+
/**
|
|
10
|
+
* A dot at graph coordinates in a 3D graph, with an optional label. Put inside
|
|
11
|
+
* a surface it rides it: its `x` and `y` say where, and its height is the surface's.
|
|
12
|
+
*/
|
|
13
|
+
let PlotPoint3d = class PlotPoint3d extends Mesh3D {
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props ?? {});
|
|
16
|
+
}
|
|
17
|
+
declareAssets(assets) {
|
|
18
|
+
super.declareAssets(assets);
|
|
19
|
+
if (this.fontFamily !== "")
|
|
20
|
+
assets.font(this.fontFamily);
|
|
21
|
+
}
|
|
22
|
+
buildGeometry() {
|
|
23
|
+
return this.radius > 0 ? Geo.sphere({ radius: this.radius, segments: [24, 16] }) : undefined;
|
|
24
|
+
}
|
|
25
|
+
buildGraphics3D() {
|
|
26
|
+
const g3 = super.buildGraphics3D();
|
|
27
|
+
drawLabel3D(g3, this.label, { x: 0, y: this.radius + this.labelSize * 0.85, z: 0 }, {
|
|
28
|
+
size: this.labelSize,
|
|
29
|
+
color: this.labelColor,
|
|
30
|
+
fontFamily: this.fontFamily,
|
|
31
|
+
});
|
|
32
|
+
return g3;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
property({ default: 0.1, min: 0, step: 0.01 })
|
|
37
|
+
], PlotPoint3d.prototype, "radius", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
property({ default: "", animatable: false })
|
|
40
|
+
], PlotPoint3d.prototype, "label", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
property({ default: 0.26, min: 0.01, step: 0.01 })
|
|
43
|
+
], PlotPoint3d.prototype, "labelSize", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
colorProperty({ default: "#e5e7eb" })
|
|
46
|
+
], PlotPoint3d.prototype, "labelColor", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
property({ default: "", animatable: false })
|
|
49
|
+
], PlotPoint3d.prototype, "fontFamily", void 0);
|
|
50
|
+
PlotPoint3d = __decorate([
|
|
51
|
+
node({
|
|
52
|
+
key: "plotPoint3d",
|
|
53
|
+
within: ["axes3d", "surfacePlot3d"],
|
|
54
|
+
forkable: true,
|
|
55
|
+
layout: { acceptsChildren: false },
|
|
56
|
+
seed: { fill: "#facc15" },
|
|
57
|
+
})
|
|
58
|
+
], PlotPoint3d);
|
|
59
|
+
export { PlotPoint3d };
|
|
60
|
+
//# sourceMappingURL=plot-point3d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plot-point3d.js","sourceRoot":"","sources":["../../src/three/plot-point3d.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,aAAa,EACb,GAAG,EAEH,MAAM,EACN,IAAI,EACJ,QAAQ,GAMX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAUxC;;;GAGG;AAQI,IAAM,WAAW,GAAjB,MAAM,WAAY,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E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8CAA2B;AAC/B;IAA9C,aAAa,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;+CAA2B;AACX;IAArD,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;+CAA4B;AAPhE,WAAW;IAPvB,IAAI,CAAC;QACF,GAAG,EAAE,aAAa;QAClB,MAAM,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;QACnC,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE;QAClC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC5B,CAAC;GACW,WAAW,CA+BvB","sourcesContent":["import {\r\n colorProperty,\r\n Geo,\r\n Graphics3D,\r\n Mesh3D,\r\n node,\r\n property,\r\n type AssetScope,\r\n type Color,\r\n type Geometry3D,\r\n type Mesh3DProps,\r\n type NodeConfig,\r\n} from \"@motionscript/sdk\";\r\nimport { drawLabel3D } from \"./label3d\";\r\n\r\nexport interface PlotPoint3dProps extends Mesh3DProps {\r\n radius?: number;\r\n label?: string;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\n/**\r\n * A dot at graph coordinates in a 3D graph, with an optional label. Put inside\r\n * a surface it rides it: its `x` and `y` say where, and its height is the surface's.\r\n */\r\n@node({\r\n key: \"plotPoint3d\",\r\n within: [\"axes3d\", \"surfacePlot3d\"],\r\n forkable: true,\r\n layout: { acceptsChildren: false },\r\n seed: { fill: \"#facc15\" },\r\n})\r\nexport class PlotPoint3d extends Mesh3D<PlotPoint3dProps> {\r\n /** In scene units, so a point is the same size whatever the axes show. */\r\n @property({ default: 0.1, min: 0, step: 0.01 }) declare radius: number;\r\n @property({ default: \"\", animatable: false }) declare label: string;\r\n /** The height of the label's text, in scene units. */\r\n @property({ default: 0.26, min: 0.01, step: 0.01 }) declare labelSize: number;\r\n @colorProperty({ default: \"#e5e7eb\" }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n\r\n constructor(props?: NodeConfig<PlotPoint3d, PlotPoint3dProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n }\r\n\r\n protected override buildGeometry(): Geometry3D | undefined {\r\n return this.radius > 0 ? Geo.sphere({ radius: this.radius, segments: [24, 16] }) : undefined;\r\n }\r\n\r\n protected override buildGraphics3D(): Graphics3D {\r\n const g3 = super.buildGraphics3D();\r\n drawLabel3D(g3, this.label, { x: 0, y: this.radius + this.labelSize * 0.85, z: 0 }, {\r\n size: this.labelSize,\r\n color: this.labelColor,\r\n fontFamily: this.fontFamily,\r\n });\r\n return g3;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Node3D, type ChildSpace3D, type Vector3 } from "@motionscript/sdk";
|
|
2
|
+
import type { Interval } from "../kit/coords.js";
|
|
3
|
+
/**
|
|
4
|
+
* A 3D graph's coordinates, as its axes' local space sees them. A graph is
|
|
5
|
+
* right-handed with z up, and the scene has y up, so graph x, y and z run along
|
|
6
|
+
* the scene's z, x and y: looked at head-on, y is to the right and z is up.
|
|
7
|
+
*/
|
|
8
|
+
export interface GraphSpace extends ChildSpace3D {
|
|
9
|
+
readonly xRange: Interval;
|
|
10
|
+
readonly yRange: Interval;
|
|
11
|
+
readonly zRange: Interval;
|
|
12
|
+
/** Changes exactly when the mapping does: what a mark's geometry is cached under. */
|
|
13
|
+
readonly revision: string;
|
|
14
|
+
/** A step from one graph point to another, as the local one: what a mark's own geometry is drawn in. */
|
|
15
|
+
offset(x: number, y: number, z: number): Vector3;
|
|
16
|
+
}
|
|
17
|
+
/** The space of a box `lengths` on a side, in scene units, showing the three ranges, centred on its node. */
|
|
18
|
+
export declare function graphSpace(xRange: Interval, yRange: Interval, zRange: Interval, lengths: Vector3): GraphSpace;
|
|
19
|
+
/** The graph a 3D mark is drawn in: its nearest ancestor that has one, up to and including the viewport. */
|
|
20
|
+
export declare function spaceOf(mark: Node3D): GraphSpace | null;
|
|
21
|
+
/** A unit quaternion turning the scene's +y, the way a cylinder or a cone points, onto `direction`. */
|
|
22
|
+
export declare function aim(direction: Vector3): {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
w: number;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=space.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/three/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC5C,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wGAAwG;IACxG,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACpD;AAED,6GAA6G;AAC7G,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,CAe7G;AAWD,4GAA4G;AAC5G,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAMvD;AAED,uGAAuG;AACvG,wBAAgB,GAAG,CAAC,SAAS,EAAE,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAWtF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Node3D } from "@motionscript/sdk";
|
|
2
|
+
/** The space of a box `lengths` on a side, in scene units, showing the three ranges, centred on its node. */
|
|
3
|
+
export function graphSpace(xRange, yRange, zRange, lengths) {
|
|
4
|
+
const ux = unit(xRange, lengths.x);
|
|
5
|
+
const uy = unit(yRange, lengths.y);
|
|
6
|
+
const uz = unit(zRange, lengths.z);
|
|
7
|
+
const cx = (xRange[0] + xRange[1]) / 2;
|
|
8
|
+
const cy = (yRange[0] + yRange[1]) / 2;
|
|
9
|
+
const cz = (zRange[0] + zRange[1]) / 2;
|
|
10
|
+
return {
|
|
11
|
+
xRange,
|
|
12
|
+
yRange,
|
|
13
|
+
zRange,
|
|
14
|
+
revision: [xRange, yRange, zRange, lengths.x, lengths.y, lengths.z].join("|"),
|
|
15
|
+
toLocal: (x, y, z) => ({ x: (y - cy) * uy, y: (z - cz) * uz, z: (x - cx) * ux }),
|
|
16
|
+
offset: (x, y, z) => ({ x: y * uy, y: z * uz, z: x * ux }),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function unit([min, max], length) {
|
|
20
|
+
const span = max - min;
|
|
21
|
+
return span > 0 ? length / span : 0;
|
|
22
|
+
}
|
|
23
|
+
/** The graph a 3D mark is drawn in: its nearest ancestor that has one, up to and including the viewport. */
|
|
24
|
+
export function spaceOf(mark) {
|
|
25
|
+
for (let at = mark.parent; at; at = at instanceof Node3D ? at.parent : null) {
|
|
26
|
+
const spaced = at;
|
|
27
|
+
if (typeof spaced._graphSpace === "function")
|
|
28
|
+
return spaced._graphSpace();
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
/** A unit quaternion turning the scene's +y, the way a cylinder or a cone points, onto `direction`. */
|
|
33
|
+
export function aim(direction) {
|
|
34
|
+
const length = Math.hypot(direction.x, direction.y, direction.z);
|
|
35
|
+
if (!(length > 0))
|
|
36
|
+
return { x: 0, y: 0, z: 0, w: 1 };
|
|
37
|
+
const dx = direction.x / length;
|
|
38
|
+
const dy = direction.y / length;
|
|
39
|
+
const dz = direction.z / length;
|
|
40
|
+
// Straight down is the one turn with no single axis: any in the ground plane will do.
|
|
41
|
+
if (dy < -1 + 1e-9)
|
|
42
|
+
return { x: 1, y: 0, z: 0, w: 0 };
|
|
43
|
+
const w = 1 + dy;
|
|
44
|
+
const norm = Math.hypot(dz, dx, w);
|
|
45
|
+
return { x: dz / norm, y: 0, z: -dx / norm, w: w / norm };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.js","sourceRoot":"","sources":["../../src/three/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmC,MAAM,mBAAmB,CAAC;AAkB5E,6GAA6G;AAC7G,MAAM,UAAU,UAAU,CAAC,MAAgB,EAAE,MAAgB,EAAE,MAAgB,EAAE,OAAgB;IAC7F,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,C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ourcesContent":["import { Node3D, type ChildSpace3D, type Vector3 } from \"@motionscript/sdk\";\r\nimport type { Interval } from \"../kit/coords\";\r\n\r\n/**\r\n * A 3D graph's coordinates, as its axes' local space sees them. A graph is\r\n * right-handed with z up, and the scene has y up, so graph x, y and z run along\r\n * the scene's z, x and y: looked at head-on, y is to the right and z is up.\r\n */\r\nexport interface GraphSpace extends ChildSpace3D {\r\n readonly xRange: Interval;\r\n readonly yRange: Interval;\r\n readonly zRange: Interval;\r\n /** Changes exactly when the mapping does: what a mark's geometry is cached under. */\r\n readonly revision: string;\r\n /** A step from one graph point to another, as the local one: what a mark's own geometry is drawn in. */\r\n offset(x: number, y: number, z: number): Vector3;\r\n}\r\n\r\n/** The space of a box `lengths` on a side, in scene units, showing the three ranges, centred on its node. */\r\nexport function graphSpace(xRange: Interval, yRange: Interval, zRange: Interval, lengths: Vector3): GraphSpace {\r\n const ux = unit(xRange, lengths.x);\r\n const uy = unit(yRange, lengths.y);\r\n const uz = unit(zRange, lengths.z);\r\n const cx = (xRange[0] + xRange[1]) / 2;\r\n const cy = (yRange[0] + yRange[1]) / 2;\r\n const cz = (zRange[0] + zRange[1]) / 2;\r\n return {\r\n xRange,\r\n yRange,\r\n zRange,\r\n revision: [xRange, yRange, zRange, lengths.x, lengths.y, lengths.z].join(\"|\"),\r\n toLocal: (x, y, z) => ({ x: (y - cy) * uy, y: (z - cz) * uz, z: (x - cx) * ux }),\r\n offset: (x, y, z) => ({ x: y * uy, y: z * uz, z: x * ux }),\r\n };\r\n}\r\n\r\nfunction unit([min, max]: Interval, length: number): number {\r\n const span = max - min;\r\n return span > 0 ? length / span : 0;\r\n}\r\n\r\ninterface Spaced {\r\n _graphSpace(): GraphSpace;\r\n}\r\n\r\n/** The graph a 3D mark is drawn in: its nearest ancestor that has one, up to and including the viewport. */\r\nexport function spaceOf(mark: Node3D): GraphSpace | null {\r\n for (let at = mark.parent; at; at = at instanceof Node3D ? at.parent : null) {\r\n const spaced = at as Partial<Spaced>;\r\n if (typeof spaced._graphSpace === \"function\") return spaced._graphSpace();\r\n }\r\n return null;\r\n}\r\n\r\n/** A unit quaternion turning the scene's +y, the way a cylinder or a cone points, onto `direction`. */\r\nexport function aim(direction: Vector3): { x: number; y: number; z: number; w: number } {\r\n const length = Math.hypot(direction.x, direction.y, direction.z);\r\n if (!(length > 0)) return { x: 0, y: 0, z: 0, w: 1 };\r\n const dx = direction.x / length;\r\n const dy = direction.y / length;\r\n const dz = direction.z / length;\r\n // Straight down is the one turn with no single axis: any in the ground plane will do.\r\n if (dy < -1 + 1e-9) return { x: 1, y: 0, z: 0, w: 0 };\r\n const w = 1 + dy;\r\n const norm = Math.hypot(dz, dx, w);\r\n return { x: dz / norm, y: 0, z: -dx / norm, w: w / norm };\r\n}\r\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Graphics3D, Mesh3D, type ChildSpace3D, type Color, type Command, type CommandArgs, type Geometry3D, type MaterialShorthand3D, type Mesh3DProps, type NodeConfig } from "@motionscript/sdk";
|
|
2
|
+
import type { Interval } from "../kit/coords.js";
|
|
3
|
+
import type { ExpressionScope } from "../kit/expression.js";
|
|
4
|
+
import { type PlotSource } from "../kit/source.js";
|
|
5
|
+
export interface SurfacePlot3dProps extends Mesh3DProps {
|
|
6
|
+
expression?: string | PlotSource;
|
|
7
|
+
uDomain?: Interval | null;
|
|
8
|
+
vDomain?: Interval | null;
|
|
9
|
+
params?: ExpressionScope;
|
|
10
|
+
segments?: number;
|
|
11
|
+
colorScale?: Color[];
|
|
12
|
+
meshLines?: number;
|
|
13
|
+
meshColor?: Color;
|
|
14
|
+
floorShadow?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A surface in a 3D graph: a height over x and y (`sin(x) * cos(y)`), or three
|
|
18
|
+
* parts in u and v. A point put inside it rides it.
|
|
19
|
+
*/
|
|
20
|
+
export declare class SurfacePlot3d extends Mesh3D<SurfacePlot3dProps> {
|
|
21
|
+
expression: PlotSource;
|
|
22
|
+
/**
|
|
23
|
+
* The span of each variable that is drawn: x and y for a height, which run
|
|
24
|
+
* the width of the axes when left out, u and v for a parametric surface,
|
|
25
|
+
* which run from 0 to 1.
|
|
26
|
+
*/
|
|
27
|
+
uDomain: Interval | null;
|
|
28
|
+
vDomain: Interval | null;
|
|
29
|
+
/** The equation's named values: any name in it that is not a variable, a function or a constant. */
|
|
30
|
+
params: ExpressionScope;
|
|
31
|
+
/** How finely the surface is sampled, each way. */
|
|
32
|
+
segments: number;
|
|
33
|
+
/** Colours by height, lowest first, over the axes' z range. Empty paints the surface in its fill. */
|
|
34
|
+
colorScale: Color[];
|
|
35
|
+
/** How many lines are drawn across the surface each way; zero leaves it bare. */
|
|
36
|
+
meshLines: number;
|
|
37
|
+
meshColor: Color;
|
|
38
|
+
/** The opacity of the surface's shadow, laid flat on the floor of the axes and coloured by height; zero draws none. */
|
|
39
|
+
floorShadow: number;
|
|
40
|
+
constructor(props?: NodeConfig<SurfacePlot3d, SurfacePlot3dProps>);
|
|
41
|
+
/** Change the equation, the surface bending from the one into the other. */
|
|
42
|
+
morphTo(args: CommandArgs<{
|
|
43
|
+
expression: string;
|
|
44
|
+
}> & {
|
|
45
|
+
duration: number;
|
|
46
|
+
}): Command<SurfacePlot3dProps>;
|
|
47
|
+
/** Animate the equation's named values. */
|
|
48
|
+
paramsTo(args: CommandArgs<{
|
|
49
|
+
params: ExpressionScope;
|
|
50
|
+
}> & {
|
|
51
|
+
duration: number;
|
|
52
|
+
}): Command<SurfacePlot3dProps>;
|
|
53
|
+
/** Animate the spans that are drawn. */
|
|
54
|
+
domainTo(args: CommandArgs<{
|
|
55
|
+
uDomain?: Interval | null;
|
|
56
|
+
vDomain?: Interval | null;
|
|
57
|
+
}> & {
|
|
58
|
+
duration: number;
|
|
59
|
+
}): Command<SurfacePlot3dProps>;
|
|
60
|
+
/**
|
|
61
|
+
* The surface's height above its own origin at graph `(x, y)`, or `NaN`
|
|
62
|
+
* where it has none or is not a height. What a point riding it reads.
|
|
63
|
+
*/
|
|
64
|
+
valueAt(x: number, y: number): number;
|
|
65
|
+
/** @internal */
|
|
66
|
+
_spaceOf(): ChildSpace3D | null;
|
|
67
|
+
protected buildGeometry(): Geometry3D | undefined;
|
|
68
|
+
protected materialShorthand(): MaterialShorthand3D;
|
|
69
|
+
protected buildGraphics3D(): Graphics3D;
|
|
70
|
+
private _linesKey;
|
|
71
|
+
private _lines;
|
|
72
|
+
private _heightOf;
|
|
73
|
+
private _key;
|
|
74
|
+
private _sampler;
|
|
75
|
+
/** `source` as graph points, measured from this node's own position. */
|
|
76
|
+
private _surface;
|
|
77
|
+
private _floorShadow;
|
|
78
|
+
private _meshLines;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=surface-plot3d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-plot3d.d.ts","sourceRoot":"","sources":["../../src/three/surface-plot3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,UAAU,EAEV,MAAM,EAGN,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,EAEf,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,UAAU,EAGlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzD,OAAO,EAAwE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAGtH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACnD,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACjC,OAAO,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,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Q,EAAE,MAAM,CAAA;KAAE,GACnG,OAAO,CAAC,kBAAkB,CAAC;IAI9B;;;OAGG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IAQrC,gBAAgB;IACP,QAAQ,IAAI,YAAY,GAAG,IAAI;cAWrB,aAAa,IAAI,UAAU,GAAG,SAAS;cAsBvC,iBAAiB,IAAI,mBAAmB;cAOxC,eAAe,IAAI,UAAU;IAiChD,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,MAAM,CAAiB;IAE/B,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,QAAQ;IAgBhB,wEAAwE;IACxE,OAAO,CAAC,QAAQ;IA6BhB,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,UAAU;CAwBrB"}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
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 { colorOps, command, Geo, Graphics3D, Mat, Mesh3D, node, property, } from "@motionscript/sdk";
|
|
8
|
+
import { parseSurface, surfaceParams } from "../kit/equation3d.js";
|
|
9
|
+
import { PLOT_COLOR } from "../kit/furniture.js";
|
|
10
|
+
import { clamp, stated } from "../kit/geometry.js";
|
|
11
|
+
import { colorAt, lerpScale, readScale } from "../kit/scale.js";
|
|
12
|
+
import { lerpDomain, lerpParams, lerpSource, readSource, revisionOf, scopeFor } from "../kit/source.js";
|
|
13
|
+
import { spaceOf } from "./space.js";
|
|
14
|
+
/**
|
|
15
|
+
* A surface in a 3D graph: a height over x and y (`sin(x) * cos(y)`), or three
|
|
16
|
+
* parts in u and v. A point put inside it rides it.
|
|
17
|
+
*/
|
|
18
|
+
let SurfacePlot3d = class SurfacePlot3d extends Mesh3D {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props ?? {});
|
|
21
|
+
if (props?.fill === undefined)
|
|
22
|
+
this.applyProp("fill", PLOT_COLOR);
|
|
23
|
+
}
|
|
24
|
+
/** Change the equation, the surface bending from the one into the other. */
|
|
25
|
+
morphTo(args) {
|
|
26
|
+
return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });
|
|
27
|
+
}
|
|
28
|
+
/** Animate the equation's named values. */
|
|
29
|
+
paramsTo(args) {
|
|
30
|
+
return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });
|
|
31
|
+
}
|
|
32
|
+
/** Animate the spans that are drawn. */
|
|
33
|
+
domainTo(args) {
|
|
34
|
+
return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The surface's height above its own origin at graph `(x, y)`, or `NaN`
|
|
38
|
+
* where it has none or is not a height. What a point riding it reads.
|
|
39
|
+
*/
|
|
40
|
+
valueAt(x, y) {
|
|
41
|
+
const { source, blend } = this.expression;
|
|
42
|
+
const value = this._heightOf(source, x, y);
|
|
43
|
+
if (!blend)
|
|
44
|
+
return value;
|
|
45
|
+
const from = this._heightOf(blend.from, x, y);
|
|
46
|
+
return from + (value - from) * blend.t;
|
|
47
|
+
}
|
|
48
|
+
/** @internal */
|
|
49
|
+
_spaceOf() {
|
|
50
|
+
const space = spaceOf(this);
|
|
51
|
+
if (!space)
|
|
52
|
+
return null;
|
|
53
|
+
return {
|
|
54
|
+
toLocal: (x, y, z) => {
|
|
55
|
+
const height = this.valueAt(x, y);
|
|
56
|
+
return space.offset(x, y, Number.isFinite(height) ? height : z);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
buildGeometry() {
|
|
61
|
+
const space = spaceOf(this);
|
|
62
|
+
const sample = space && this._sampler(space);
|
|
63
|
+
if (!space || !sample)
|
|
64
|
+
return undefined;
|
|
65
|
+
const scale = this.colorScale;
|
|
66
|
+
const point = { x: 0, y: 0, z: 0 };
|
|
67
|
+
const low = space.offset(0, 0, space.zRange[0] - this.z).y;
|
|
68
|
+
const high = space.offset(0, 0, space.zRange[1] - this.z).y;
|
|
69
|
+
return Geo.parametric({
|
|
70
|
+
segments: Math.max(2, Math.round(this.segments)),
|
|
71
|
+
vertex: (u, v) => {
|
|
72
|
+
sample(u, v, point);
|
|
73
|
+
return space.offset(point.x, point.y, point.z);
|
|
74
|
+
},
|
|
75
|
+
...(scale.length > 0
|
|
76
|
+
? { color: (_u, _v, position) => colorAt(scale, high > low ? (position.y - low) / (high - low) : 0) }
|
|
77
|
+
: {}),
|
|
78
|
+
computeNormals: true,
|
|
79
|
+
revision: revisionOf(`${this._key(space)}|${JSON.stringify(scale)}`),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
materialShorthand() {
|
|
83
|
+
const own = super.materialShorthand();
|
|
84
|
+
const scaled = this.colorScale.length > 0;
|
|
85
|
+
// A surface is seen from both sides; a vertex colour multiplies the fill, so a scale is shown on white.
|
|
86
|
+
return { faces: "both", ...own, ...(scaled ? { vertexColors: true, fill: "white" } : {}) };
|
|
87
|
+
}
|
|
88
|
+
buildGraphics3D() {
|
|
89
|
+
const g3 = new Graphics3D();
|
|
90
|
+
const space = spaceOf(this);
|
|
91
|
+
const lines = space ? this._meshLines(space) : [];
|
|
92
|
+
for (const op of super.buildGraphics3D().ops()) {
|
|
93
|
+
if (op.kind !== "mesh")
|
|
94
|
+
continue;
|
|
95
|
+
g3.mesh(op.geometry, mapMaterials(op.material, (material) => ({
|
|
96
|
+
...material,
|
|
97
|
+
// Pushed back a hair so the lines drawn on it are not fought for, and blended rather than a hole when faded.
|
|
98
|
+
...(lines.length > 0 ? { polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 1 } : {}),
|
|
99
|
+
...((this.opacity ?? 1) < 1 ? { depthWrite: false } : {}),
|
|
100
|
+
})), op.transform);
|
|
101
|
+
}
|
|
102
|
+
if (lines.length > 0) {
|
|
103
|
+
const color = colorOps.resolve(this.meshColor);
|
|
104
|
+
g3.line({ points: lines, segments: true, stroke: { fill: color }, opacity: color[3] * (this.opacity ?? 1) });
|
|
105
|
+
}
|
|
106
|
+
const shadow = space && this.floorShadow > 0 ? this._floorShadow(space) : undefined;
|
|
107
|
+
if (shadow) {
|
|
108
|
+
const scaled = this.colorScale.length > 0;
|
|
109
|
+
g3.mesh(shadow, Mat.basic({
|
|
110
|
+
color: scaled ? "white" : PLOT_COLOR,
|
|
111
|
+
vertexColors: scaled,
|
|
112
|
+
opacity: this.floorShadow * (this.opacity ?? 1),
|
|
113
|
+
transparent: true,
|
|
114
|
+
// Translucent and under everything: writing depth would hide the floor's grid lines behind it.
|
|
115
|
+
depthWrite: false,
|
|
116
|
+
faces: "both",
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
return g3;
|
|
120
|
+
}
|
|
121
|
+
_linesKey = "";
|
|
122
|
+
_lines = [];
|
|
123
|
+
_heightOf(source, x, y) {
|
|
124
|
+
const equation = equationOf(source);
|
|
125
|
+
if (equation?.kind !== "height")
|
|
126
|
+
return NaN;
|
|
127
|
+
return equation.f(x, y, scopeFor(surfaceParams(source), this.params));
|
|
128
|
+
}
|
|
129
|
+
_key(space) {
|
|
130
|
+
const { source, blend } = this.expression;
|
|
131
|
+
return [source, blend?.from, blend?.t, space.revision, this.uDomain, this.vDomain, JSON.stringify(this.params), this.x, this.y, this.z].join("|");
|
|
132
|
+
}
|
|
133
|
+
_sampler(space) {
|
|
134
|
+
const { source, blend } = this.expression;
|
|
135
|
+
const to = this._surface(source, space);
|
|
136
|
+
if (!to || !blend)
|
|
137
|
+
return to;
|
|
138
|
+
const from = this._surface(blend.from, space);
|
|
139
|
+
if (!from)
|
|
140
|
+
return to;
|
|
141
|
+
const start = { x: 0, y: 0, z: 0 };
|
|
142
|
+
return (u, v, out) => {
|
|
143
|
+
from(u, v, start);
|
|
144
|
+
to(u, v, out);
|
|
145
|
+
out.x = start.x + (out.x - start.x) * blend.t;
|
|
146
|
+
out.y = start.y + (out.y - start.y) * blend.t;
|
|
147
|
+
out.z = start.z + (out.z - start.z) * blend.t;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/** `source` as graph points, measured from this node's own position. */
|
|
151
|
+
_surface(source, space) {
|
|
152
|
+
const equation = equationOf(source);
|
|
153
|
+
if (!equation)
|
|
154
|
+
return null;
|
|
155
|
+
const params = scopeFor(surfaceParams(source), this.params);
|
|
156
|
+
if (equation.kind === "parametric") {
|
|
157
|
+
const [u0, u1] = this.uDomain ?? [0, 1];
|
|
158
|
+
const [v0, v1] = this.vDomain ?? [0, 1];
|
|
159
|
+
const { x, y, z } = equation;
|
|
160
|
+
return (u, v, out) => {
|
|
161
|
+
const a = u0 + (u1 - u0) * u;
|
|
162
|
+
const b = v0 + (v1 - v0) * v;
|
|
163
|
+
out.x = finite(x(a, b, params));
|
|
164
|
+
out.y = finite(y(a, b, params));
|
|
165
|
+
out.z = finite(z(a, b, params));
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const [x0, x1] = this.uDomain ?? [space.xRange[0] - this.x, space.xRange[1] - this.x];
|
|
169
|
+
const [y0, y1] = this.vDomain ?? [space.yRange[0] - this.y, space.yRange[1] - this.y];
|
|
170
|
+
// Held inside the axes: a pole would otherwise stretch one triangle across the scene.
|
|
171
|
+
const low = space.zRange[0] - this.z;
|
|
172
|
+
const high = space.zRange[1] - this.z;
|
|
173
|
+
const { f } = equation;
|
|
174
|
+
return (u, v, out) => {
|
|
175
|
+
out.x = x0 + (x1 - x0) * u;
|
|
176
|
+
out.y = y0 + (y1 - y0) * v;
|
|
177
|
+
out.z = clamp(finite(f(out.x, out.y, params)), low, high);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
_floorShadow(space) {
|
|
181
|
+
const sample = this._sampler(space);
|
|
182
|
+
if (!sample)
|
|
183
|
+
return undefined;
|
|
184
|
+
const scale = this.colorScale;
|
|
185
|
+
const [low, high] = space.zRange;
|
|
186
|
+
const floor = low - this.z;
|
|
187
|
+
const point = { x: 0, y: 0, z: 0 };
|
|
188
|
+
return Geo.parametric({
|
|
189
|
+
segments: Math.max(2, Math.round(this.segments)),
|
|
190
|
+
vertex: (u, v) => {
|
|
191
|
+
sample(u, v, point);
|
|
192
|
+
return space.offset(point.x, point.y, floor);
|
|
193
|
+
},
|
|
194
|
+
...(scale.length > 0
|
|
195
|
+
? {
|
|
196
|
+
color: (u, v) => {
|
|
197
|
+
sample(u, v, point);
|
|
198
|
+
return colorAt(scale, high > low ? (point.z + this.z - low) / (high - low) : 0);
|
|
199
|
+
},
|
|
200
|
+
}
|
|
201
|
+
: {}),
|
|
202
|
+
revision: revisionOf(`${this._key(space)}|${JSON.stringify(scale)}|floor`),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
_meshLines(space) {
|
|
206
|
+
const count = Math.round(this.meshLines);
|
|
207
|
+
const sample = count > 0 ? this._sampler(space) : null;
|
|
208
|
+
if (!sample)
|
|
209
|
+
return [];
|
|
210
|
+
const steps = Math.max(2, Math.round(this.segments));
|
|
211
|
+
const key = `${this._key(space)}|${count}|${steps}`;
|
|
212
|
+
if (key === this._linesKey)
|
|
213
|
+
return this._lines;
|
|
214
|
+
const lines = [];
|
|
215
|
+
const point = { x: 0, y: 0, z: 0 };
|
|
216
|
+
const at = (u, v) => {
|
|
217
|
+
sample(u, v, point);
|
|
218
|
+
return space.offset(point.x, point.y, point.z);
|
|
219
|
+
};
|
|
220
|
+
for (let i = 0; i <= count; i++) {
|
|
221
|
+
const fixed = i / count;
|
|
222
|
+
for (let j = 0; j < steps; j++) {
|
|
223
|
+
lines.push(at(fixed, j / steps), at(fixed, (j + 1) / steps));
|
|
224
|
+
lines.push(at(j / steps, fixed), at((j + 1) / steps, fixed));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
this._lines = lines;
|
|
228
|
+
this._linesKey = key;
|
|
229
|
+
return lines;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
__decorate([
|
|
233
|
+
property({ default: "", mapper: readSource, tween: lerpSource, kind: "surfaceEquation" })
|
|
234
|
+
], SurfacePlot3d.prototype, "expression", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ default: null, tween: lerpDomain, kind: "range", defaultMin: -3, defaultMax: 3 })
|
|
237
|
+
], SurfacePlot3d.prototype, "uDomain", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
property({ default: null, tween: lerpDomain, kind: "range", defaultMin: -3, defaultMax: 3 })
|
|
240
|
+
], SurfacePlot3d.prototype, "vDomain", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
property({ default: {}, tween: lerpParams })
|
|
243
|
+
], SurfacePlot3d.prototype, "params", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
property({ default: 48, min: 2, max: 256, step: 1, animatable: false })
|
|
246
|
+
], SurfacePlot3d.prototype, "segments", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({ default: [], mapper: readScale, tween: lerpScale, kind: "vector" })
|
|
249
|
+
], SurfacePlot3d.prototype, "colorScale", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
property({ default: 12, min: 0, max: 64, step: 1, animatable: false })
|
|
252
|
+
], SurfacePlot3d.prototype, "meshLines", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
property({ default: "#0b1220", kind: "color" })
|
|
255
|
+
], SurfacePlot3d.prototype, "meshColor", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
property({ default: 0, min: 0, max: 1, step: 0.01 })
|
|
258
|
+
], SurfacePlot3d.prototype, "floorShadow", void 0);
|
|
259
|
+
__decorate([
|
|
260
|
+
command({ args: ["expression"] })
|
|
261
|
+
], SurfacePlot3d.prototype, "morphTo", null);
|
|
262
|
+
__decorate([
|
|
263
|
+
command({ args: ["params"] })
|
|
264
|
+
], SurfacePlot3d.prototype, "paramsTo", null);
|
|
265
|
+
__decorate([
|
|
266
|
+
command({ args: ["uDomain", "vDomain"] })
|
|
267
|
+
], SurfacePlot3d.prototype, "domainTo", null);
|
|
268
|
+
SurfacePlot3d = __decorate([
|
|
269
|
+
node({
|
|
270
|
+
key: "surfacePlot3d",
|
|
271
|
+
within: ["axes3d"],
|
|
272
|
+
closed: true,
|
|
273
|
+
forkable: true,
|
|
274
|
+
layout: { acceptsChildren: true },
|
|
275
|
+
seed: { expression: "sin(x) * cos(y)", fill: PLOT_COLOR },
|
|
276
|
+
})
|
|
277
|
+
], SurfacePlot3d);
|
|
278
|
+
export { SurfacePlot3d };
|
|
279
|
+
function equationOf(source) {
|
|
280
|
+
const equation = parseSurface(source, surfaceParams(source));
|
|
281
|
+
return equation instanceof Error ? null : equation;
|
|
282
|
+
}
|
|
283
|
+
// A hole in the data is drawn flat rather than as a hole in the mesh.
|
|
284
|
+
function finite(value) {
|
|
285
|
+
return Number.isFinite(value) ? value : 0;
|
|
286
|
+
}
|
|
287
|
+
function mapMaterials(material, change) {
|
|
288
|
+
return Array.isArray(material) ? material.map(change) : change(material);
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=surface-plot3d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-plot3d.js","sourceRoot":"","sources":["../../src/three/surface-plot3d.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,QAAQ,EACR,OAAO,EACP,GAAG,EACH,UAAU,EACV,GAAG,EACH,MAAM,EACN,IAAI,EACJ,QAAQ,GAYX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAwB,MAAM,mBAAmB,CAAC;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n colorOps,\n command,\n Geo,\n Graphics3D,\n Mat,\n Mesh3D,\n node,\n property,\n type ChildSpace3D,\n type Color,\n type Command,\n type CommandArgs,\n type Geometry3D,\n type Material3D,\n type MaterialShorthand3D,\n type Mesh3DProps,\n type NodeConfig,\n type NormalizedColor,\n type Vector3,\n} from \"@motionscript/sdk\";\nimport type { Interval } from \"../kit/coords\";\nimport { parseSurface, surfaceParams, type SurfaceEquation } from \"../kit/equation3d\";\nimport type { ExpressionScope } from \"../kit/expression\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp, stated } from \"../kit/geometry\";\nimport { colorAt, lerpScale, readScale } from \"../kit/scale\";\nimport { lerpDomain, lerpParams, lerpSource, readSource, revisionOf, scopeFor, type PlotSource } from \"../kit/source\";\nimport { spaceOf, type GraphSpace } from \"./space\";\n\nexport interface SurfacePlot3dProps extends Mesh3DProps {\n expression?: string | PlotSource;\n uDomain?: Interval | null;\n vDomain?: Interval | null;\n params?: ExpressionScope;\n segments?: number;\n colorScale?: Color[];\n meshLines?: number;\n meshColor?: Color;\n floorShadow?: number;\n}\n\n/** A graph point for grid coordinate `(u, v)`, both 0 to 1, written into `out`. */\ntype SurfaceSampler = (u: number, v: number, out: Vector3) => void;\n\n/**\n * A surface in a 3D graph: a height over x and y (`sin(x) * cos(y)`), or three\n * parts in u and v. A point put inside it rides it.\n */\n@node({\n key: \"surfacePlot3d\",\n within: [\"axes3d\"],\n closed: true,\n forkable: true,\n layout: { acceptsChildren: true },\n seed: { expression: \"sin(x) * cos(y)\", fill: PLOT_COLOR },\n})\nexport class SurfacePlot3d extends Mesh3D<SurfacePlot3dProps> {\n @property({ default: \"\", mapper: readSource, tween: lerpSource, kind: \"surfaceEquation\" })\n declare expression: PlotSource;\n\n /**\n * The span of each variable that is drawn: x and y for a height, which run\n * the width of the axes when left out, u and v for a parametric surface,\n * which run from 0 to 1.\n */\n @property({ default: null, tween: lerpDomain, kind: \"range\", defaultMin: -3, defaultMax: 3 }) declare uDomain: Interval | null;\n @property({ default: null, tween: lerpDomain, kind: \"range\", defaultMin: -3, defaultMax: 3 }) declare vDomain: Interval | null;\n\n /** The equation's named values: any name in it that is not a variable, a function or a constant. */\n @property({ default: {}, tween: lerpParams }) declare params: ExpressionScope;\n\n /** How finely the surface is sampled, each way. */\n @property({ default: 48, min: 2, max: 256, step: 1, animatable: false }) declare segments: number;\n\n /** Colours by height, lowest first, over the axes' z range. Empty paints the surface in its fill. */\n @property({ default: [], mapper: readScale, tween: lerpScale, kind: \"vector\" }) declare colorScale: Color[];\n\n /** How many lines are drawn across the surface each way; zero leaves it bare. */\n @property({ default: 12, min: 0, max: 64, step: 1, animatable: false }) declare meshLines: number;\n @property({ default: \"#0b1220\", kind: \"color\" }) declare meshColor: Color;\n\n /** The opacity of the surface's shadow, laid flat on the floor of the axes and coloured by height; zero draws none. */\n @property({ default: 0, min: 0, max: 1, step: 0.01 }) declare floorShadow: number;\n\n constructor(props?: NodeConfig<SurfacePlot3d, SurfacePlot3dProps>) {\n super(props ?? {});\n if (props?.fill === undefined) this.applyProp(\"fill\", PLOT_COLOR);\n }\n\n /** Change the equation, the surface bending from the one into the other. */\n @command({ args: [\"expression\"] })\n morphTo(args: CommandArgs<{ expression: string }> & { duration: number }): Command<SurfacePlot3dProps> {\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\n }\n\n /** Animate the equation's named values. */\n @command({ args: [\"params\"] })\n paramsTo(args: CommandArgs<{ params: ExpressionScope }> & { duration: number }): Command<SurfacePlot3dProps> {\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\n }\n\n /** Animate the spans that are drawn. */\n @command({ args: [\"uDomain\", \"vDomain\"] })\n domainTo(\n args: CommandArgs<{ uDomain?: Interval | null; vDomain?: Interval | null }> & { duration: number },\n ): Command<SurfacePlot3dProps> {\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\n }\n\n /**\n * The surface's height above its own origin at graph `(x, y)`, or `NaN`\n * where it has none or is not a height. What a point riding it reads.\n */\n valueAt(x: number, y: number): number {\n const { source, blend } = this.expression;\n const value = this._heightOf(source, x, y);\n if (!blend) return value;\n const from = this._heightOf(blend.from, x, y);\n return from + (value - from) * blend.t;\n }\n\n /** @internal */\n override _spaceOf(): ChildSpace3D | null {\n const space = spaceOf(this);\n if (!space) return null;\n return {\n toLocal: (x, y, z) => {\n const height = this.valueAt(x, y);\n return space.offset(x, y, Number.isFinite(height) ? height : z);\n },\n };\n }\n\n protected override buildGeometry(): Geometry3D | undefined {\n const space = spaceOf(this);\n const sample = space && this._sampler(space);\n if (!space || !sample) return undefined;\n const scale = this.colorScale as unknown as NormalizedColor[];\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n const low = space.offset(0, 0, space.zRange[0] - this.z).y;\n const high = space.offset(0, 0, space.zRange[1] - this.z).y;\n return Geo.parametric({\n segments: Math.max(2, Math.round(this.segments)),\n vertex: (u, v) => {\n sample(u, v, point);\n return space.offset(point.x, point.y, point.z);\n },\n ...(scale.length > 0\n ? { color: (_u, _v, position) => colorAt(scale, high > low ? (position.y - low) / (high - low) : 0) }\n : {}),\n computeNormals: true,\n revision: revisionOf(`${this._key(space)}|${JSON.stringify(scale)}`),\n });\n }\n\n protected override materialShorthand(): MaterialShorthand3D {\n const own = super.materialShorthand();\n const scaled = (this.colorScale as unknown as NormalizedColor[]).length > 0;\n // A surface is seen from both sides; a vertex colour multiplies the fill, so a scale is shown on white.\n return { faces: \"both\", ...own, ...(scaled ? { vertexColors: true, fill: \"white\" } : {}) };\n }\n\n protected override buildGraphics3D(): Graphics3D {\n const g3 = new Graphics3D();\n const space = spaceOf(this);\n const lines = space ? this._meshLines(space) : [];\n for (const op of super.buildGraphics3D().ops()) {\n if (op.kind !== \"mesh\") continue;\n g3.mesh(op.geometry, mapMaterials(op.material, (material) => ({\n ...material,\n // Pushed back a hair so the lines drawn on it are not fought for, and blended rather than a hole when faded.\n ...(lines.length > 0 ? { polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 1 } : {}),\n ...((this.opacity ?? 1) < 1 ? { depthWrite: false } : {}),\n } as Material3D)), op.transform);\n }\n if (lines.length > 0) {\n const color = colorOps.resolve(this.meshColor);\n g3.line({ points: lines, segments: true, stroke: { fill: color }, opacity: color[3] * (this.opacity ?? 1) });\n }\n const shadow = space && this.floorShadow > 0 ? this._floorShadow(space) : undefined;\n if (shadow) {\n const scaled = (this.colorScale as unknown as NormalizedColor[]).length > 0;\n g3.mesh(shadow, Mat.basic({\n color: scaled ? \"white\" : PLOT_COLOR,\n vertexColors: scaled,\n opacity: this.floorShadow * (this.opacity ?? 1),\n transparent: true,\n // Translucent and under everything: writing depth would hide the floor's grid lines behind it.\n depthWrite: false,\n faces: \"both\",\n }));\n }\n return g3;\n }\n\n private _linesKey = \"\";\n private _lines: Vector3[] = [];\n\n private _heightOf(source: string, x: number, y: number): number {\n const equation = equationOf(source);\n if (equation?.kind !== \"height\") return NaN;\n return equation.f(x, y, scopeFor(surfaceParams(source), this.params));\n }\n\n private _key(space: GraphSpace): string {\n const { source, blend } = this.expression;\n return [source, blend?.from, blend?.t, space.revision, this.uDomain, this.vDomain, JSON.stringify(this.params), this.x, this.y, this.z].join(\"|\");\n }\n\n private _sampler(space: GraphSpace): SurfaceSampler | null {\n const { source, blend } = this.expression;\n const to = this._surface(source, space);\n if (!to || !blend) return to;\n const from = this._surface(blend.from, space);\n if (!from) return to;\n const start: Vector3 = { x: 0, y: 0, z: 0 };\n return (u, v, out) => {\n from(u, v, start);\n to(u, v, out);\n out.x = start.x + (out.x - start.x) * blend.t;\n out.y = start.y + (out.y - start.y) * blend.t;\n out.z = start.z + (out.z - start.z) * blend.t;\n };\n }\n\n /** `source` as graph points, measured from this node's own position. */\n private _surface(source: string, space: GraphSpace): SurfaceSampler | null {\n const equation = equationOf(source);\n if (!equation) return null;\n const params = scopeFor(surfaceParams(source), this.params);\n if (equation.kind === \"parametric\") {\n const [u0, u1] = this.uDomain ?? [0, 1];\n const [v0, v1] = this.vDomain ?? [0, 1];\n const { x, y, z } = equation;\n return (u, v, out) => {\n const a = u0 + (u1 - u0) * u;\n const b = v0 + (v1 - v0) * v;\n out.x = finite(x(a, b, params));\n out.y = finite(y(a, b, params));\n out.z = finite(z(a, b, params));\n };\n }\n const [x0, x1] = this.uDomain ?? [space.xRange[0] - this.x, space.xRange[1] - this.x];\n const [y0, y1] = this.vDomain ?? [space.yRange[0] - this.y, space.yRange[1] - this.y];\n // Held inside the axes: a pole would otherwise stretch one triangle across the scene.\n const low = space.zRange[0] - this.z;\n const high = space.zRange[1] - this.z;\n const { f } = equation;\n return (u, v, out) => {\n out.x = x0 + (x1 - x0) * u;\n out.y = y0 + (y1 - y0) * v;\n out.z = clamp(finite(f(out.x, out.y, params)), low, high);\n };\n }\n\n private _floorShadow(space: GraphSpace): Geometry3D | undefined {\n const sample = this._sampler(space);\n if (!sample) return undefined;\n const scale = this.colorScale as unknown as NormalizedColor[];\n const [low, high] = space.zRange;\n const floor = low - this.z;\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n return Geo.parametric({\n segments: Math.max(2, Math.round(this.segments)),\n vertex: (u, v) => {\n sample(u, v, point);\n return space.offset(point.x, point.y, floor);\n },\n ...(scale.length > 0\n ? {\n color: (u: number, v: number) => {\n sample(u, v, point);\n return colorAt(scale, high > low ? (point.z + this.z - low) / (high - low) : 0);\n },\n }\n : {}),\n revision: revisionOf(`${this._key(space)}|${JSON.stringify(scale)}|floor`),\n });\n }\n\n private _meshLines(space: GraphSpace): Vector3[] {\n const count = Math.round(this.meshLines);\n const sample = count > 0 ? this._sampler(space) : null;\n if (!sample) return [];\n const steps = Math.max(2, Math.round(this.segments));\n const key = `${this._key(space)}|${count}|${steps}`;\n if (key === this._linesKey) return this._lines;\n const lines: Vector3[] = [];\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n const at = (u: number, v: number): Vector3 => {\n sample(u, v, point);\n return space.offset(point.x, point.y, point.z);\n };\n for (let i = 0; i <= count; i++) {\n const fixed = i / count;\n for (let j = 0; j < steps; j++) {\n lines.push(at(fixed, j / steps), at(fixed, (j + 1) / steps));\n lines.push(at(j / steps, fixed), at((j + 1) / steps, fixed));\n }\n }\n this._lines = lines;\n this._linesKey = key;\n return lines;\n }\n}\n\nfunction equationOf(source: string): SurfaceEquation | null {\n const equation = parseSurface(source, surfaceParams(source));\n return equation instanceof Error ? null : equation;\n}\n\n// A hole in the data is drawn flat rather than as a hole in the mesh.\nfunction finite(value: number): number {\n return Number.isFinite(value) ? value : 0;\n}\n\nfunction mapMaterials(\n material: Material3D | readonly Material3D[],\n change: (material: Material3D) => Material3D,\n): Material3D | readonly Material3D[] {\n return Array.isArray(material) ? (material as readonly Material3D[]).map(change) : change(material as Material3D);\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Graphics3D, Mesh3D, type Command, type CommandArgs, type Mesh3DProps, type NodeConfig, type Vector3, type Vector3Input } from "@motionscript/sdk";
|
|
2
|
+
export interface VectorArrow3dProps extends Mesh3DProps {
|
|
3
|
+
tail?: Vector3Input;
|
|
4
|
+
head?: Vector3Input;
|
|
5
|
+
thickness?: number;
|
|
6
|
+
tip?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** An arrow between two points of a 3D graph: a vector from the origin by default. */
|
|
9
|
+
export declare class VectorArrow3d extends Mesh3D<VectorArrow3dProps> {
|
|
10
|
+
tail: Vector3;
|
|
11
|
+
head: Vector3;
|
|
12
|
+
/** The radius of the shaft, in scene units; the tip is sized from it. */
|
|
13
|
+
thickness: number;
|
|
14
|
+
tip: boolean;
|
|
15
|
+
constructor(props?: NodeConfig<VectorArrow3d, VectorArrow3dProps>);
|
|
16
|
+
/** Animate either end, or both. */
|
|
17
|
+
endpointsTo(args: CommandArgs<{
|
|
18
|
+
tail?: Vector3Input;
|
|
19
|
+
head?: Vector3Input;
|
|
20
|
+
}> & {
|
|
21
|
+
duration: number;
|
|
22
|
+
}): Command<VectorArrow3dProps>;
|
|
23
|
+
protected buildGraphics3D(): Graphics3D;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=vector-arrow3d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-arrow3d.d.ts","sourceRoot":"","sources":["../../src/three/vector-arrow3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,UAAU,EAEV,MAAM,EAIN,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,YAAY,EACpB,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACnD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,sFAAsF;AACtF,qBAOa,aAAc,SAAQ,MAAM,CAAC,kBAAkB,CAAC;IACyD,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IAChI,yEAAyE;IACV,SAAS,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;gBAEzD,KAAK,CAAC,EAAE,UAAU,CAAC,aAAa,EAAE,kBAAkB,CAAC;IAIjE,mCAAmC;IAEnC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,IAAI,CAAC,EAAE,YAAY,CAAC;QAAC,IAAI,CAAC,EAAE,YAAY,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;cAI7G,eAAe,IAAI,UAAU;CA0BnD"}
|