def __init__(self, a, f): """ Construct a Geodesic object for ellipsoid with major radius a and flattening f. """ self._a = float(a) self._f = float(f) if f <= 1 else 1.0/f self._f1 = 1 - self._f self._e2 = self._f * (2 - self._f) self._ep2 = self._e2 / Math.sq(self._f1) # e2 / (1 - e2) self._n = self._f / ( 2 - self._f) self._b = self._a * self._f1 # authalic radius squared self._c2 = (Math.sq(self._a) + Math.sq(self._b) * (1 if self._e2 == 0 else (Math.atanh(math.sqrt(self._e2)) if self._e2 > 0 else math.atan(math.sqrt(-self._e2))) / math.sqrt(abs(self._e2))))/2 self._etol2 = Geodesic.tol2_ / max(0.1, math.sqrt(abs(self._e2))) if not(Math.isfinite(self._a) and self._a > 0): raise ValueError("Major radius is not positive") if not(Math.isfinite(self._b) and self._b > 0): raise ValueError("Minor radius is not positive") self._A3x = list(range(int(Geodesic.nA3x_))) self._C3x = list(range(int(Geodesic.nC3x_))) self._C4x = list(range(int(Geodesic.nC4x_))) self.A3coeff() self.C3coeff() self.C4coeff()
def CheckDistance(s): if not (Math.isfinite(s)): raise ValueError("distance " + str(s) + " not a finite number")