Skip to content

Commit

Permalink
deploy: c8857f4
Browse files Browse the repository at this point in the history
  • Loading branch information
ricktu288 committed Oct 14, 2024
1 parent 49ef4e4 commit dee7506
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 24 deletions.
1 change: 1 addition & 0 deletions cn/gallery/chaff-countermeasure.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,6 @@
"y": 599.352086802087
},
"scale": 1,
"randomSeed": "0",
"name": "干扰箔"
}
75 changes: 62 additions & 13 deletions docs/Scene.html
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,55 @@ <h5 class="subsection-title">Properties:</h5>



<tr>

<td class="name"><code>randomSeed</code></td>


<td class="type">


<span class="param-type">string</span>
|

<span class="param-type">null</span>



</td>





<td class="description last"><p>The seed for the random number generator used in the simulation, null if using randomly generated seed. Using a seed allows the simulation to be deterministic for the same version of this app when randomness is used. However, reproducibility is only guaranteed if the scene is just loaded (that is, no other editing has been done on the scene). Also, reproducibility is not guaranteed across different versions of the app.</p></td>
</tr>



<tr>

<td class="name"><code>rng</code></td>


<td class="type">


<span class="param-type">function</span>



</td>





<td class="description last"><p>The random number generator.</p></td>
</tr>



<tr>

<td class="name"><code>backgroundImage</code></td>
Expand Down Expand Up @@ -569,7 +618,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line45">line 45</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line48">line 48</a>
</li></ul></dd>


Expand Down Expand Up @@ -711,7 +760,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line100">line 100</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line105">line 105</a>
</li></ul></dd>


Expand Down Expand Up @@ -821,7 +870,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line87">line 87</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line92">line 92</a>
</li></ul></dd>


Expand Down Expand Up @@ -973,7 +1022,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line334">line 334</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line346">line 346</a>
</li></ul></dd>


Expand Down Expand Up @@ -1132,7 +1181,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line298">line 298</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line310">line 310</a>
</li></ul></dd>


Expand Down Expand Up @@ -1291,7 +1340,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line308">line 308</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line320">line 320</a>
</li></ul></dd>


Expand Down Expand Up @@ -1451,7 +1500,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line128">line 128</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line133">line 133</a>
</li></ul></dd>


Expand Down Expand Up @@ -1588,7 +1637,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line244">line 244</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line256">line 256</a>
</li></ul></dd>


Expand Down Expand Up @@ -1725,7 +1774,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line351">line 351</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line363">line 363</a>
</li></ul></dd>


Expand Down Expand Up @@ -1862,7 +1911,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line271">line 271</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line283">line 283</a>
</li></ul></dd>


Expand Down Expand Up @@ -2045,7 +2094,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line371">line 371</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line383">line 383</a>
</li></ul></dd>


Expand Down Expand Up @@ -2182,7 +2231,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line253">line 253</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line265">line 265</a>
</li></ul></dd>


Expand Down Expand Up @@ -2270,7 +2319,7 @@ <h4 class="name" id="validateDelayed"><span class="type-signature"></span>valida

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line383">line 383</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line395">line 395</a>
</li></ul></dd>


Expand Down
14 changes: 13 additions & 1 deletion docs/Scene.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ <h1 class="page-title">Source: Scene.js</h1>
import * as sceneObjs from './sceneObjs.js';
import { versionUpdate } from './versionUpdate.js';
import { getMsg } from './translations.js';
import seedrandom from 'seedrandom';

/**
* The version of the JSON data format of the scene, which matches the major version number of the app starting from version 5.0.
Expand Down Expand Up @@ -68,6 +69,8 @@ <h1 class="page-title">Source: Scene.js</h1>
* @property {number} height - The height (in CSS pixels) of the viewport.
* @property {boolean} simulateColors - The "Simulate Color" option indicating if the color (wavelength) of the rays is simulated (also affecting whether the options of color filtering or Cauchy coefficients of some objects are shown.)
* @property {boolean} symbolicBodyMerging - The "Symbolic body-merging" option in the gradient-index glass objects (which is a global option), indicating if the symbolic math is used to calculate the effective refractive index resulting from the "body-merging" of several gradient-index glass objects.
* @property {string|null} randomSeed - The seed for the random number generator used in the simulation, null if using randomly generated seed. Using a seed allows the simulation to be deterministic for the same version of this app when randomness is used. However, reproducibility is only guaranteed if the scene is just loaded (that is, no other editing has been done on the scene). Also, reproducibility is not guaranteed across different versions of the app.
* @property {function} rng - The random number generator.
* @property {Object|null} backgroundImage - The background image of the scene, null if not set.
*/
class Scene {
Expand All @@ -89,13 +92,15 @@ <h1 class="page-title">Source: Scene.js</h1>
width: 1500,
height: 900,
simulateColors: false,
symbolicBodyMerging: false
symbolicBodyMerging: false,
randomSeed: null
};

