Anders and Briegel in Python
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

graph.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. var colors = ["red", "green", "yellow", "blue", "pink", "orange", "purple"];
  2. function updateScene() {
  3. var oldState = scene.getObjectByName("graphstate");
  4. scene.remove(oldState);
  5. oldState = null;
  6. var geometry = new THREE.Geometry();
  7. for (var i in vops) {
  8. var vop = vops[i];
  9. var pos = meta[i].position;
  10. var vertex = new THREE.Vector3(pos[0], pos[1], pos[2]);
  11. geometry.vertices.push(vertex);
  12. geometry.colors[i] = new THREE.Color(colors[vops[i] % colors.length]);
  13. }
  14. var edges = new THREE.Object3D();
  15. var my_edges = edgelist();
  16. for (i=0; i < my_edges.length; ++i) {
  17. var edge = my_edges[i];
  18. var start = meta[edge[0]].position;
  19. var startpos = new THREE.Vector3(start[0], start[1], start[2]);
  20. var end = meta[edge[1]].position;
  21. var endpos = new THREE.Vector3(end[0], end[1], end[2]);
  22. var newEdge = makeEdge(startpos, endpos);
  23. edges.add(newEdge);
  24. }
  25. var particles = new THREE.Points(geometry, materials.qubit);
  26. var newState = new THREE.Object3D();
  27. newState.name = "graphstate";
  28. newState.add(particles);
  29. newState.add(edges);
  30. scene.add(newState);
  31. render();
  32. }