Browse Source

Small JS improvement

master
Pete Shadbolt 7 years ago
parent
commit
318ab65cf2
5 changed files with 6 additions and 27 deletions
  1. +0
    -12
      static/scripts/main.js
  2. +2
    -13
      static/scripts/materials.js
  3. +2
    -0
      tests/nodetest1.js
  4. +1
    -1
      tests/test_circuit_model_against_chp.py
  5. +1
    -1
      tests/test_measurement.py

+ 0
- 12
static/scripts/main.js View File

@@ -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();
};

+ 2
- 13
static/scripts/materials.js View File

@@ -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,


+ 2
- 0
tests/nodetest1.js View File

@@ -0,0 +1,2 @@
eval(require('fs').readFileSync('../static/scripts/anders_briegel.js', 'utf8'));
console.log(abj.adj);

+ 1
- 1
tests/test_circuit_model_against_chp.py View File

@@ -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)


+ 1
- 1
tests/test_measurement.py View File

@@ -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




Loading…
Cancel
Save