The problem is the discontinuity in the number system being used. Creating a continuous wrap around number system representing the compass as 0 to 179 180 -179 to -1 makes all of the averaging problems go away. Conversion of negative numbers requires a simple add of 360. w.. Dave VanHorn wrote: > > >Excellent! I hadn't thought of it that way. A little too much math for some situations, but certianly a perspective worth keeping in mind when running into such a situation. > > This sounds like a problem I faced a while back, averaging compass headings. > 90,89,91 averages to 90, no problem, but 359,0,1 averages to 180 which is dead wrong. > > What I did, was to convert the polar coordinates to rectangulars, then add them, then convert back to polar. > > I had to do 7200 of these every second, while dealing with a ton of serial traffic as well, on nine ports. > > _______________________________________________ > http://www.piclist.com > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist