Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > Math help!!!
Pages (3): [1] 2 3 »   Last Thread   Next Thread
Share
Author
Thread    Post A Reply
Joss Weatherby
Banned



Registered: May 2008
Location: The Pacific Northwest, of course
Read This! Math help!!!

I need to get the average of a set of angles...


angles = [355, 358, 0, 5, 351];

So I basically convert those numbers into radians.

Then I go through the radians and I convert them to their sine and cosine values and add those up.

I then get the average (totalSine/5) and (totalCosine/5)...

I then use atan2 to convert the averages back into an angle...

It doesn't work. I have mixed and matched values all over the place...

I get weird ass fucking numbers, like I give it two or three of the same number and I get back like 6.124125 or some really odd number.

I looked at this post: http://www.bio.net/bionet/mm/molmod...ary/000853.html

and...

this one I started off with and got those numbers to test: http://positivelyglorious.com/softw...es-of-azimuths/


Any ideas?

Old Post Sep-29-2009 10:37 
Click Here to See the Profile for Joss Weatherby Click here to Send Joss Weatherby a Private Message Visit Joss Weatherby's homepage! Add Joss Weatherby to your buddy list Report this Post Reply w/Quote Edit/Delete Message
boris_the_bear
Supreme tranceaddict



Registered: Oct 2008
Location: Lower Chernobylstan

to put it simple

Old Post Sep-29-2009 10:45  Ukraine
Click Here to See the Profile for boris_the_bear Click here to Send boris_the_bear a Private Message Add boris_the_bear to your buddy list Report this Post Reply w/Quote Edit/Delete Message
basd
progression



Registered: Jul 2002
Location: Somewhere nowhere

It's been a while since I did geometry, so could you explain why

(355 + 358 + 0 + 5 + 351) / 5 wouldn't work?

The average of a 30 degree and a 60 degree angle is 45, isn't it?


___________________

d&b session 20090519
My take on... (various mixes planned, updated when I can be arsed)

Old Post Sep-29-2009 10:46  Netherlands
Click Here to See the Profile for basd Click here to Send basd a Private Message Add basd to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Joss Weatherby
Banned



Registered: May 2008
Location: The Pacific Northwest, of course

quote:
Originally posted by basd
It's been a while since I did geometry, so could you explain why

(355 + 358 + 0 + 5 + 351) / 5 wouldn't work?

The average of a 30 degree and a 60 degree angle is 45, isn't it?


Think about a compass, you have to account for the fact that as value goes 0 is closer to 358 than 355.

Old Post Sep-29-2009 10:50 
Click Here to See the Profile for Joss Weatherby Click here to Send Joss Weatherby a Private Message Visit Joss Weatherby's homepage! Add Joss Weatherby to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Meat187
Diese scheiß Katze



Registered: Dec 2007
Location: The Night's Plutonian Shore

-2.2 °


___________________

Then stop coloring and visit Meat187's mix archive!

Old Post Sep-29-2009 11:18  Germany
Click Here to See the Profile for Meat187 Click here to Send Meat187 a Private Message Add Meat187 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Meat187
Diese scheiß Katze



Registered: Dec 2007
Location: The Night's Plutonian Shore
Re: Math help!!!

quote:
Originally posted by Joss Weatherby
Then I go through the radians and I convert them to their sine and cosine values and add those up.


Also, I think it can be done easier than that, but you're doing it wrong right here.
tan = sin/cos


___________________

Then stop coloring and visit Meat187's mix archive!

Old Post Sep-29-2009 11:24  Germany
Click Here to See the Profile for Meat187 Click here to Send Meat187 a Private Message Add Meat187 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
basd
progression



Registered: Jul 2002
Location: Somewhere nowhere

quote:
Originally posted by Joss Weatherby
Think about a compass, you have to account for the fact that as value goes 0 is closer to 358 than 355.

You're right.

Then it's -2,2 indeed.

If you count 355 as -5, 358 as -2 and 351 as -9 you get

-5 + -2 + 0 + 5 + -9 = -11

-11 / 5 = -2,2. No need for any complicated geometric calculations, I suppose.


___________________

d&b session 20090519
My take on... (various mixes planned, updated when I can be arsed)

Old Post Sep-29-2009 11:36  Netherlands
Click Here to See the Profile for basd Click here to Send basd a Private Message Add basd to your buddy list Report this Post Reply w/Quote Edit/Delete Message
winston
ultraviolet catastrophe



Registered: Nov 2005
Location: Yggdrasill

i think he's looking for a way to do this on c/c++

something like

x = y = 0
foreach angle {
x += cos(angle)
y += sin(angle)
}
average_angle = atan2(y, x)


just a guess.

Old Post Sep-29-2009 13:13 
Click Here to See the Profile for winston Click here to Send winston a Private Message Add winston to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Acton
Like a FCKNG BIRD



Registered: Mar 2002
Location: London

quote:
Originally posted by winston
i think he's looking for a way to do this on c/c++


Urgh!


___________________

>>> Beatport Stuff <<<

Old Post Sep-29-2009 13:15  England
Click Here to See the Profile for Acton Click here to Send Acton a Private Message Visit Acton's homepage! Add Acton to your buddy list Report this Post Reply w/Quote Edit/Delete Message
colonelcrisp
Isn't Batshit Crazy



Registered: Apr 2003
Location: Ottawa

just create unit vectors for each of your angles and sum them.....


___________________
quote:
Originally posted by pkcRAISTLIN
I have 3 hobbies: gaming, DJing & correcting maladjusted fools on the internet.

quote:
Originally posted by pkcRAISTLIN
Yeah, I’d like to know what horrible, scarring incident in your childhood turned you into such an ignorant, intellectual-hating philistine?

Old Post Sep-29-2009 14:57  Canada
Click Here to See the Profile for colonelcrisp Click here to Send colonelcrisp a Private Message Add colonelcrisp to your buddy list Report this Post Reply w/Quote Edit/Delete Message
verndogs
GET THE TANK!



Registered: Jan 2004
Location: Sports Discussion Forum - NYC

This is why you want to go to school instead of being a bum


___________________

quote:
[11:58] Bas //: fuck he's hot

Old Post Sep-29-2009 16:16  Philippines
Click Here to See the Profile for verndogs Click here to Send verndogs a Private Message Add verndogs to your buddy list Report this Post Reply w/Quote Edit/Delete Message
TranceOwnsLol
Hi mom!!!



Registered: Nov 2007
Location: Singapore

do it in java

public class AvgAngles {

void print()

{
System.out.println(-5+-2+0+5-9/11);
}
public static void main(String[] args) {

AvgAngles calc=new AvgAngles();
calc.print();
}
}

Old Post Sep-29-2009 16:27  Philippines
Click Here to See the Profile for TranceOwnsLol Click here to Send TranceOwnsLol a Private Message Add TranceOwnsLol to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > Math help!!!
Post New Thread    Post A Reply

Pages (3): [1] 2 3 »  
Last Thread   Next Thread
Click here to listen to the sample!Pause playbackDirty Vegas - I Should Know (Flatline Dub) [2006] [2]

Click here to listen to the sample!Pause playbackSubway Baby - Tribes Of Khan Gala (DJ Gogo Remix) [2004]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 04:17.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2025, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!