
-----------------------------------
Flikerator
Fri Dec 30, 2005 12:59 am

Slope to Degrees
-----------------------------------
How do I translate Slope into Degrees and Degrees into slope? I just need a formula of some sort. Thansk ^_^

-----------------------------------
wtd
Fri Dec 30, 2005 1:17 am


-----------------------------------
Trigonometric functions.  Research "cos", "sin", "tan".

-----------------------------------
Andy
Thu Jan 05, 2006 11:25 am


-----------------------------------
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
Wed Jan 11, 2006 10:01 am


-----------------------------------
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
Thu Jan 19, 2006 5:31 pm


-----------------------------------
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
Fri Jan 20, 2006 12:14 am


-----------------------------------
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
Fri Jan 20, 2006 4:16 pm


-----------------------------------
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
Sat Jan 21, 2006 12:22 pm


-----------------------------------
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

-----------------------------------
wtd
Sat Jan 21, 2006 2:02 pm


-----------------------------------
http://www.compsci.ca/v2/viewtopic.php?t=11101
