From 318ab65cf29379ca38f10545590984b283eca860 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Mon, 4 Jul 2016 20:53:55 +0100 Subject: [PATCH] Small JS improvement --- static/scripts/main.js | 12 ------------ static/scripts/materials.js | 15 ++------------- tests/nodetest1.js | 2 ++ tests/test_circuit_model_against_chp.py | 2 +- tests/test_measurement.py | 2 +- 5 files changed, 6 insertions(+), 27 deletions(-) create mode 100644 tests/nodetest1.js diff --git a/static/scripts/main.js b/static/scripts/main.js index 0074b37..9e16859 100644 --- a/static/scripts/main.js +++ b/static/scripts/main.js @@ -1,20 +1,8 @@ -function bootstrap() { - - abj.add_node(0, { - position: new THREE.Vector3(0, 0, 0) - }); - abj.add_node(1, { - position: new THREE.Vector3(1, 0, 0) - }); - graph.update(); -} - window.onload = function() { graph.prepare(); materials.prepare(); gui.prepare(); mouse.prepare(); editor.prepare(); - //bootstrap(); gui.loop(); }; diff --git a/static/scripts/materials.js b/static/scripts/materials.js index 419ea84..7be0f28 100644 --- a/static/scripts/materials.js +++ b/static/scripts/materials.js @@ -1,7 +1,7 @@ var materials = {}; var curveProperties = { - splineDensity: 8, + splineDensity: 1, curvature: 20 }; @@ -13,18 +13,7 @@ materials.prepare = function() { materials.edge = new THREE.LineBasicMaterial({ color: "gray", transparent: false, - linewidth: 1 - }); - materials.gimbalEdge = new THREE.LineBasicMaterial({ - color: "black", - linewidth: 1, - }); - materials.tip = new THREE.PointsMaterial({ - size: 0.4, - map: tipSprite, - alphaTest: 0.5, - transparent: true, - color: "red" + linewidth: 3 }); materials.qubit = new THREE.PointsMaterial({ size: 0.5, diff --git a/tests/nodetest1.js b/tests/nodetest1.js new file mode 100644 index 0000000..d2479e9 --- /dev/null +++ b/tests/nodetest1.js @@ -0,0 +1,2 @@ +eval(require('fs').readFileSync('../static/scripts/anders_briegel.js', 'utf8')); +console.log(abj.adj); diff --git a/tests/test_circuit_model_against_chp.py b/tests/test_circuit_model_against_chp.py index 45c8c94..57d3613 100644 --- a/tests/test_circuit_model_against_chp.py +++ b/tests/test_circuit_model_against_chp.py @@ -15,7 +15,7 @@ def get_chp_state(): return output -def _bell_test(): +def bell_test(): chp.init(n) chp.act_hadamard(0) chp.act_cnot(0, 1) diff --git a/tests/test_measurement.py b/tests/test_measurement.py index 2418361..86b5b92 100644 --- a/tests/test_measurement.py +++ b/tests/test_measurement.py @@ -4,7 +4,7 @@ def test_z_measurement(): g = GraphState([0]) assert g.measure_z(0, 0) == 0 assert g.measure_z(0, 1) == 1 - # TODO +