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 # The sig12 threshold for "really short" self._etol2 = 0.01 * 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 = range(Geodesic.nA3x_) self._C3x = range(Geodesic.nC3x_) self._C4x = range(Geodesic.nC4x_) self.A3coeff() self.C3coeff() self.C4coeff()
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 # The sig12 threshold for "really short" self._etol2 = 0.01 * 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 = range(Geodesic.nA3x_) self._C3x = range(Geodesic.nC3x_) self._C4x = range(Geodesic.nC4x_) self.A3coeff() self.C3coeff() self.C4coeff()
def __init__(self, a, f): """Construct a Geodesic object :param a: the equatorial radius of the ellipsoid in meters :param f: the flattening of the ellipsoid An exception is thrown if *a* or the polar semi-axis *b* = *a* (1 - *f*) is not a finite positive quantity. """ self.a = float(a) """The equatorial radius in meters (readonly)""" self.f = float(f) """The flattening (readonly)""" 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 # The sig12 threshold for "really short". Using the auxiliary sphere # solution with dnm computed at (bet1 + bet2) / 2, the relative error in # the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. # (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given # f and sig12, the max error occurs for lines near the pole. If the old # rule for computing dnm = (dn1 + dn2)/2 is used, then the error increases # by a factor of 2.) Setting this equal to epsilon gives sig12 = etol2. # Here 0.1 is a safety factor (error decreased by 100) and max(0.001, # abs(f)) stops etol2 getting too large in the nearly spherical case. self._etol2 = 0.1 * Geodesic.tol2_ / math.sqrt( max(0.001, abs(self.f)) * min(1.0, 1-self.f/2) / 2 ) if not(Math.isfinite(self.a) and self.a > 0): raise ValueError("Equatorial radius is not positive") if not(Math.isfinite(self._b) and self._b > 0): raise ValueError("Polar semi-axis is not positive") self._A3x = list(range(Geodesic.nA3x_)) self._C3x = list(range(Geodesic.nC3x_)) self._C4x = list(range(Geodesic.nC4x_)) self._A3coeff() self._C3coeff() self._C4coeff()
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 # The sig12 threshold for "really short". Using the auxiliary sphere # solution with dnm computed at (bet1 + bet2) / 2, the relative error in # the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. # (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given # f and sig12, the max error occurs for lines near the pole. If the old # rule for computing dnm = (dn1 + dn2)/2 is used, then the error increases # by a factor of 2.) Setting this equal to epsilon gives sig12 = etol2. # Here 0.1 is a safety factor (error decreased by 100) and max(0.001, # abs(f)) stops etol2 getting too large in the nearly spherical case. self._etol2 = 0.1 * Geodesic.tol2_ / math.sqrt( max(0.001, abs(self._f)) * min(1.0, 1 - self._f / 2) / 2) 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(Geodesic.nA3x_)) self._C3x = list(range(Geodesic.nC3x_)) self._C4x = list(range(Geodesic.nC4x_)) self.A3coeff() self.C3coeff() self.C4coeff()
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 # The sig12 threshold for "really short". Using the auxiliary sphere # solution with dnm computed at (bet1 + bet2) / 2, the relative error in # the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. # (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given # f and sig12, the max error occurs for lines near the pole. If the old # rule for computing dnm = (dn1 + dn2)/2 is used, then the error increases # by a factor of 2.) Setting this equal to epsilon gives sig12 = etol2. # Here 0.1 is a safety factor (error decreased by 100) and max(0.001, # abs(f)) stops etol2 getting too large in the nearly spherical case. self._etol2 = 0.1 * Geodesic.tol2_ / math.sqrt( max(0.001, abs(self._f)) * min(1.0, 1-self._f/2) / 2 ) 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(Geodesic.nA3x_)) self._C3x = list(range(Geodesic.nC3x_)) self._C4x = list(range(Geodesic.nC4x_)) self.A3coeff() self.C3coeff() self.C4coeff()