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

Username:   Password: 
 RegisterRegister   
 Slope to Degrees
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Flikerator




PostPosted: Fri Dec 30, 2005 12:59 am   Post subject: Slope to Degrees

How do I translate Slope into Degrees and Degrees into slope? I just need a formula of some sort. Thansk ^_^
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Fri Dec 30, 2005 1:17 am   Post subject: (No subject)

Trigonometric functions. Research "cos", "sin", "tan".
Andy




PostPosted: Thu Jan 05, 2006 11:25 am   Post subject: (No subject)

well tan(a) will give you the angle between the line y=ax and the x axis, so all you need to do is take the tan inverse of an slope and u'll get the angle
codemage




PostPosted: Wed Jan 11, 2006 10:01 am   Post subject: (No subject)

Use ArcTan - but you'll have to create special cases for 90 and 270 degrees. (You can't take the tangent of an infinite slope).
Drakain Zeil




PostPosted: Thu Jan 19, 2006 5:31 pm   Post subject: (No subject)

Or how about we just take sin(a)/cos(a), and get you fokes off the sauce?

Tan (x) = Sin(x)/Cos(x), basic trig identities.

The tangent will describe the ratio of x to y, or run to rise. So, if we were to use the turring Draw.Line function, we could do...

var d:=45
var l:=150
Draw.Line (100,100,sind(d)*l,cosd(d)*l,black)

And we would have a 150px long line starting at (100,100), extending out at 45 degrees.

(sind, not sin, sin does radians in turing, we want degrees).
Andy




PostPosted: Fri Jan 20, 2006 12:14 am   Post subject: (No subject)

notice that all three of the people that posted are more than capable to provide the answer directly yet we didnt? let the person learn instead of just copying some formula from the internet and claiming its his
Drakain Zeil




PostPosted: Fri Jan 20, 2006 4:16 pm   Post subject: (No subject)

Yeah I kind of guessed that, but seeing as how my post was a good few days after his, and that one of the most common questions I see is related to degrees, I decided to post it. People get that responce to this sort of question and can't figure it out because often they don't have the background in math class to support it. Should we just not post code anymore at all and say "do that" ? Let's remove the specific forums too then. Oh well, so if some one does copy my 3 lines of code that I just wrote, the chances are that they'll look at it, and remeber how to do it in the future -- what a scarry thing.

It's not like I posted a huge function that requires massive understanding to write, it was 3 lines of code that use the basic trig ratios taught early in highschool, two of those lines were variable assignments. I fail to see how my post was harmful to another's learning.
Andy




PostPosted: Sat Jan 21, 2006 12:22 pm   Post subject: (No subject)

nono, im not saying your post is doing harm, but rather suggesting that if someone does ask for that, you shouldnt give them the answer, but in this case its alright because its been a while... anywho, sry if i sounded offensive, work is killing me
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sat Jan 21, 2006 2:02 pm   Post subject: (No subject)

http://www.compsci.ca/v2/viewtopic.php?t=11101
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: