From: Matt Birkholz Date: Sat, 2 Apr 2016 05:22:40 +0000 (-0700) Subject: planetarium: Punt bogus string->latitude-longitude implementation. X-Git-Tag: mit-scheme-pucked-9.2.12~346 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b415fc4db08ffac729c07fc77f44ecf171f9ec4b;p=mit-scheme.git planetarium: Punt bogus string->latitude-longitude implementation. --- diff --git a/src/planetarium/geometry.scm b/src/planetarium/geometry.scm index dd8873a70..e2078a555 100644 --- a/src/planetarium/geometry.scm +++ b/src/planetarium/geometry.scm @@ -146,34 +146,6 @@ USA. "′" (if neg-lng? "W" "E"))))))) -(define (string->latitude-longitude string) - (let* ((digits "\\([0-9]+\\)") - (regs (re-string-match - (string-append "^"digits"°"digits"."digits"′\\([SN]\\)" - " "digits"°"digits"."digits"′\\([EW]\\)$") - string))) - - (define-integrable (->flo n) - (->flonum (string->number (re-match-extract string regs n)))) - - (define-integrable (->neg? num) - (let ((string (re-match-extract string regs num))) - (or (string=? "W" string) - (string=? "S" string)))) - - (define-integrable (dms.->d neg? degrees minutes millimin) - (let ((absolute (flo:+ degrees - (flo:* 60.0 (flo:+ minutes - (flo:/ millimin 1000.)))))) - (if neg? - (flo:negate absolute) - absolute))) - - (and regs - (make-latitude/longitude - (dms.->d (->neg? 4) (->flo 1) (->flo 2) (->flo 3)) - (dms.->d (->neg? 8) (->flo 5) (->flo 6) (->flo 7)))))) - (define (geodesic-distance p1 p2) ;; "[Given] the geographic coordinates of two points on the surface ;; of the Earth [...] the shortest distance S between these points, @@ -214,16 +186,6 @@ USA. (flo:+ pi d) d)))))) -#;(define (package-tests) - (run-test test-lat/lng-un/parse) - (run-test test-angular-separation)) - -(define (test-lat/lng-un/parse) - (let ((samp "30°26.432′N 122°44.456′W")) - (if (not (string=? samp (latitude-longitude->string - (string->latitude-longitude samp)))) - (warn "Latitude/longitude un/parsing failed.")))) - (define (test-angular-separation) (define (test lat1 lng1 lat2 lng2 degrees tolerance) diff --git a/src/planetarium/mit.pkg b/src/planetarium/mit.pkg index a3c8d91a4..23ac0ae4f 100644 --- a/src/planetarium/mit.pkg +++ b/src/planetarium/mit.pkg @@ -115,8 +115,6 @@ USA. decoded-time/year decoded-time/month decoded-time/day universal-time->string - re-string-match re-match-extract - error warn) (import (planetarium syntax) define-integrable-operator)