Box size param
parent
0fb8f8220f
commit
d16d3440bc
|
@ -53,6 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<tr><td><label for="ffwdtimes">nr of experiments</label></td><td><input id="ffwdtimes" type="number" value="10" min="1" max="20" /></td></tr>
|
||||
<tr><td><label for="wanderRate">robot wander rate</label></td><td><input id="wanderRate" type="number" value="0.0002" step="0.0001"></td></tr>
|
||||
<tr><td><label for="boxFric">box friction</label></td><td><input id="boxFric" type="number" value="0.001" step="0.0005" min=0></td></tr>
|
||||
<tr><td><label for="boxX">Boxes:</label></td><td><input id="boxX" type="number" value="5" min=1 max=10>x<input id="boxY" type="number" value="5" min=1 max=10></td></tr>
|
||||
<tr><td><input type="button" value="Restart Slow" onclick="initSimulation(); sim.start()" /><input type="button" value="toggle pause" onclick="sim.toggle()"></td><td><input type="button" value="run experiments" onclick="runExperiments()" /><input type="button" value="clear" onclick="resultsTable.clear()" /></td></tr>
|
||||
<tr><td></td></tr>
|
||||
</tbody></table>
|
||||
|
|
|
@ -170,10 +170,11 @@ class Simulation {
|
|||
color
|
||||
});
|
||||
}
|
||||
const [nBoxX, nBoxY] = ["boxX", "boxY"].map(x => +document.getElementById(x).value)
|
||||
|
||||
const startX = 100, startY = 100,
|
||||
nBoxX = 5, nBoxY = 5,
|
||||
gapX = 40, gapY = 30,
|
||||
const gapX = 40, gapY = 30
|
||||
const startX = (width - (simInfo.boxSize * nBoxX + (nBoxX-1) * gapX)) / 2,
|
||||
startY = (height - (simInfo.boxSize * nBoxY + (nBoxY-1) * gapY)) / 2,
|
||||
stack = Matter.Composites.stack(startX, startY,
|
||||
nBoxX, nBoxY,
|
||||
gapX, gapY, getBox);
|
||||
|
|
Loading…
Reference in New Issue