@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,31 @@
|
|
|
1
|
+
import { type Command, type CommandArgs, type NodeConfig } from "@motionscript/sdk";
|
|
2
|
+
import type { Interval } from "../kit/coords.js";
|
|
3
|
+
import { FunctionPlot, type FunctionPlotProps } from "./function-plot.js";
|
|
4
|
+
export interface TracedPathProps extends FunctionPlotProps {
|
|
5
|
+
from?: number;
|
|
6
|
+
value?: number;
|
|
7
|
+
tail?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The trail a point leaves as a value changes: the curve of its equation from
|
|
11
|
+
* where the value began to where it is now. Bind `value` to a variable
|
|
12
|
+
* (`"=[t]"`) and the trail grows as the variable is driven, or drive it with
|
|
13
|
+
* `traceTo`; a `tail` keeps only its most recent stretch.
|
|
14
|
+
*/
|
|
15
|
+
export declare class TracedPath extends FunctionPlot<TracedPathProps> {
|
|
16
|
+
/** The value the trail starts at. */
|
|
17
|
+
from: number;
|
|
18
|
+
/** The value the point is at now: where the trail ends. */
|
|
19
|
+
value: number;
|
|
20
|
+
/** How much of the trail is kept, in the value's own units; zero keeps all of it. */
|
|
21
|
+
tail: number;
|
|
22
|
+
constructor(props?: NodeConfig<TracedPath, TracedPathProps>);
|
|
23
|
+
/** Carry the point on to another value, the trail following it. */
|
|
24
|
+
traceTo(args: CommandArgs<{
|
|
25
|
+
value: number;
|
|
26
|
+
}> & {
|
|
27
|
+
duration: number;
|
|
28
|
+
}): Command<TracedPathProps>;
|
|
29
|
+
protected span(): Interval | null;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=traced-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traced-path.d.ts","sourceRoot":"","sources":["../../src/plots/traced-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGvE,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBASa,UAAW,SAAQ,YAAY,CAAC,eAAe,CAAC;IACzD,qCAAqC;IACQ,IAAI,EAAE,MAAM,CAAC;IAC1D,2DAA2D;IACd,KAAK,EAAE,MAAM,CAAC;IAC3D,qFAAqF;IAChC,IAAI,EAAE,MAAM,CAAC;gBAEtD,KAAK,CAAC,EAAE,UAAU,CAAC,UAAU,EAAE,eAAe,CAAC;IAI3D,mEAAmE;IAEnE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;cAI3E,IAAI,IAAI,QAAQ,GAAG,IAAI;CAK7C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { command, node, property, withdraw } from "@motionscript/sdk";
|
|
8
|
+
import { stated } from "../kit/geometry.js";
|
|
9
|
+
import { SYSTEMS } from "../kit/placement.js";
|
|
10
|
+
import { FunctionPlot } from "./function-plot.js";
|
|
11
|
+
import { OUTLINE_TRIM } from "../kit/withdrawn.js";
|
|
12
|
+
/**
|
|
13
|
+
* The trail a point leaves as a value changes: the curve of its equation from
|
|
14
|
+
* where the value began to where it is now. Bind `value` to a variable
|
|
15
|
+
* (`"=[t]"`) and the trail grows as the variable is driven, or drive it with
|
|
16
|
+
* `traceTo`; a `tail` keeps only its most recent stretch.
|
|
17
|
+
*/
|
|
18
|
+
let TracedPath = class TracedPath extends FunctionPlot {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super((props ?? {}));
|
|
21
|
+
}
|
|
22
|
+
/** Carry the point on to another value, the trail following it. */
|
|
23
|
+
traceTo(args) {
|
|
24
|
+
return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });
|
|
25
|
+
}
|
|
26
|
+
span() {
|
|
27
|
+
const { from, value, tail } = this;
|
|
28
|
+
const kept = tail > 0 ? Math.min(Math.abs(value - from), tail) : Math.abs(value - from);
|
|
29
|
+
return value >= from ? [value - kept, value] : [value, value + kept];
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
__decorate([
|
|
33
|
+
property({ default: 0, step: 0.1 })
|
|
34
|
+
], TracedPath.prototype, "from", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
property({ default: 0, step: 0.1 })
|
|
37
|
+
], TracedPath.prototype, "value", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
property({ default: 0, min: 0, step: 0.1 })
|
|
40
|
+
], TracedPath.prototype, "tail", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
command({ args: ["value"] })
|
|
43
|
+
], TracedPath.prototype, "traceTo", null);
|
|
44
|
+
TracedPath = __decorate([
|
|
45
|
+
node({
|
|
46
|
+
key: "tracedPath",
|
|
47
|
+
within: SYSTEMS,
|
|
48
|
+
parentKey: "functionPlot",
|
|
49
|
+
forkable: true,
|
|
50
|
+
layout: { children: "freeform", defaultWidthMode: "hug", defaultHeightMode: "hug", acceptsChildren: false },
|
|
51
|
+
seed: { expression: "(2cos(t), sin(2t))", value: 6.28 },
|
|
52
|
+
}),
|
|
53
|
+
withdraw(...OUTLINE_TRIM)
|
|
54
|
+
], TracedPath);
|
|
55
|
+
export { TracedPath };
|
|
56
|
+
//# sourceMappingURL=traced-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traced-path.js","sourceRoot":"","sources":["../../src/plots/traced-path.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAmD,MAAM,mBAAmB,CAAC;AAEvH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAA0B,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQhD;;;;;GAKG;AAUI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,YAA6B;IAQzD,YAAY,KAA+C;QACvD,KAAK,CAAC,CAAC,KAAK,IAAI,EAAE,CAA+D,CAAC,CAAC;IACvF,CAAC;IAED,mEAAmE;IAEnE,OAAO,CAAC,IAA2D;QAC/D,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9F,CAAC;IAEkB,IAAI;QACnB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAA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andArgs, type NodeConfig } from \"@motionscript/sdk\";\r\nimport type { Interval } from \"../kit/coords\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\nimport { FunctionPlot, type FunctionPlotProps } from \"./function-plot\";\r\nimport { OUTLINE_TRIM } from \"../kit/withdrawn\";\r\n\r\nexport interface TracedPathProps extends FunctionPlotProps {\r\n from?: number;\r\n value?: number;\r\n tail?: number;\r\n}\r\n\r\n/**\r\n * The trail a point leaves as a value changes: the curve of its equation from\r\n * where the value began to where it is now. Bind `value` to a variable\r\n * (`\"=[t]\"`) and the trail grows as the variable is driven, or drive it with\r\n * `traceTo`; a `tail` keeps only its most recent stretch.\r\n */\r\n@node({\r\n key: \"tracedPath\",\r\n within: SYSTEMS,\r\n parentKey: \"functionPlot\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n seed: { expression: \"(2cos(t), sin(2t))\", value: 6.28 },\r\n})\r\n@withdraw(...OUTLINE_TRIM)\r\nexport class TracedPath extends FunctionPlot<TracedPathProps> {\r\n /** The value the trail starts at. */\r\n @property({ default: 0, step: 0.1 }) declare from: number;\r\n /** The value the point is at now: where the trail ends. */\r\n @property({ default: 0, step: 0.1 }) declare value: number;\r\n /** How much of the trail is kept, in the value's own units; zero keeps all of it. */\r\n @property({ default: 0, min: 0, step: 0.1 }) declare tail: number;\r\n\r\n constructor(props?: NodeConfig<TracedPath, TracedPathProps>) {\r\n super((props ?? {}) as NodeConfig<FunctionPlot<TracedPathProps>, TracedPathProps>);\r\n }\r\n\r\n /** Carry the point on to another value, the trail following it. */\r\n @command({ args: [\"value\"] })\r\n traceTo(args: CommandArgs<{ value: number }> & { duration: number }): Command<TracedPathProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected override span(): Interval | null {\r\n const { from, value, tail } = this;\r\n const kept = tail > 0 ? Math.min(Math.abs(value - from), tail) : Math.abs(value - from);\r\n return value >= from ? [value - kept, value] : [value, value + kept];\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type NodeConfig, type Stroke } from "@motionscript/sdk";
|
|
2
|
+
import type { CoordinateMap } from "../kit/coords.js";
|
|
3
|
+
import { FieldMark, type FieldProps, type FieldSampler, type FieldStroke } from "../kit/field-mark.js";
|
|
4
|
+
export interface VectorFieldProps extends FieldProps {
|
|
5
|
+
spacing?: number;
|
|
6
|
+
arrowScale?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A grid of arrows showing a vector field, two parts in x and y: `(-y, x)`.
|
|
10
|
+
* Each arrow is centred on its point and is as long as the field is strong
|
|
11
|
+
* there, up to the spacing.
|
|
12
|
+
*/
|
|
13
|
+
export declare class VectorField extends FieldMark<VectorFieldProps> {
|
|
14
|
+
/** How far apart the arrows stand, in graph units. */
|
|
15
|
+
spacing: number;
|
|
16
|
+
/** How long an arrow is drawn for a vector of length one, in graph units. */
|
|
17
|
+
arrowScale: number;
|
|
18
|
+
stroke: Stroke;
|
|
19
|
+
constructor(props?: NodeConfig<VectorField, VectorFieldProps>);
|
|
20
|
+
protected own(): string;
|
|
21
|
+
protected strokes(map: CoordinateMap, field: FieldSampler): FieldStroke[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=vector-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-field.d.ts","sourceRoot":"","sources":["../../src/plots/vector-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,UAAU,EAAE,KAAK,MAAM,EAAgB,MAAM,mBAAmB,CAAC;AAC/G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIpG,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AASD;;;;GAIG;AACH,qBAQa,WAAY,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IACxD,sDAAsD;IACE,OAAO,EAAE,MAAM,CAAC;IACxE,6EAA6E;IACrB,UAAU,EAAE,MAAM,CAAC;IAGnE,MAAM,EAAE,MAAM,CAAC;gBAEX,KAAK,CAAC,EAAE,UAAU,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAI7D,SAAS,CAAC,GAAG,IAAI,MAAM;IAIvB,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,GAAG,WAAW,EAAE;CA2B5E"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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 { node, property, strokeProperty } from "@motionscript/sdk";
|
|
8
|
+
import { FieldMark } from "../kit/field-mark.js";
|
|
9
|
+
import { PLOT_COLOR } from "../kit/furniture.js";
|
|
10
|
+
import { SYSTEMS } from "../kit/placement.js";
|
|
11
|
+
/** Past this many arrows the spacing is widened, so a field over a huge range is still a field and not a wash. */
|
|
12
|
+
const MAX_ARROWS = 2400;
|
|
13
|
+
/** An arrow's head, as a share of its length and in pixels at most, and the half-angle it opens to. */
|
|
14
|
+
const HEAD_SHARE = 0.38;
|
|
15
|
+
const HEAD_MAX = 11;
|
|
16
|
+
const HEAD_ANGLE = (26 * Math.PI) / 180;
|
|
17
|
+
/**
|
|
18
|
+
* A grid of arrows showing a vector field, two parts in x and y: `(-y, x)`.
|
|
19
|
+
* Each arrow is centred on its point and is as long as the field is strong
|
|
20
|
+
* there, up to the spacing.
|
|
21
|
+
*/
|
|
22
|
+
let VectorField = class VectorField extends FieldMark {
|
|
23
|
+
constructor(props) {
|
|
24
|
+
super(props ?? {});
|
|
25
|
+
}
|
|
26
|
+
own() {
|
|
27
|
+
return `${this.spacing}|${this.arrowScale}`;
|
|
28
|
+
}
|
|
29
|
+
strokes(map, field) {
|
|
30
|
+
const [x0, x1] = map.xRange;
|
|
31
|
+
const [y0, y1] = map.yRange;
|
|
32
|
+
let spacing = Math.max(this.spacing, 1e-6);
|
|
33
|
+
const count = () => (Math.floor((x1 - x0) / spacing) + 1) * (Math.floor((y1 - y0) / spacing) + 1);
|
|
34
|
+
while (count() > MAX_ARROWS)
|
|
35
|
+
spacing *= 2;
|
|
36
|
+
const drawn = [];
|
|
37
|
+
const v = { x: 0, y: 0 };
|
|
38
|
+
const longest = spacing * 0.9;
|
|
39
|
+
for (let i = Math.ceil(x0 / spacing - 1e-9); i * spacing <= x1 + 1e-9; i++) {
|
|
40
|
+
for (let j = Math.ceil(y0 / spacing - 1e-9); j * spacing <= y1 + 1e-9; j++) {
|
|
41
|
+
const gx = i * spacing;
|
|
42
|
+
const gy = j * spacing;
|
|
43
|
+
if (!field(gx, gy, v))
|
|
44
|
+
continue;
|
|
45
|
+
const magnitude = Math.hypot(v.x, v.y);
|
|
46
|
+
const length = Math.min(magnitude * this.arrowScale, longest);
|
|
47
|
+
if (!(length > 0))
|
|
48
|
+
continue;
|
|
49
|
+
const hx = ((v.x / magnitude) * length) / 2;
|
|
50
|
+
const hy = ((v.y / magnitude) * length) / 2;
|
|
51
|
+
const tail = map.toPoint(gx - hx, gy - hy);
|
|
52
|
+
const head = map.toPoint(gx + hx, gy + hy);
|
|
53
|
+
drawn.push({ runs: arrow(tail, head), magnitude });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return drawn;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
__decorate([
|
|
60
|
+
property({ default: 1, min: 0.01, step: 0.1 })
|
|
61
|
+
], VectorField.prototype, "spacing", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
property({ default: 0.4, min: 0, step: 0.05 })
|
|
64
|
+
], VectorField.prototype, "arrowScale", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
strokeProperty({ default: { weight: 2.5, fill: PLOT_COLOR, align: "center", cap: "round", join: "round" } })
|
|
67
|
+
], VectorField.prototype, "stroke", void 0);
|
|
68
|
+
VectorField = __decorate([
|
|
69
|
+
node({
|
|
70
|
+
key: "vectorField",
|
|
71
|
+
within: SYSTEMS,
|
|
72
|
+
parentKey: "shape",
|
|
73
|
+
forkable: true,
|
|
74
|
+
layout: { children: "freeform", defaultWidthMode: "hug", defaultHeightMode: "hug", acceptsChildren: false },
|
|
75
|
+
seed: { expression: "(-y, x)" },
|
|
76
|
+
})
|
|
77
|
+
], VectorField);
|
|
78
|
+
export { VectorField };
|
|
79
|
+
/** A shaft and the two barbs of its head, in pixels. */
|
|
80
|
+
function arrow(tail, head) {
|
|
81
|
+
const dx = head.x - tail.x;
|
|
82
|
+
const dy = head.y - tail.y;
|
|
83
|
+
const length = Math.hypot(dx, dy);
|
|
84
|
+
if (!(length > 0))
|
|
85
|
+
return [];
|
|
86
|
+
const barb = Math.min(length * HEAD_SHARE, HEAD_MAX);
|
|
87
|
+
const back = Math.atan2(dy, dx) + Math.PI;
|
|
88
|
+
const at = (angle) => ({ x: head.x + Math.cos(angle) * barb, y: head.y + Math.sin(angle) * barb });
|
|
89
|
+
return [[tail, head], [at(back - HEAD_ANGLE), head, at(back + HEAD_ANGLE)]];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=vector-field.js.map
|
|
@@ -0,0 +1 @@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,WAAW,CA4CvB;;AAED,wDAAwD;AACxD,SAAS,KAAK,CAAC,IAAa,EAAE,IAAa;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAClC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,UAAU,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAC1C,MAAM,EAAE,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACpH,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import { node, property, strokeProperty, type NodeConfig, type Stroke, type Vector2 } from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"../kit/coords\";\r\nimport { FieldMark, type FieldProps, type FieldSampler, type FieldStroke } from \"../kit/field-mark\";\r\nimport { PLOT_COLOR } from \"../kit/furniture\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\n\r\nexport interface VectorFieldProps extends FieldProps {\r\n spacing?: number;\r\n arrowScale?: number;\r\n}\r\n\r\n/** Past this many arrows the spacing is widened, so a field over a huge range is still a field and not a wash. */\r\nconst MAX_ARROWS = 2400;\r\n/** An arrow's head, as a share of its length and in pixels at most, and the half-angle it opens to. */\r\nconst HEAD_SHARE = 0.38;\r\nconst HEAD_MAX = 11;\r\nconst HEAD_ANGLE = (26 * Math.PI) / 180;\r\n\r\n/**\r\n * A grid of arrows showing a vector field, two parts in x and y: `(-y, x)`.\r\n * Each arrow is centred on its point and is as long as the field is strong\r\n * there, up to the spacing.\r\n */\r\n@node({\r\n key: \"vectorField\",\r\n within: SYSTEMS,\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n seed: { expression: \"(-y, x)\" },\r\n})\r\nexport class VectorField extends FieldMark<VectorFieldProps> {\r\n /** How far apart the arrows stand, in graph units. */\r\n @property({ default: 1, min: 0.01, step: 0.1 }) declare spacing: number;\r\n /** How long an arrow is drawn for a vector of length one, in graph units. */\r\n @property({ default: 0.4, min: 0, step: 0.05 }) declare arrowScale: number;\r\n\r\n @strokeProperty({ default: { weight: 2.5, fill: PLOT_COLOR, align: \"center\", cap: \"round\", join: \"round\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<VectorField, VectorFieldProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n protected own(): string {\r\n return `${this.spacing}|${this.arrowScale}`;\r\n }\r\n\r\n protected strokes(map: CoordinateMap, field: FieldSampler): FieldStroke[] {\r\n const [x0, x1] = map.xRange;\r\n const [y0, y1] = map.yRange;\r\n let spacing = Math.max(this.spacing, 1e-6);\r\n const count = () => (Math.floor((x1 - x0) / spacing) + 1) * (Math.floor((y1 - y0) / spacing) + 1);\r\n while (count() > MAX_ARROWS) spacing *= 2;\r\n\r\n const drawn: FieldStroke[] = [];\r\n const v: Vector2 = { x: 0, y: 0 };\r\n const longest = spacing * 0.9;\r\n for (let i = Math.ceil(x0 / spacing - 1e-9); i * spacing <= x1 + 1e-9; i++) {\r\n for (let j = Math.ceil(y0 / spacing - 1e-9); j * spacing <= y1 + 1e-9; j++) {\r\n const gx = i * spacing;\r\n const gy = j * spacing;\r\n if (!field(gx, gy, v)) continue;\r\n const magnitude = Math.hypot(v.x, v.y);\r\n const length = Math.min(magnitude * this.arrowScale, longest);\r\n if (!(length > 0)) continue;\r\n const hx = ((v.x / magnitude) * length) / 2;\r\n const hy = ((v.y / magnitude) * length) / 2;\r\n const tail = map.toPoint(gx - hx, gy - hy);\r\n const head = map.toPoint(gx + hx, gy + hy);\r\n drawn.push({ runs: arrow(tail, head), magnitude });\r\n }\r\n }\r\n return drawn;\r\n }\r\n}\r\n\r\n/** A shaft and the two barbs of its head, in pixels. */\r\nfunction arrow(tail: Vector2, head: Vector2): Vector2[][] {\r\n const dx = head.x - tail.x;\r\n const dy = head.y - tail.y;\r\n const length = Math.hypot(dx, dy);\r\n if (!(length > 0)) return [];\r\n const barb = Math.min(length * HEAD_SHARE, HEAD_MAX);\r\n const back = Math.atan2(dy, dx) + Math.PI;\r\n const at = (angle: number): Vector2 => ({ x: head.x + Math.cos(angle) * barb, y: head.y + Math.sin(angle) * barb });\r\n return [[tail, head], [at(back - HEAD_ANGLE), head, at(back + HEAD_ANGLE)]];\r\n}\r\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Vector2 } from "@motionscript/sdk";
|
|
2
|
+
/** Where a graph's vertices are placed, inside a square from -1 to 1 each way, y up. */
|
|
3
|
+
export type GraphLayout = "circular" | "spring" | "tree" | "grid";
|
|
4
|
+
export declare const GRAPH_LAYOUTS: readonly GraphLayout[];
|
|
5
|
+
export interface GraphEdge {
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
}
|
|
9
|
+
/** Each vertex's place under `layout`, by name. */
|
|
10
|
+
export declare function layOut(layout: GraphLayout, vertices: readonly string[], edges: readonly GraphEdge[], root: string): Map<string, Vector2>;
|
|
11
|
+
//# sourceMappingURL=graph-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-layout.d.ts","sourceRoot":"","sources":["../../src/structures/graph-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,wFAAwF;AAExF,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAElE,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAA2C,CAAC;AAE5F,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACd;AAED,mDAAmD;AACnD,wBAAgB,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAcxI"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export const GRAPH_LAYOUTS = ["circular", "spring", "tree", "grid"];
|
|
2
|
+
/** Each vertex's place under `layout`, by name. */
|
|
3
|
+
export function layOut(layout, vertices, edges, root) {
|
|
4
|
+
const n = vertices.length;
|
|
5
|
+
if (n === 0)
|
|
6
|
+
return new Map();
|
|
7
|
+
if (n === 1)
|
|
8
|
+
return new Map([[vertices[0], { x: 0, y: 0 }]]);
|
|
9
|
+
switch (layout) {
|
|
10
|
+
case "grid":
|
|
11
|
+
return grid(vertices);
|
|
12
|
+
case "tree":
|
|
13
|
+
return fill(tree(vertices, edges, root));
|
|
14
|
+
case "spring":
|
|
15
|
+
return fill(spring(vertices, edges));
|
|
16
|
+
default:
|
|
17
|
+
return circular(vertices);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function circular(vertices) {
|
|
21
|
+
const n = vertices.length;
|
|
22
|
+
// The first at the top, the rest clockwise, as a clock is read.
|
|
23
|
+
return new Map(vertices.map((name, i) => {
|
|
24
|
+
const angle = Math.PI / 2 - (2 * Math.PI * i) / n;
|
|
25
|
+
return [name, { x: Math.cos(angle), y: Math.sin(angle) }];
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function grid(vertices) {
|
|
29
|
+
const columns = Math.ceil(Math.sqrt(vertices.length));
|
|
30
|
+
const rows = Math.ceil(vertices.length / columns);
|
|
31
|
+
const at = (i, count) => (count === 1 ? 0 : -1 + (2 * i) / (count - 1));
|
|
32
|
+
return new Map(vertices.map((name, i) => [name, { x: at(i % columns, columns), y: -at(Math.floor(i / columns), rows) }]));
|
|
33
|
+
}
|
|
34
|
+
function neighbours(vertices, edges) {
|
|
35
|
+
const near = new Map(vertices.map((name) => [name, []]));
|
|
36
|
+
for (const { from, to } of edges) {
|
|
37
|
+
if (from === to || !near.has(from) || !near.has(to))
|
|
38
|
+
continue;
|
|
39
|
+
near.get(from).push(to);
|
|
40
|
+
near.get(to).push(from);
|
|
41
|
+
}
|
|
42
|
+
return near;
|
|
43
|
+
}
|
|
44
|
+
/** Levels down from `root`, and across by the leaves under each, every component its own tree beside the last. */
|
|
45
|
+
function tree(vertices, edges, root) {
|
|
46
|
+
const near = neighbours(vertices, edges);
|
|
47
|
+
const placed = new Map();
|
|
48
|
+
let column = 0;
|
|
49
|
+
const visit = (name, depth, seen) => {
|
|
50
|
+
seen.add(name);
|
|
51
|
+
const children = near.get(name).filter((next) => !seen.has(next));
|
|
52
|
+
for (const child of children)
|
|
53
|
+
seen.add(child);
|
|
54
|
+
if (children.length === 0) {
|
|
55
|
+
placed.set(name, { x: column++, y: -depth });
|
|
56
|
+
return placed.get(name).x;
|
|
57
|
+
}
|
|
58
|
+
const xs = children.map((child) => visit(child, depth + 1, seen));
|
|
59
|
+
const x = (xs[0] + xs[xs.length - 1]) / 2;
|
|
60
|
+
placed.set(name, { x, y: -depth });
|
|
61
|
+
return x;
|
|
62
|
+
};
|
|
63
|
+
const seen = new Set();
|
|
64
|
+
const first = near.has(root) ? root : vertices[0];
|
|
65
|
+
for (const start of [first, ...vertices])
|
|
66
|
+
if (!seen.has(start))
|
|
67
|
+
visit(start, 0, seen);
|
|
68
|
+
return placed;
|
|
69
|
+
}
|
|
70
|
+
/** Edges pull and every pair pushes, from the circle, for a fixed number of cooling steps: the same answer every time. */
|
|
71
|
+
function spring(vertices, edges) {
|
|
72
|
+
const n = vertices.length;
|
|
73
|
+
const index = new Map(vertices.map((name, i) => [name, i]));
|
|
74
|
+
const start = circular(vertices);
|
|
75
|
+
const x = vertices.map((name) => start.get(name).x);
|
|
76
|
+
const y = vertices.map((name) => start.get(name).y);
|
|
77
|
+
const links = edges.flatMap(({ from, to }) => {
|
|
78
|
+
const a = index.get(from);
|
|
79
|
+
const b = index.get(to);
|
|
80
|
+
return a === undefined || b === undefined || a === b ? [] : [[a, b]];
|
|
81
|
+
});
|
|
82
|
+
const k = Math.sqrt(4 / n);
|
|
83
|
+
const steps = 160;
|
|
84
|
+
for (let step = 0; step < steps; step++) {
|
|
85
|
+
const dx = new Float64Array(n);
|
|
86
|
+
const dy = new Float64Array(n);
|
|
87
|
+
for (let i = 0; i < n; i++) {
|
|
88
|
+
for (let j = i + 1; j < n; j++) {
|
|
89
|
+
let ex = x[i] - x[j];
|
|
90
|
+
let ey = y[i] - y[j];
|
|
91
|
+
let d = Math.hypot(ex, ey);
|
|
92
|
+
// Two on one spot are parted along a fixed, if arbitrary, line.
|
|
93
|
+
if (d < 1e-6)
|
|
94
|
+
[ex, ey, d] = [1e-3 * (i - j), 1e-3, 1e-3];
|
|
95
|
+
const push = (k * k) / d;
|
|
96
|
+
dx[i] += (ex / d) * push;
|
|
97
|
+
dy[i] += (ey / d) * push;
|
|
98
|
+
dx[j] -= (ex / d) * push;
|
|
99
|
+
dy[j] -= (ey / d) * push;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const [a, b] of links) {
|
|
103
|
+
const ex = x[a] - x[b];
|
|
104
|
+
const ey = y[a] - y[b];
|
|
105
|
+
const d = Math.max(Math.hypot(ex, ey), 1e-6);
|
|
106
|
+
const pull = (d * d) / k;
|
|
107
|
+
dx[a] -= (ex / d) * pull;
|
|
108
|
+
dy[a] -= (ey / d) * pull;
|
|
109
|
+
dx[b] += (ex / d) * pull;
|
|
110
|
+
dy[b] += (ey / d) * pull;
|
|
111
|
+
}
|
|
112
|
+
const limit = 0.12 * (1 - step / steps);
|
|
113
|
+
for (let i = 0; i < n; i++) {
|
|
114
|
+
const d = Math.hypot(dx[i], dy[i]);
|
|
115
|
+
if (d > 0) {
|
|
116
|
+
x[i] += (dx[i] / d) * Math.min(d, limit);
|
|
117
|
+
y[i] += (dy[i] / d) * Math.min(d, limit);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return new Map(vertices.map((name, i) => [name, { x: x[i], y: y[i] }]));
|
|
122
|
+
}
|
|
123
|
+
/** `placed` stretched to reach -1 and 1 on each axis it spreads along, and centred on the one it does not. */
|
|
124
|
+
function fill(placed) {
|
|
125
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
126
|
+
for (const p of placed.values()) {
|
|
127
|
+
minX = Math.min(minX, p.x);
|
|
128
|
+
maxX = Math.max(maxX, p.x);
|
|
129
|
+
minY = Math.min(minY, p.y);
|
|
130
|
+
maxY = Math.max(maxY, p.y);
|
|
131
|
+
}
|
|
132
|
+
const scale = (v, lo, hi) => (hi - lo < 1e-9 ? 0 : -1 + (2 * (v - lo)) / (hi - lo));
|
|
133
|
+
return new Map([...placed].map(([name, p]) => [name, { x: scale(p.x, minX, maxX), y: scale(p.y, minY, maxY) }]));
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=graph-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph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n/** Where a graph's vertices are placed, inside a square from -1 to 1 each way, y up. */\r\n\r\nexport type GraphLayout = \"circular\" | \"spring\" | \"tree\" | \"grid\";\r\n\r\nexport const GRAPH_LAYOUTS: readonly GraphLayout[] = [\"circular\", \"spring\", \"tree\", \"grid\"];\r\n\r\nexport interface GraphEdge {\r\n from: string;\r\n to: string;\r\n}\r\n\r\n/** Each vertex's place under `layout`, by name. */\r\nexport function layOut(layout: GraphLayout, vertices: readonly string[], edges: readonly GraphEdge[], root: string): Map<string, Vector2> {\r\n const n = vertices.length;\r\n if (n === 0) return new Map();\r\n if (n === 1) return new Map([[vertices[0], { x: 0, y: 0 }]]);\r\n switch (layout) {\r\n case \"grid\":\r\n return grid(vertices);\r\n case \"tree\":\r\n return fill(tree(vertices, edges, root));\r\n case \"spring\":\r\n return fill(spring(vertices, edges));\r\n default:\r\n return circular(vertices);\r\n }\r\n}\r\n\r\nfunction circular(vertices: readonly string[]): Map<string, Vector2> {\r\n const n = vertices.length;\r\n // The first at the top, the rest clockwise, as a clock is read.\r\n return new Map(vertices.map((name, i) => {\r\n const angle = Math.PI / 2 - (2 * Math.PI * i) / n;\r\n return [name, { x: Math.cos(angle), y: Math.sin(angle) }];\r\n }));\r\n}\r\n\r\nfunction grid(vertices: readonly string[]): Map<string, Vector2> {\r\n const columns = Math.ceil(Math.sqrt(vertices.length));\r\n const rows = Math.ceil(vertices.length / columns);\r\n const at = (i: number, count: number) => (count === 1 ? 0 : -1 + (2 * i) / (count - 1));\r\n return new Map(vertices.map((name, i) => [name, { x: at(i % columns, columns), y: -at(Math.floor(i / columns), rows) }]));\r\n}\r\n\r\nfunction neighbours(vertices: readonly string[], edges: readonly GraphEdge[]): Map<string, string[]> {\r\n const near = new Map(vertices.map((name) => [name, [] as string[]]));\r\n for (const { from, to } of edges) {\r\n if (from === to || !near.has(from) || !near.has(to)) continue;\r\n near.get(from)!.push(to);\r\n near.get(to)!.push(from);\r\n }\r\n return near;\r\n}\r\n\r\n/** Levels down from `root`, and across by the leaves under each, every component its own tree beside the last. */\r\nfunction tree(vertices: readonly string[], edges: readonly GraphEdge[], root: string): Map<string, Vector2> {\r\n const near = neighbours(vertices, edges);\r\n const placed = new Map<string, Vector2>();\r\n let column = 0;\r\n const visit = (name: string, depth: number, seen: Set<string>): number => {\r\n seen.add(name);\r\n const children = near.get(name)!.filter((next) => !seen.has(next));\r\n for (const child of children) seen.add(child);\r\n if (children.length === 0) {\r\n placed.set(name, { x: column++, y: -depth });\r\n return placed.get(name)!.x;\r\n }\r\n const xs = children.map((child) => visit(child, depth + 1, seen));\r\n const x = (xs[0] + xs[xs.length - 1]) / 2;\r\n placed.set(name, { x, y: -depth });\r\n return x;\r\n };\r\n const seen = new Set<string>();\r\n const first = near.has(root) ? root : vertices[0];\r\n for (const start of [first, ...vertices]) if (!seen.has(start)) visit(start, 0, seen);\r\n return placed;\r\n}\r\n\r\n/** Edges pull and every pair pushes, from the circle, for a fixed number of cooling steps: the same answer every time. */\r\nfunction spring(vertices: readonly string[], edges: readonly GraphEdge[]): Map<string, Vector2> {\r\n const n = vertices.length;\r\n const index = new Map(vertices.map((name, i) => [name, i]));\r\n const start = circular(vertices);\r\n const x = vertices.map((name) => start.get(name)!.x);\r\n const y = vertices.map((name) => start.get(name)!.y);\r\n const links = edges.flatMap(({ from, to }) => {\r\n const a = index.get(from);\r\n const b = index.get(to);\r\n return a === undefined || b === undefined || a === b ? [] : [[a, b] as const];\r\n });\r\n const k = Math.sqrt(4 / n);\r\n const steps = 160;\r\n for (let step = 0; step < steps; step++) {\r\n const dx = new Float64Array(n);\r\n const dy = new Float64Array(n);\r\n for (let i = 0; i < n; i++) {\r\n for (let j = i + 1; j < n; j++) {\r\n let ex = x[i] - x[j];\r\n let ey = y[i] - y[j];\r\n let d = Math.hypot(ex, ey);\r\n // Two on one spot are parted along a fixed, if arbitrary, line.\r\n if (d < 1e-6) [ex, ey, d] = [1e-3 * (i - j), 1e-3, 1e-3];\r\n const push = (k * k) / d;\r\n dx[i] += (ex / d) * push;\r\n dy[i] += (ey / d) * push;\r\n dx[j] -= (ex / d) * push;\r\n dy[j] -= (ey / d) * push;\r\n }\r\n }\r\n for (const [a, b] of links) {\r\n const ex = x[a] - x[b];\r\n const ey = y[a] - y[b];\r\n const d = Math.max(Math.hypot(ex, ey), 1e-6);\r\n const pull = (d * d) / k;\r\n dx[a] -= (ex / d) * pull;\r\n dy[a] -= (ey / d) * pull;\r\n dx[b] += (ex / d) * pull;\r\n dy[b] += (ey / d) * pull;\r\n }\r\n const limit = 0.12 * (1 - step / steps);\r\n for (let i = 0; i < n; i++) {\r\n const d = Math.hypot(dx[i], dy[i]);\r\n if (d > 0) {\r\n x[i] += (dx[i] / d) * Math.min(d, limit);\r\n y[i] += (dy[i] / d) * Math.min(d, limit);\r\n }\r\n }\r\n }\r\n return new Map(vertices.map((name, i) => [name, { x: x[i], y: y[i] }]));\r\n}\r\n\r\n/** `placed` stretched to reach -1 and 1 on each axis it spreads along, and centred on the one it does not. */\r\nfunction fill(placed: Map<string, Vector2>): Map<string, Vector2> {\r\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\r\n for (const p of placed.values()) {\r\n minX = Math.min(minX, p.x);\r\n maxX = Math.max(maxX, p.x);\r\n minY = Math.min(minY, p.y);\r\n maxY = Math.max(maxY, p.y);\r\n }\r\n const scale = (v: number, lo: number, hi: number) => (hi - lo < 1e-9 ? 0 : -1 + (2 * (v - lo)) / (hi - lo));\r\n return new Map([...placed].map(([name, p]) => [name, { x: scale(p.x, minX, maxX), y: scale(p.y, minY, maxY) }]));\r\n}\r\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { PaintNode, type AssetScope, type Color, type Command, type CommandArgs, type Fill, type NodeConfig, type PaintProps, type RenderContext2D, type Stroke, type Vector2 } from "@motionscript/sdk";
|
|
2
|
+
import { type PartFill } from "../kit/part-fills.js";
|
|
3
|
+
import { type GraphEdge, type GraphLayout } from "./graph-layout.js";
|
|
4
|
+
/** A vertex placed by hand, in the graph's box from -1 to 1 each way, y up. */
|
|
5
|
+
export interface GraphPosition {
|
|
6
|
+
vertex: string;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
export interface NetworkGraphProps extends PaintProps {
|
|
11
|
+
vertices?: string[];
|
|
12
|
+
edges?: GraphEdge[];
|
|
13
|
+
directed?: boolean;
|
|
14
|
+
arrangement?: GraphLayout;
|
|
15
|
+
root?: string;
|
|
16
|
+
positions?: GraphPosition[];
|
|
17
|
+
vertexRadius?: number;
|
|
18
|
+
vertexStroke?: Stroke;
|
|
19
|
+
labels?: boolean;
|
|
20
|
+
labelSize?: number;
|
|
21
|
+
labelColor?: Color;
|
|
22
|
+
fontFamily?: string;
|
|
23
|
+
partFills?: PartFill[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Vertices and the edges between them, arranged by a rule: in a circle, by
|
|
27
|
+
* springs, as a tree from `root`, or in a grid. Its `fill` is the vertices and
|
|
28
|
+
* its `stroke` the edges, with an arrowhead each when `directed`. `arrangeTo`
|
|
29
|
+
* moves every vertex to where another rule places it; `partFillTo` paints a
|
|
30
|
+
* vertex, or an edge written `a-b`. (`layout` is every node's own box.)
|
|
31
|
+
*/
|
|
32
|
+
export declare class NetworkGraph extends PaintNode<NetworkGraphProps> {
|
|
33
|
+
vertices: string[];
|
|
34
|
+
edges: GraphEdge[];
|
|
35
|
+
/** Draw each edge as an arrow from its `from` to its `to`. */
|
|
36
|
+
directed: boolean;
|
|
37
|
+
arrangement: GraphLayout;
|
|
38
|
+
/** The vertex a tree hangs from; left empty, the first. */
|
|
39
|
+
root: string;
|
|
40
|
+
/** Vertices placed by hand, whatever the layout says, in the box from -1 to 1 each way. */
|
|
41
|
+
positions: GraphPosition[];
|
|
42
|
+
vertexRadius: number;
|
|
43
|
+
vertexStroke: Stroke;
|
|
44
|
+
labels: boolean;
|
|
45
|
+
labelSize: number;
|
|
46
|
+
labelColor: Color;
|
|
47
|
+
fontFamily: string;
|
|
48
|
+
/** Paints for a vertex by its name, or an edge written `a-b`, over the graph's own. */
|
|
49
|
+
partFills: PartFill[];
|
|
50
|
+
fill: Fill;
|
|
51
|
+
stroke: Stroke;
|
|
52
|
+
private _layoutFrom;
|
|
53
|
+
private _layoutMix;
|
|
54
|
+
constructor(props?: NodeConfig<NetworkGraph, NetworkGraphProps>);
|
|
55
|
+
/** Move every vertex to where another arrangement places it. */
|
|
56
|
+
arrangeTo(args: CommandArgs<{
|
|
57
|
+
arrangement: GraphLayout;
|
|
58
|
+
}> & {
|
|
59
|
+
duration: number;
|
|
60
|
+
}): Command<NetworkGraphProps>;
|
|
61
|
+
/** Paint one part of the graph: a vertex by its name, or an edge written `a-b`. */
|
|
62
|
+
partFillTo(args: CommandArgs<{
|
|
63
|
+
part: string;
|
|
64
|
+
fill: Fill;
|
|
65
|
+
}> & {
|
|
66
|
+
duration: number;
|
|
67
|
+
}): Command<NetworkGraphProps>;
|
|
68
|
+
declareAssets(assets: AssetScope): void;
|
|
69
|
+
/** Where each vertex is drawn, in pixels from the node's centre, y up. */
|
|
70
|
+
vertexPoints(): Map<string, Vector2>;
|
|
71
|
+
protected renderSelf(ctx: RenderContext2D): void;
|
|
72
|
+
protected renderStroke(): void;
|
|
73
|
+
private _layouts;
|
|
74
|
+
/** Each vertex's place under `layout`, from -1 to 1, a hand-placed one where it is. */
|
|
75
|
+
private _placed;
|
|
76
|
+
private _drawEdges;
|
|
77
|
+
private _drawVertices;
|
|
78
|
+
/** The vertices drawn: each name once, trimmed, the blank ones left out. */
|
|
79
|
+
private _names;
|
|
80
|
+
/** The edges drawn: both ends named. */
|
|
81
|
+
private _links;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=network-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-graph.d.ts","sourceRoot":"","sources":["../../src/structures/network-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,SAAS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