def distance(self, p1, p2): '''Return the L{equirectangular_} distance in C{radians squared}. ''' r, _ = unrollPI(p1.lam, p2.lam, wrap=self._wrap) if self._adjust: r *= _scale_rad(p1.phi, p2.phi) return hypot2(r, p2.phi - p1.phi) # like equirectangular_ d2
def _distances(self, x, y): # (x, y) radians**2 for xk, yk in zip(self._xs, self._ys): d, _ = unrollPI(xk, x, wrap=self._wrap) if self._adjust: d *= _scale_rad(yk, y) yield hypot2(d, yk - y) # like equirectangular_ distance2