@motionscript/math 0.1.0-alpha.7 → 0.1.0-alpha.8
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 +2 -0
- package/NOTICE +15 -14
- package/dist/annotate/angle-mark.d.ts +6 -6
- package/dist/annotate/curly-brace.d.ts +9 -9
- package/dist/annotate/emphasis-mark.d.ts +9 -9
- package/dist/browser/chunks/{chunk-ABYBW64J.js → chunk-FETQZEN2.js} +2 -2
- package/dist/browser/chunks/{chunk-ABYBW64J.js.map → chunk-FETQZEN2.js.map} +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/kit/follow.d.ts +2 -2
- package/dist/kit/sampler.js +1 -1
- package/dist/kit/sampler.js.map +1 -1
- package/dist/marks/drop-lines.d.ts +6 -6
- package/dist/marks/plot-point.d.ts +3 -3
- package/dist/marks/riemann-sum.d.ts +3 -3
- package/dist/marks/tangent-line.d.ts +6 -6
- package/dist/marks/vector-arrow.d.ts +6 -6
- package/dist/plots/function-plot.d.ts +8 -8
- package/dist/tex/matrix.d.ts +2 -2
- package/dist/tex/node.d.ts +2 -2
- package/dist/tex/typeset.d.ts +4 -4
- package/dist/tex/typeset.d.ts.map +1 -1
- package/dist/three/curve-plot3d.d.ts +27 -27
- package/dist/three/curve-plot3d.d.ts.map +1 -1
- package/dist/three/curve-plot3d.js +3 -2
- package/dist/three/curve-plot3d.js.map +1 -1
- package/dist/three/label3d.d.ts.map +1 -1
- package/dist/three/label3d.js +3 -1
- package/dist/three/label3d.js.map +1 -1
- package/dist/three/plot-point3d.d.ts +27 -27
- package/dist/three/surface-plot3d.d.ts +36 -36
- package/dist/three/surface-plot3d.js +6 -1
- package/dist/three/surface-plot3d.js.map +1 -1
- package/dist/three/vector-arrow3d.d.ts +27 -27
- package/package.json +5 -4
- package/src/kit/sampler.ts +1 -1
- package/src/three/curve-plot3d.ts +3 -1
- package/src/three/label3d.ts +3 -1
- package/src/three/surface-plot3d.ts +7 -1
|
@@ -13,25 +13,25 @@ export declare const VectorArrow3d: import("@motionscript/sdk").Component<"vecto
|
|
|
13
13
|
thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
14
14
|
tip: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
15
15
|
graph: import("@motionscript/sdk").Type<import("./space.js").Graph3D | null, import("./space.js").Graph3D | null, true>;
|
|
16
|
-
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
17
|
-
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
18
16
|
fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
22
|
-
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
23
|
-
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
24
|
-
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
25
|
-
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
17
|
+
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
18
|
+
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
26
19
|
geometry: import("@motionscript/sdk").Type<_Geometry3D | undefined, _Geometry3D | undefined, false>;
|
|
27
20
|
material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
28
21
|
roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
29
22
|
metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
30
23
|
emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
31
24
|
emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
25
|
+
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
32
26
|
roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
33
27
|
metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
28
|
+
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
29
|
+
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
30
|
+
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
31
|
+
wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
34
32
|
shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
33
|
+
faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
34
|
+
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
35
35
|
unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
36
36
|
}>, {
|
|
37
37
|
readonly endpointsTo: readonly ["tail", "head"];
|
|
@@ -42,25 +42,25 @@ export declare const VectorArrow3d: import("@motionscript/sdk").Component<"vecto
|
|
|
42
42
|
thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
43
43
|
tip: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
44
44
|
graph: import("@motionscript/sdk").Type<import("./space.js").Graph3D | null, import("./space.js").Graph3D | null, true>;
|
|
45
|
-
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
46
|
-
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
47
45
|
fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
51
|
-
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
52
|
-
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
53
|
-
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
54
|
-
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
46
|
+
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
47
|
+
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
55
48
|
geometry: import("@motionscript/sdk").Type<_Geometry3D | undefined, _Geometry3D | undefined, false>;
|
|
56
49
|
material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
57
50
|
roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
58
51
|
metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
59
52
|
emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
60
53
|
emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
54
|
+
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
61
55
|
roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
62
56
|
metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
57
|
+
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
58
|
+
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
59
|
+
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
60
|
+
wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
63
61
|
shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
62
|
+
faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
63
|
+
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
64
64
|
unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
65
65
|
}>, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
66
66
|
tail: import("@motionscript/sdk").Type<Vector3Input, Vector3, false>;
|
|
@@ -69,25 +69,25 @@ export declare const VectorArrow3d: import("@motionscript/sdk").Component<"vecto
|
|
|
69
69
|
thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
70
70
|
tip: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
71
71
|
graph: import("@motionscript/sdk").Type<import("./space.js").Graph3D | null, import("./space.js").Graph3D | null, true>;
|
|
72
|
-
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
73
|
-
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
74
72
|
fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
78
|
-
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
79
|
-
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
80
|
-
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
81
|
-
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
73
|
+
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
74
|
+
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
82
75
|
geometry: import("@motionscript/sdk").Type<_Geometry3D | undefined, _Geometry3D | undefined, false>;
|
|
83
76
|
material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
84
77
|
roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
85
78
|
metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
86
79
|
emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
87
80
|
emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
81
|
+
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
88
82
|
roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
89
83
|
metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
84
|
+
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
85
|
+
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
86
|
+
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
87
|
+
wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
90
88
|
shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
89
|
+
faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
90
|
+
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
91
91
|
unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
92
92
|
}>, {
|
|
93
93
|
readonly endpointsTo: readonly ["tail", "head"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motionscript/math",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Math for Motion Script: coordinate systems, function and vector-field plots, 3D graphs and surfaces, network graphs, and LaTeX formulas typeset to glyph paths that morph token by token.",
|
|
6
6
|
"repository": {
|
|
@@ -52,8 +52,9 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"license": "Apache-2.0",
|
|
55
|
+
"author": "Motionscript",
|
|
55
56
|
"peerDependencies": {
|
|
56
|
-
"@motionscript/sdk": "^0.1.0-alpha.
|
|
57
|
+
"@motionscript/sdk": "^0.1.0-alpha.8"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
60
|
"@mathjax/mathjax-newcm-font": "^4.1.1",
|
|
@@ -68,8 +69,8 @@
|
|
|
68
69
|
"typescript": "^6.0.3",
|
|
69
70
|
"typescript-eslint": "^8.48.0",
|
|
70
71
|
"vitest": "^4.1.5",
|
|
71
|
-
"@motionscript/
|
|
72
|
-
"@motionscript/
|
|
72
|
+
"@motionscript/core": "0.1.0-alpha.8",
|
|
73
|
+
"@motionscript/sdk": "0.1.0-alpha.8"
|
|
73
74
|
},
|
|
74
75
|
"scripts": {
|
|
75
76
|
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths && node ../../../scripts/build-browser.mjs",
|
package/src/kit/sampler.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface SampleOptions {
|
|
|
16
16
|
minStep?: number;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/**
|
|
19
|
+
/** Path coordinates are 32-bit floats in the renderer; past this a clamped point still clips to the same edge. */
|
|
20
20
|
const COORD_LIMIT = 16_000;
|
|
21
21
|
/** How far, in pixels, the drawn chord may stray from the curve. */
|
|
22
22
|
const TOLERANCE_PX = 0.25;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
component3d,
|
|
3
3
|
Geo,
|
|
4
|
+
Graphics3D,
|
|
4
5
|
Material,
|
|
5
6
|
Types,
|
|
6
7
|
type Geometry3D,
|
|
@@ -76,7 +77,8 @@ export const CurvePlot3d = component3d({
|
|
|
76
77
|
/** Draw the curve on, or wipe it off: animates `start` and `end`. */
|
|
77
78
|
progressTo: { args: ["start", "end"] },
|
|
78
79
|
},
|
|
79
|
-
|
|
80
|
+
// Declaring, its paint on a stand-in: only a material loads, and the curve's points are not sampled.
|
|
81
|
+
render: (ctx, s) => ctx.draw(ctx.declaring ? new Graphics3D().plane(Material.shorthand(s)) : Material.mesh(s, curveGeometry(s))),
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
export type CurvePlot3d = NodeOf<typeof CurvePlot3d>;
|
package/src/three/label3d.ts
CHANGED
|
@@ -32,7 +32,9 @@ function card(text: string, style: LabelStyle3D): { texture: SurfaceTexture3D; w
|
|
|
32
32
|
textAlign: "center",
|
|
33
33
|
})
|
|
34
34
|
.fill(Fills.color(style.color));
|
|
35
|
-
|
|
35
|
+
// Its pixels never change, so the renderer rasterizes it once rather than every frame.
|
|
36
|
+
const texture: SurfaceTexture3D = { ...Tex.surface(source, { width, height: CARD_HEIGHT }), static: true, identity: `label3d:${key}` };
|
|
37
|
+
const made = { texture, width };
|
|
36
38
|
cards.set(key, made);
|
|
37
39
|
return made;
|
|
38
40
|
}
|
|
@@ -99,7 +99,7 @@ export const SurfacePlot3d = component3d({
|
|
|
99
99
|
domainTo: { args: ["uDomain", "vDomain"] },
|
|
100
100
|
},
|
|
101
101
|
space: (s) => surfaceSpace(s),
|
|
102
|
-
render: (ctx, s) => ctx.draw(drawSurface(s)),
|
|
102
|
+
render: (ctx, s) => ctx.draw(ctx.declaring ? declaredSurface(s) : drawSurface(s)),
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
export type SurfacePlot3d = NodeOf<typeof SurfacePlot3d>;
|
|
@@ -128,6 +128,12 @@ function surfaceSpace(s: SurfaceValues): ChildSpace3D | null {
|
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
/** Its paint on a stand-in: only a material loads, and reading no equation keeps a morph from re-declaring. */
|
|
132
|
+
function declaredSurface(s: SurfaceValues): Graphics3D {
|
|
133
|
+
const paint = Material.shorthand(s);
|
|
134
|
+
return new Graphics3D().plane(s.colorScale.length > 0 ? { ...paint, fill: "white" } : paint);
|
|
135
|
+
}
|
|
136
|
+
|
|
131
137
|
function drawSurface(s: SurfaceValues): Graphics3D {
|
|
132
138
|
const g3 = new Graphics3D();
|
|
133
139
|
const space = graphOf(s);
|