static double area(S2Point a,S2Point b,S2Point c){
  final double sa=b.angle(c);
  final double sb=c.angle(a);
  final double sc=a.angle(b);
  final double s=0.5 * (sa + sb + sc);
  if (s >= 3e-4) {
    double s2=s * s;
    double dmin=s - Math.max(sa,Math.max(sb,sc));
    if (dmin < 1e-2 * s * s2* s2) {
      double area=girardArea(a,b,c);
      if (dmin < s * (0.1 * area)) {
        return area;
      }
    }
  }
  return 4 * Math.atan(Math.sqrt(Math.max(0.0,Math.tan(0.5 * s) * Math.tan(0.5 * (s - sa)) * Math.tan(0.5 * (s - sb))* Math.tan(0.5 * (s - sc)))));
}

static double area ( S2Point a , S2Point b , S2Point c ) { final double sa = b . angle ( c ) ; final double sb = c . angle ( a ) ; final double sc = a . angle ( b ) ; final double s = 0.5 * ( sa + sb + sc ) ; if ( s >= 3e-4 ) { double s2 = s * s ; double dmin = s - Math . max ( sa , Math . max ( sb , sc ) ) ; if ( dmin < 1e-2 * s * s2 * s2 ) { double area = girardArea ( a , b , c ) ; if ( dmin < s * ( 0.1 * area ) ) { return area ; } } } return 4 * Math . atan ( Math . sqrt ( Math . max ( 0.0 , Math . tan ( 0.5 * s ) * Math . tan ( 0.5 * ( s - sa ) ) * Math . tan ( 0.5 * ( s - sb ) ) * Math . tan ( 0.5 * ( s - sc ) ) ) ) ) ; }
return the area of triangle abc . the method used is about twice as expensive as girard ' s formula , but it is numerically stable for both large and very small triangles . the points do not need to be normalized . the area is always positive . the triangle area is undefined if it contains two antipodal points , and becomes numerically unstable as the length of any edge approaches 180 degrees .
