plot


   //Plots a DIV at the correct position and resizes it
   //===================================================================
   function plotPoint(name, pos,age) {
    //Create objects for DIV
    obj = document.getElementById(name);
    css = document.getElementById(name).style;
    
    f = viewport.a.z - camera.z;  //Focal length
  
    //From ratios of a triangle get position of point relative to camera
    cy = (pos.y-camera.y) * f / (pos.z-viewport.a.z);  
    cx = (pos.x-camera.x) * f / (pos.z-viewport.a.z);
  
    //Position of point relative to viewport
    py = parseInt(camera.y + cy - viewport.a.y); 
    px = parseInt(camera.x + cx - viewport.a.x);
  
    if(pos.z > viewport.a.z && px > 0 && py > 0 && py < viewport.b.y - viewport.a.y && px < viewport.b.x - viewport.a.x) { 
     //Move object to correct position
     //alert("Moving " + name + " to (" + px + "," + py + ")");
     css.visibility = "";
     d = (150 - pos.z);
     css.backgroundColor = "rgb(" + (200-age*6) + "," + (200-age*6) + "," + (255) + ")";
     d /= 10000 / (viewport.b.x - viewport.a.x); //scale pixel to \%age of viepwort
     if(d<1) d=1;
     css.width = 2 * d;
     css.height = 2 * d;
     css.left = 300 + 2 * ( px - d/2 + viewport.c.x );
     css.top = 2 * ( py - d/2 + viewport.c.y );
     css.zIndex = (100 - pos.z) + 1000;
    } else {
     css.visibility = "hidden";  //on this side of the viewport so hide it
    }
   }
  
   var points = new Array(50);
   for(i=1; i<=50;i++) {
    points[i] = { name: "divPoint" + i,
       x: 0, //Math.round((Math.random()*200)-100),
      y: 0, //Math.round((Math.random()*200)-100),
      z: 0 // Math.round(Math.random()*200)
         }
    points[i].alpha = 250; // Math.round(Math.random()*30) + 255;
    points[i].theta = Math.round(Math.random()*360);
    points[i].w = -10;
    points[i].decay = 0.5; //(Math.round(Math.random()*50) + 75) / 200;
    points[i].age = 0;
   }
  
   angle = 0;
   v = 5.5;
   count = 1;