Computer Science Canada Comparing Slopeangle to 360 Degree Angle |
Author: | Expirant [ Mon Oct 30, 2006 10:50 pm ] | ||
Post subject: | Comparing Slopeangle to 360 Degree Angle | ||
I've been messing around with this idea, and was wondering if there was a more efficient way of comparing the two than simply adding on what's needed using an if statement. What I mean is that when you calculate slopeangle (with arctand, anyways) of a line, you get an angle between either 0 and 90 or 0 and -90. Thing is, I'd like to get the 360 degree that this angle corresponds to. Example:
= -45 (or 45 if the line [hypotenuse] is going the other way) But what I'd like to be able to calculate in an efficient way is where that angle fits in on a 360 degree graph. So...in the top right quadrant that 45 = 45, top left that 45 would equal 135, bottom left it would be 225, and bottom right it would be 315 (all degrees) So am I missing out on something? Is there an efficient way to calculate this? Is there even a -way- to calculate this? Possibly using something other than slopeangle? Let me know if that isn't really making sense, but to sum up, I basically would like to have an equation that calculates a degree (0-360) taken from a slopeangle (which can only be between 0 and (+-)90. Thanks, Expirant |
Author: | ericfourfour [ Mon Oct 30, 2006 11:19 pm ] |
Post subject: | |
This question has been asked countless times in the past month. I bet you could find the answer to your question on the first page of Turing help. If not, its guaranteed to be on the second. |