manim-web 0.3.1 → 0.3.2
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/dist/index.js
CHANGED
|
@@ -39794,24 +39794,24 @@ class rd extends ze {
|
|
|
39794
39794
|
shaftRadius: _ = 0.01
|
|
39795
39795
|
} = t;
|
|
39796
39796
|
this._xRange = [...e], this._yRange = [...i], this._zRange = [...r], this._xLength = n, this._yLength = o, this._zLength = a, this._showTicks = f, this._tickLength = g;
|
|
39797
|
-
const y = l ?? h, x = c ?? h, w = u ?? h, M =
|
|
39797
|
+
const y = l ?? h, x = c ?? h, w = u ?? h, M = this._graphToVisual(e[0], e, n), C = this._graphToVisual(e[1], e, n), P = this._graphToVisual(i[0], i, o), R = this._graphToVisual(i[1], i, o), O = this._graphToVisual(r[0], r, a), z = this._graphToVisual(r[1], r, a);
|
|
39798
39798
|
this._xAxis = new gs({
|
|
39799
|
-
start: [
|
|
39800
|
-
end: [
|
|
39799
|
+
start: [M, 0, 0],
|
|
39800
|
+
end: [C, 0, 0],
|
|
39801
39801
|
color: y,
|
|
39802
39802
|
tipLength: m,
|
|
39803
39803
|
tipRadius: p,
|
|
39804
39804
|
shaftRadius: _
|
|
39805
39805
|
}), this._yAxis = new gs({
|
|
39806
|
-
start: [0, 0,
|
|
39807
|
-
end: [0, 0, -
|
|
39806
|
+
start: [0, 0, -P],
|
|
39807
|
+
end: [0, 0, -R],
|
|
39808
39808
|
color: x,
|
|
39809
39809
|
tipLength: m,
|
|
39810
39810
|
tipRadius: p,
|
|
39811
39811
|
shaftRadius: _
|
|
39812
39812
|
}), this._zAxis = new gs({
|
|
39813
|
-
start: [0,
|
|
39814
|
-
end: [0,
|
|
39813
|
+
start: [0, O, 0],
|
|
39814
|
+
end: [0, z, 0],
|
|
39815
39815
|
color: w,
|
|
39816
39816
|
tipLength: m,
|
|
39817
39817
|
tipRadius: p,
|
|
@@ -39829,42 +39829,42 @@ class rd extends ze {
|
|
|
39829
39829
|
* Create tick marks for all axes using Manim→THREE.js coordinate mapping
|
|
39830
39830
|
*/
|
|
39831
39831
|
_createTicks(t, e, i) {
|
|
39832
|
-
const r
|
|
39833
|
-
for (let
|
|
39834
|
-
if (Math.abs(
|
|
39835
|
-
const
|
|
39836
|
-
start: this._m2t(
|
|
39837
|
-
end: this._m2t(
|
|
39832
|
+
const [r, n, o] = this._xRange, [a, h, l] = this._yRange, [c, u, d] = this._zRange, f = this._tickLength / 2;
|
|
39833
|
+
for (let g = r; g <= n; g += o) {
|
|
39834
|
+
if (Math.abs(g) < 1e-3 || Math.abs(g - r) < 1e-3 || Math.abs(g - n) < 1e-3) continue;
|
|
39835
|
+
const m = this._graphToVisual(g, this._xRange, this._xLength), p = new Fs({
|
|
39836
|
+
start: this._m2t(m, 0, -f),
|
|
39837
|
+
end: this._m2t(m, 0, f),
|
|
39838
39838
|
color: t
|
|
39839
39839
|
});
|
|
39840
|
-
this._ticks.push(
|
|
39840
|
+
this._ticks.push(p), this.add(p);
|
|
39841
39841
|
}
|
|
39842
|
-
for (let
|
|
39843
|
-
if (Math.abs(
|
|
39844
|
-
const
|
|
39845
|
-
start: this._m2t(0,
|
|
39846
|
-
end: this._m2t(0,
|
|
39842
|
+
for (let g = a; g <= h; g += l) {
|
|
39843
|
+
if (Math.abs(g) < 1e-3 || Math.abs(g - a) < 1e-3 || Math.abs(g - h) < 1e-3) continue;
|
|
39844
|
+
const m = this._graphToVisual(g, this._yRange, this._yLength), p = new Fs({
|
|
39845
|
+
start: this._m2t(0, m, -f),
|
|
39846
|
+
end: this._m2t(0, m, f),
|
|
39847
39847
|
color: e
|
|
39848
39848
|
});
|
|
39849
|
-
this._ticks.push(
|
|
39849
|
+
this._ticks.push(p), this.add(p);
|
|
39850
39850
|
}
|
|
39851
|
-
for (let
|
|
39852
|
-
if (Math.abs(
|
|
39853
|
-
const
|
|
39854
|
-
start: this._m2t(-
|
|
39855
|
-
end: this._m2t(
|
|
39851
|
+
for (let g = c; g <= u; g += d) {
|
|
39852
|
+
if (Math.abs(g) < 1e-3 || Math.abs(g - c) < 1e-3 || Math.abs(g - u) < 1e-3) continue;
|
|
39853
|
+
const m = this._graphToVisual(g, this._zRange, this._zLength), p = new Fs({
|
|
39854
|
+
start: this._m2t(-f, 0, m),
|
|
39855
|
+
end: this._m2t(f, 0, m),
|
|
39856
39856
|
color: i
|
|
39857
39857
|
});
|
|
39858
|
-
this._ticks.push(
|
|
39858
|
+
this._ticks.push(p), this.add(p);
|
|
39859
39859
|
}
|
|
39860
39860
|
}
|
|
39861
39861
|
/**
|
|
39862
|
-
* Map a value
|
|
39862
|
+
* Map a graph coordinate value to visual position such that graph 0 maps to visual 0.
|
|
39863
|
+
* visual = value * (length / (max - min))
|
|
39863
39864
|
*/
|
|
39864
|
-
|
|
39865
|
-
|
|
39866
|
-
|
|
39867
|
-
return r + o * (n - r);
|
|
39865
|
+
_graphToVisual(t, e, i) {
|
|
39866
|
+
const [r, n] = e;
|
|
39867
|
+
return n === r ? 0 : t * (i / (n - r));
|
|
39868
39868
|
}
|
|
39869
39869
|
/**
|
|
39870
39870
|
* Convert graph coordinates (Manim space) to visual point coordinates (THREE.js space).
|
|
@@ -39875,8 +39875,8 @@ class rd extends ze {
|
|
|
39875
39875
|
* @returns The visual point [x, y, z] in THREE.js space
|
|
39876
39876
|
*/
|
|
39877
39877
|
coordsToPoint(t, e, i) {
|
|
39878
|
-
const
|
|
39879
|
-
return [
|
|
39878
|
+
const r = this._graphToVisual(t, this._xRange, this._xLength), n = this._graphToVisual(e, this._yRange, this._yLength), o = this._graphToVisual(i, this._zRange, this._zLength);
|
|
39879
|
+
return [r + this.position.x, o + this.position.y, -n + this.position.z];
|
|
39880
39880
|
}
|
|
39881
39881
|
/**
|
|
39882
39882
|
* Convert visual point coordinates (THREE.js space) to graph coordinates (Manim space).
|
|
@@ -39885,8 +39885,8 @@ class rd extends ze {
|
|
|
39885
39885
|
* @returns The graph coordinates [x, y, z] in Manim space
|
|
39886
39886
|
*/
|
|
39887
39887
|
pointToCoords(t) {
|
|
39888
|
-
const [e, i] = this._xRange, [r, n] = this._yRange, [o, a] = this._zRange, h =
|
|
39889
|
-
return [
|
|
39888
|
+
const [e, i] = this._xRange, [r, n] = this._yRange, [o, a] = this._zRange, h = t[0] - this.position.x, l = t[1] - this.position.y, c = t[2] - this.position.z, u = h * (i - e) / this._xLength, d = -c * (n - r) / this._yLength, f = l * (a - o) / this._zLength;
|
|
39889
|
+
return [u, d, f];
|
|
39890
39890
|
}
|
|
39891
39891
|
/**
|
|
39892
39892
|
* Get the X-axis arrow
|
|
@@ -92,9 +92,10 @@ export declare class ThreeDAxes extends Group {
|
|
|
92
92
|
*/
|
|
93
93
|
private _createTicks;
|
|
94
94
|
/**
|
|
95
|
-
* Map a value
|
|
95
|
+
* Map a graph coordinate value to visual position such that graph 0 maps to visual 0.
|
|
96
|
+
* visual = value * (length / (max - min))
|
|
96
97
|
*/
|
|
97
|
-
private
|
|
98
|
+
private _graphToVisual;
|
|
98
99
|
/**
|
|
99
100
|
* Convert graph coordinates (Manim space) to visual point coordinates (THREE.js space).
|
|
100
101
|
* Applies Manim→THREE.js mapping: (mx, my, mz) → (mx, mz, -my)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeDAxes.d.ts","sourceRoot":"","sources":["../../../src/mobjects/three-d/ThreeDAxes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;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