public static double area(Enumeration<Geo> vs){
  int count=0;
  double area=0;
  Geo v0=vs.nextElement();
  Geo v1=vs.nextElement();
  Geo p0=v0;
  Geo p1=v1;
  Geo p2=null;
  while (vs.hasMoreElements()) {
    count++;
    p2=(Geo)vs.nextElement();
    area+=angle(p0,p1,p2);
    p0=p1;
    p1=p2;
  }
  count++;
  p2=v0;
  area+=angle(p0,p1,p2);
  p0=p1;
  p1=p2;
  count++;
  p2=v1;
  area+=angle(p0,p1,p2);
  return area - (count - 2) * Math.PI;
}

public static double area ( Enumeration < Geo > vs ) { int count = 0 ; double area = 0 ; Geo v0 = vs . nextElement ( ) ; Geo v1 = vs . nextElement ( ) ; Geo p0 = v0 ; Geo p1 = v1 ; Geo p2 = null ; while ( vs . hasMoreElements ( ) ) { count ++ ; p2 = ( Geo ) vs . nextElement ( ) ; area += angle ( p0 , p1 , p2 ) ; p0 = p1 ; p1 = p2 ; } count ++ ; p2 = v0 ; area += angle ( p0 , p1 , p2 ) ; p0 = p1 ; p1 = p2 ; count ++ ; p2 = v1 ; area += angle ( p0 , p1 , p2 ) ; return area - ( count - 2 ) * Math . PI ; }
computes the area of a polygon on the surface of a unit sphere given an enumeration of its point . for a non unit sphere , multiply this by the radius of sphere squared . make sure the first point doesn ' t equal the last .
