# - - - C B C D a t a . _ _ c i r c l e S e p def __circleSep ( self, fromCircle, toCircle): '''How many circle diameters separate these circles? [ fromCircle and toCircle are Circle instances -> return the distance between their centers as a fraction of CIRCLE_DIAMETER ] '''
For the interface to the author's mapping package, refer to
Section 6.2, “Imports”. The
terrapos.LatLon() constructor accepts two arguments,
each of which is a tuple
is degrees and
is minutes. For the
conversion from string coordinates to positions in the
terrapos package, see Section 6.34, “
CBCData.__terraCircle(): Convert a circle
center to a terrestrial position”.
#-- 1 -- # [ fromPos := fromCircle's center as a terrapos.LatLon # toPos := toCircle's center as a terrapos.LatLon ] fromPos = self.__terraCircle ( fromCircle ) toPos = self.__terraCircle ( toCircle )
terrapos package, the method
LatLon.crowFeet() gives the distance in feet between
two positions. We divide that by the number of feet in a
circle diameter to normalize the value to diameters.
#-- 2 -- # [ sep := (distance between fromPos and toPos in miles) / # CIRCLE_DIAMETER ] sep = (fromPos.crowFeet(toPos) / FEET_PER_MILE)/CIRCLE_DIAMETER #-- 3 -- return sep