+ Map.prototype.update = function() {
+ this.renderer.render(this.scene, this.camera);
+ };
+
+ function setState(particle, state) {
+ particle.data.boot_state = state;
+ setColor(particle);
+ Senslab.notify(particle.data);
+ }
+
+ function setColor(particle) {
+ var color = colors[particle.data.boot_state] || colors["Selected"];
+ particle.material.color.setHex(color);
+ }
+
+ function getCenter(nodes) {
+ var xmin = 0, ymin = 0, zmin = 0;
+ var xmax = 0, ymax = 0, zmax = 0;
+
+ for (var i = 0; i < nodes.length; ++i) {
+ if (nodes[i].x > xmax) xmax = nodes[i].x;
+ if (nodes[i].x < xmin) xmin = nodes[i].x;
+ if (nodes[i].y > ymax) ymax = nodes[i].y;
+ if (nodes[i].y < ymin) ymin = nodes[i].y;
+ if (nodes[i].z > zmax) zmax = nodes[i].z;
+ if (nodes[i].z < zmin) zmin = nodes[i].z;
+ }
+ return {x: (xmax + xmin) / 2, y: (ymax + ymin) / 2, z: (zmax + zmin) / 2};
+ }
+