Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / angle of two points

Author
Message
Billj
22
Years of Service
User Offline
Joined: 20th Sep 2003
Location:
Posted: 29th Nov 2003 01:35
I am trying to make a function that draws a line and i am using cosine and sine but i ran into a problem. I dont know how to find the angle of two points like if the first point was the center of a circle and the second point was a point on that circle?

The programmer is the ultimate being
Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 29th Nov 2003 02:57
I believe atanfull is what you are looking for, but I wouldn't swear to it. My trig isn't too good.
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 29th Nov 2003 06:28
=atanfull(x1-x2,z1-z2)


God created the world in 7 days, but we're still waiting for the patch.
Gir
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Crazy Taco
Posted: 29th Nov 2003 19:15 Edited at: 29th Nov 2003 19:22
what exactley does atanfull do? ive seen it on a couple of posts and i think i might need it for one of my functions. hehe if u could draw me a pic?

Edit: I have my dunces hat on standby......

I'm makin' a cake...
BHoltzman
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 29th Nov 2003 21:14 Edited at: 30th Nov 2003 04:38
Atan is the inverse of tan. So if tan = sin/cos, atan = cos/sin

This makes the range and domain of the function switch places.
Since sin is in the denominator the function is no longer defined for sin = 0, which means the function approaches infinity as sin(x) approaches 0

sin(x) = 0 at x = 0 and x = 180 and any multiple of 180.

Alright, hope that helps.

EDIT: Ooops I didn't quite answer your question. When a mathematical function does the inverse of another function then the result is the argument of the first function that's being undon. So ATan(Tan(X)) = X. This is very useful if you only have a number like 1.36 and you want to find out what angle to put in the Tan() function in order to get 1.36. Instead of guessing with a hit or miss algorithm, using ATan will take you straight to the answer.
Gir
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Crazy Taco
Posted: 30th Nov 2003 05:06
Cheers u did help, ive been using sin and cos in my code to work out bullet hole hit places, works fine un till u get to the outer range(ie u look too far up or too far down and the bullet hole becomes less and less acurate). Now how to work this new found knowledge into my equation...

I'm makin' a cake...

Login to post a reply

Server time is: 2026-07-27 05:46:05
Your offset time is: 2026-07-27 05:46:05