|
In lugnet.org.ca.rtltoronto, Dan Boger wrote:
> On Fri, Aug 05, 2005 at 07:25:52PM +0000, Rob Antonishen wrote:
> > Using trig, for each value accumulate the sum of the sines and the sum
> > of the cosines. Then divide each of these sums by the number of
> > entries to get:
> > x = average cosine and y = average sine. Then use the arctan2 function
> > to get the average angle as: Angle = arctan2( x , y), except this
> > fails if x=0 and y=0, as would be the case when trying to average 90
> > and 270, sot here is no simple solution to that problem with trig...
> >
> > So any smart people up to the challenge?
>
> I think using vector math (as you do above) is the right way to go. As
> for the special cases, meh, deal with it :)
And if you stop and think about it for a second or two, you'll realize
your special case really does deserve special consideration. The average
is no wind at all, so the direction would be undefined.
|
|
Message is in Reply To:
9 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|