Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Comparing Slopeangle to 360 Degree Angle
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Expirant




PostPosted: 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:
code:

put arctand (Slope (200, 100, 100, 200))
Draw.Line (200, 100, 100, 200, black)
Draw.Line (200, 100, 100, 100, black)
Draw.Line (100, 100, 100, 200, black)


= -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
Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: Mon Oct 30, 2006 11:19 pm   Post subject: (No 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: