home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!news.byu.edu!news.mtholyoke.edu!nic.umass.edu!dime!cs.umass.edu!rcollins
- From: rcollins@cs.umass.edu (Bob Collins)
- Newsgroups: sci.math
- Subject: Re: HELP!! Inscribed Circle Problem
- Message-ID: <27AUG199211184436@cs.umass.edu>
- Date: 27 Aug 92 16:18:00 GMT
- Sender: news@dime.cs.umass.edu
- Reply-To: RCollins@cs.umass.edu
- Organization: CS Dept, UMass at Amherst
- Lines: 39
- News-Software: VAX/VMS VNEWS 1.41
-
- The easiest way to compare distances on the sphere is first
- to convert from spherical coordinates to unit vectors. You
- should double check the formulas since this is off the top
- of my head.
-
- (x,y,z) = (Sin[A] Cos[B], Sin[A] Sin[B], Cos[A])
-
- where A = Pi/2 - Latitude (colatitude) and B = Longitude,
- measured in radians. The cosine of the arcdistance d between
- any two points is then
-
- cosd(p1,p2) = x1 x2 + y1 y2 + z1 z2
-
- The KMart with the LARGEST cosine of arcdistance to the
- customer is the CLOSEST. That is cosd(p,p) = 1, monotonically
- decreasing to cosd(p,-p) = -1 (the point on the other side of
- the world).
-
- To convert arcdistance to miles, multiply by the radius of the
- earth (you have to look that one up).
-
- miles = arcdistance * radius-of-earth
-
- Rather than check all 6 million points every time, it would
- be best to set up a 2D histogram by latitude and longitude,
- then only check those KMarts that fall in the same bucket as
- the customer.
-
- To find all KMarts within R miles, convert it to cos of arcdistance
-
- cosr = Cos[R / radius-of-earth]
-
- then find all points p such that cosd[p,customer] > cosr.
-
- Hope that helps. I can emphasize with the dog and pony show
- scramble. As for the term "math whiz" ... kind of derogatory.
-
- --Bob Collins
- --RCollins@cs.umass.edu
-