
-----------------------------------
Homer_simpson
Tue Jul 01, 2003 5:24 pm

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....
http://www.compsci.ca/bbs/download.php?id=416

Haven't had math in while so i've forgotten a few stuff... =/

-----------------------------------
Catalyst
Tue Jul 01, 2003 5:40 pm


-----------------------------------
SOH CAH TOA

sin=op/hyp

your hyp is the distance from point1 to point2
since line 2 is always horizontal that distance is y2-y1

angle=sin-1((y2-y1)/distance (p1,p2))

-----------------------------------
Andy
Tue Jul 01, 2003 5:40 pm


-----------------------------------
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
Tue Jul 01, 2003 6:07 pm


-----------------------------------
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
Tue Jul 01, 2003 6:44 pm


-----------------------------------
hmmm.... got it!!! thx...
here's another question how do i caculate tangent (a) in Turing?

-----------------------------------
Andy
Tue Jul 01, 2003 6:53 pm


-----------------------------------
there is no tangent in turing, but since tan(A)=sin(A)/cos(A) just substitute it

-----------------------------------
Homer_simpson
Tue Jul 01, 2003 6:58 pm


-----------------------------------
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...

function tan (r : real) : real
    result (sind (r) / cosd (r))
end tan

put tan (1)

how do i do arctan or sine-1?    **-1  doesn't work =/

-----------------------------------
AsianSensation
Tue Jul 01, 2003 8:52 pm


-----------------------------------
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....

-----------------------------------
Catalyst
Tue Jul 01, 2003 9:09 pm


-----------------------------------
such an old post (this is also in the help file)

http://www.compsci.ca/bbs/viewtopic.php?t=263&highlight=inverse

-----------------------------------
AsianSensation
Tue Jul 01, 2003 9:19 pm


-----------------------------------
*stick foot in mouth

whoa, they had an arctan function? damn.......Im ignorant.......

-----------------------------------
Andy
Tue Jul 01, 2003 9:43 pm


-----------------------------------
wow that's really cool... make ur own inverse functions

-----------------------------------
SilverSprite
Tue Jul 01, 2003 11:46 pm


-----------------------------------
its math dodge.. you go to massey you should undetrstand those..

-----------------------------------
Homer_simpson
Wed Jul 02, 2003 12:00 am


-----------------------------------
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:
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
Wed Jul 02, 2003 12:15 am


-----------------------------------
there some problems there
such as the negative angles and the fact and from 180 to 270 show as 0-90

-----------------------------------
Homer_simpson
Wed Jul 02, 2003 12:37 am


-----------------------------------
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...

-----------------------------------
Andy
Wed Jul 02, 2003 9:25 am


-----------------------------------
its math dodge.. you go to massey you should undetrstand those..
sorry silversprite that i'm not as smart as you plus i suck at turing, i didn't even know about arctan

-----------------------------------
SilverSprite
Wed Jul 02, 2003 11:13 am


-----------------------------------
 ... i suck at turing, i didn't even know about arctan
omg GEEK :P

-----------------------------------
Andy
Thu Jul 03, 2003 9:51 am


-----------------------------------
? how does that work... ur calling me a geek cause i don't spend time programming?

-----------------------------------
SilverSprite
Thu Jul 03, 2003 1:47 pm


-----------------------------------
nope.. just cuz you find it your duty or a need to memorize all turing commands... like it'll matter

-----------------------------------
krishon
Thu Jul 03, 2003 4:32 pm


-----------------------------------
lol, silversprite's got a point there

-----------------------------------
Andy
Thu Jul 03, 2003 5:13 pm


-----------------------------------
no i was simply admitting that i'm not some compsci wiz

-----------------------------------
SilverSprite
Thu Jul 03, 2003 5:31 pm


-----------------------------------
lol, silversprite's got a point there
thx krishon.. its the truth lol
no i was simply admitting that i'm not some compsci wiz 
you sure do an excessive amount of compsci.. and your still not a wiz?
 ? how does that work... ur calling me a geek cause i don't spend time programming?
i'm just playing around with you dodge.. you know me.. dont take it personally jkjkjkJK

-----------------------------------
Andy
Thu Jul 03, 2003 5:39 pm


-----------------------------------
hey man ever heard of china man dun understand sarcasm?

-----------------------------------
SilverSprite
Thu Jul 03, 2003 5:49 pm


-----------------------------------
nope and dont care

-----------------------------------
Homer_simpson
Thu Jul 03, 2003 6:03 pm


-----------------------------------
This discussion is giong off topic and getting stupid again... so just stop here...

-----------------------------------
Andy
Thu Jul 03, 2003 7:01 pm


-----------------------------------
well we finished answering ur question didn't we?

-----------------------------------
Homer_simpson
Thu Jul 03, 2003 7:36 pm


-----------------------------------
well then i dont see reason to start a new nonsense discussion and spam the forum...

-----------------------------------
JSBN
Thu Jul 03, 2003 11:58 pm


-----------------------------------
This reminds me, does any1 still want those trajectory formulas?

-----------------------------------
JayLo
Fri Jul 04, 2003 12:07 am


-----------------------------------
yes, please.
