def isantipode_(phi1, lam1, phi2, lam2, eps=EPS): '''Check whether two points are antipodal, on diametrically opposite sides of the earth. @arg phi1: Latitude of one point (C{radians}). @arg lam1: Longitude of one point (C{radians}). @arg phi2: Latitude of the other point (C{radians}). @arg lam2: Longitude of the other point (C{radians}). @kwarg eps: Tolerance for near-equality (C{radians}). @return: C{True} if points are antipodal within the B{C{eps}} tolerance, C{False} otherwise. @see: U{Geosphere<https://CRAN.R-Project.org/web/packages/geosphere/geosphere.pdf>}. ''' return abs(wrapPI_2(phi1) + wrapPI_2(phi2)) < eps and \ abs(abs(wrapPI(lam1) - wrapPI(lam2)) % PI2 - PI) < eps
def antipode_(phi, lam): '''Return the antipode, the point diametrically opposite to a given point in C{radians}. @arg phi: Latitude (C{radians}). @arg lam: Longitude (C{radians}). @return: A L{PhiLam2Tuple}C{(phi, lam)}. @see: U{Geosphere<https://CRAN.R-Project.org/web/packages/geosphere/geosphere.pdf>}. ''' return PhiLam2Tuple(-wrapPI_2(phi), wrapPI(lam + PI))