Author 
Message 
Homer_simpson

Posted: Tue Jul 01, 2003 5:24 pm Post subject: Angle of a line... 


how do i calculate angle A knowing that line1 is always horizontal and having the coordinates of line2...
i know it has to be done using Sine and Cosine but i dont exactly know how....
Haven't had math in while so i've forgotten a few stuff... =/
Description: 

Filesize: 
7.86 KB 
Viewed: 
6561 Time(s) 







Sponsor Sponsor



Catalyst

Posted: Tue Jul 01, 2003 5:40 pm Post subject: (No subject) 


SOH CAH TOA
sin=op/hyp
your hyp is the distance from point1 to point2
since line 2 is always horizontal that distance is y2y1
angle=sin1((y2y1)/distance (p1,p2))






Andy

Posted: Tue Jul 01, 2003 5:40 pm Post subject: (No subject) 


since tan of an angle is the oposite side over the adjancent side, you simply set up an equation of tan(x)=10/20 tan(x)=1/2 then u juss do tan inverse and you get 45 degrees






SilverSprite

Posted: Tue Jul 01, 2003 6:07 pm Post subject: (No subject) 


yepyep just something to add.. since tan is opposite side over adjacent side.. that means that it is simply the slope of the line meaning that tanA where A is the required angle is equal to the slope of the line.. so A = arctand(slope of line)






Homer_simpson

Posted: Tue Jul 01, 2003 6:44 pm Post subject: (No subject) 


hmmm.... got it!!! thx...
here's another question how do i caculate tangent (a) in Turing?






Andy

Posted: Tue Jul 01, 2003 6:53 pm Post subject: (No subject) 


there is no tangent in turing, but since tan(A)=sin(A)/cos(A) just substitute it






Homer_simpson

Posted: Tue Jul 01, 2003 6:58 pm Post subject: (No subject) 


no it's not i thought of that and i tried it b4 it doesn't work !!! =(
Edit:oh wait nvm i used cos instead of cosd now it works...
code:  function tan (r : real) : real
result (sind (r) / cosd (r))
end tan
put tan (1) 
how do i do arctan or sine1? **1 doesn't work =/






AsianSensation

Posted: Tue Jul 01, 2003 8:52 pm Post subject: (No subject) 


funny thing is, the geniuses who made turing(tom) decided not to put a inverse cos and sin function, said it was irrelevant.
so the best bet for using inverse tan is to make one urself....






Sponsor Sponsor



Catalyst





AsianSensation

Posted: Tue Jul 01, 2003 9:19 pm Post subject: (No subject) 


*stick foot in mouth
whoa, they had an arctan function? damn.......Im ignorant.......






Andy

Posted: Tue Jul 01, 2003 9:43 pm Post subject: (No subject) 


wow that's really cool... make ur own inverse functions






SilverSprite

Posted: Tue Jul 01, 2003 11:46 pm Post subject: (No subject) 


its math dodge.. you go to massey you should undetrstand those..






Homer_simpson

Posted: Wed Jul 02, 2003 12:00 am Post subject: (No subject) 


i didn't know they had arctan tangent in turing either... in fact that was all that i needed...
so here's how it goes:
code:  View.Set ("offscreenonly")
var x1, x2, y1, y2, b := 0
var slope, ang : real
x1 := 100
y1 := 100
loop
mousewhere (x2, y2, b)
drawline (0, y1, 640, y1, 12)
if not (x2 = x1) then
slope := (y2  y1) / (x2  x1)
end if
ang := arctand (slope)
locate (1, 1)
put "coords : ", x1, "/", y1, "/", x2, "/", y2
put "slope : ", slope
put "angle :", ang
drawline (x1, y1, x2, y2, 9)
delay (5)
View.Update
cls
end loop







Catalyst

Posted: Wed Jul 02, 2003 12:15 am Post subject: (No subject) 


there some problems there
such as the negative angles and the fact and from 180 to 270 show as 090






Homer_simpson

Posted: Wed Jul 02, 2003 12:37 am Post subject: (No subject) 


lol well yeah... but it is fixable if you try to fix it... i have fixed it and used it in my new particle engine with gravity support which i'll upload in a few minutes...






