Anders and Briegel in Python
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

38 líneas
1.2KB

  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. }