((lat2-lat1)*BETA*(lat2-lat1)*BETA + (long2-long1)*delta*(long2-long1)*delta)
I'm writing some C code and I am getting some screwy results. Basically lat1, lat2, long1, long2 are all latitudes and longitudes in radians, delta is another precalculated parameter. BETA is a defined constant.
As far as I can tell this code always results in an answer equal to BETA regardless of changing inputs. Additionally when I brake out the two addition terms: (lat2-lat1)*BETA*(lat2-lat1)*BETA and (long2-long1)*delta*(long2-long1)*delta), and compute them separately I get a result of "0". I have been trying to wrap my head around what is wrong without success for a day now. Any suggestions for things to try would be appreciated.
Thanks in advance.
This algorithm is used for short distances. For that reason these assumptions produce what I would call an acceptable error (1 to 2 meters of error for a 500m measurement). While more elegant solutions are possible, it does not mean they are necessary. If I ever did find a need to squeeze more accuracy out I could always use more locally defined radii for the specific area of interest.
Thank you for your suggestions, regardless.