float eyeAndScreen(Dimension dim)
      // Called in paint method of Canvas class
   {  initPersp();
      int n = w.size();
      e = new Point3D[n];
      vScr = new Point2D[n];
      float xScrMin=1e30F, xScrMax=-1e30F,
            yScrMin=1e30F, yScrMax=-1e30F;
      for (int i=1; i<n; i++)
      {  Point3D P = (Point3D)(w.elementAt(i));
         if (P == null)
      {  e[i] = null; vScr[i] = null;
      }
      else
      {  float x = v11 * P.x + v21 * P.y;
         float y = v12 * P.x + v22 * P.y + v32 * P.z;
         float z = v13 * P.x + v23 * P.y + v33 * P.z + v43;
         Point3D Pe = e[i] = new Point3D(x, y, z);
         float xScr = -Pe.x/Pe.z, yScr = -Pe.y/Pe.z;
         vScr[i] = new Point2D(xScr, yScr);
         if (xScr < xScrMin) xScrMin = xScr; 
         if (xScr > xScrMax) xScrMax = xScr;
         if (yScr < yScrMin) yScrMin = yScr;
         if (yScr > yScrMax) yScrMax = yScr;
      }
   }
   float rangeX = xScrMax - xScrMin, rangeY = yScrMax - yScrMin;
   d = 0.95F * Math.min(dim.width/rangeX, dim.height/rangeY);
   imgCenter = new Point2D(d * (xScrMin + xScrMax)/2,
                           d * (yScrMin + yScrMax)/2);
   for (int i=1; i<n; i++)
   {  if (vScr[i] != null){vScr[i].x *= d; vScr[i].y *= d;}
   }
   return d * Math.max(rangeX, rangeY);
   // Maximum screen-coordinate range used in CvHLines for HP-GL
}