constructor() {
this.backgroundImage = null;
this.error = null;
this.warning = null;
this.rng = new seedrandom(new Date().getTime().toString());
this.loadJSON(JSON.stringify({ version: DATA_VERSION }), () => { });
}

Expand Down Expand Up @@ -199,6 +204,13 @@ <h1 class="page-title">Source: Scene.js</h1>
this.width = originalWidth;
this.height = originalHeight;

// Load the random number generator.
if (this.randomSeed) {
this.rng = new seedrandom(this.randomSeed);
} else {
this.rng = new seedrandom(new Date().getTime().toString());
}

// Load the objects in the scene.
this.objs = jsonData.objs.map(objData =>
new sceneObjs[objData.type](this, objData)
Expand Down
8 changes: 4 additions & 4 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ <h5>Type:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line13">line 13</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line14">line 14</a>
</li></ul></dd>


Expand Down Expand Up @@ -934,7 +934,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line74">line 74</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line79">line 79</a>
</li></ul></dd>


Expand Down Expand Up @@ -1022,7 +1022,7 @@ <h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span cla

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line198">line 198</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line210">line 210</a>
</li></ul></dd>


Expand Down Expand Up @@ -3702,7 +3702,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line116">line 116</a>
<a href="Scene.js.html">Scene.js</a>, <a href="Scene.js.html#line121">line 121</a>
</li></ul></dd>


Expand Down
2 changes: 1 addition & 1 deletion docs/sceneObjs.ModuleObj.html
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ <h4 class="name" id="demodulize"><span class="type-signature"></span>demodulize<

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sceneObjs_special_ModuleObj.js.html">sceneObjs/special/ModuleObj.js</a>, <a href="sceneObjs_special_ModuleObj.js.html#line482">line 482</a>
<a href="sceneObjs_special_ModuleObj.js.html">sceneObjs/special/ModuleObj.js</a>, <a href="sceneObjs_special_ModuleObj.js.html#line484">line 484</a>
</li></ul></dd>


Expand Down
2 changes: 1 addition & 1 deletion docs/sceneObjs_glass_Glass.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ <h1 class="page-title">Source: sceneObjs/glass/Glass.js</h1>
var p2;
var p3;
var center;
var ray2 = geometry.line(ray.p1, geometry.point(ray.p2.x + Math.random() * 1e-5, ray.p2.y + Math.random() * 1e-5)); // The ray to test the inside/outside (the test ray)
var ray2 = geometry.line(ray.p1, geometry.point(ray.p2.x + this.scene.rng() * 1e-5, ray.p2.y + this.scene.rng() * 1e-5)); // The ray to test the inside/outside (the test ray)
var ray_intersect_count = 0; // The intersection count (odd means from outside)

for (var i = 0; i &lt; this.path.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion docs/sceneObjs_glass_GrinGlass.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ <h1 class="page-title">Source: sceneObjs/glass/GrinGlass.js</h1>
var nearEdge = false;
var nearEdge_temp = false;

var ray2 = geometry.line(ray.p1, geometry.point(ray.p2.x + Math.random() * 1e-5, ray.p2.y + Math.random() * 1e-5)); // The ray to test the inside/outside (the test ray)
var ray2 = geometry.line(ray.p1, geometry.point(ray.p2.x + this.scene.rng() * 1e-5, ray.p2.y + this.scene.rng() * 1e-5)); // The ray to test the inside/outside (the test ray)
var ray_intersect_count = 0; // The intersection count (odd means from outside)

for (var i = 0; i &lt; this.path.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion docs/sceneObjs_lightSource_Beam.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ <h1 class="page-title">Source: sceneObjs/lightSource/Beam.js</h1>

getRandom(i) {
for (let j = this.randomNumbers.length; j &lt;= i; j++) {
this.randomNumbers.push(Math.random());
this.randomNumbers.push(this.scene.rng());
}
return this.randomNumbers[i];
}
Expand Down
2 changes: 2 additions & 0 deletions docs/sceneObjs_special_ModuleObj.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ <h1 class="page-title">Source: sceneObjs/special/ModuleObj.js</h1>
fullParams['x_' + (i+1)] = this.points[i].x;
fullParams['y_' + (i+1)] = this.points[i].y;
}

fullParams['random'] = this.scene.rng;

this.error = null;

Expand Down
1 change: 1 addition & 0 deletions gallery/chaff-countermeasure.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,6 @@
"y": 599.352086802087
},
"scale": 1,
"randomSeed": "0",
"name": "Chaff countermeasure"
}
Binary file modified img_test/chaff-countermeasure-thumbnail.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img_test/chaff-countermeasure.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pl/gallery/chaff-countermeasure.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,6 @@
"y": 599.352086802087
},
"scale": 1,
"randomSeed": "0",
"name": "Dipole odbijające (chaff)"
}
2 changes: 1 addition & 1 deletion simulator/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion simulator/main.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tw/gallery/chaff-countermeasure.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,6 @@
"y": 599.352086802087
},
"scale": 1,
"randomSeed": "0",
"name": "干擾箔"
}

0 comments on commit dee7506

Please sign in to comment.