| Thread (16 posts) | ||
|---|---|---|
|
eric_w66 1/20/08 1:46:49 PM
|
||
|
Hard Core Member
Joined: 1/12/06 |
I'm 20ish years removed from trig, so I've forgotten most of what I knew. I've searched the net, but can't find a "simple" answer, everything I've found deals with problems more complicated than mine... All I need to do is to be able to find the angle to a specific point on a grid. For instance, the angle to (5, 5) is 45 degrees. I can do that. acos(5 / sqrt(5*5 + 5*5)) / (2pi) * 360. And the angle to (2, 20) is acos(2 / sqrt(2 * 2 + 20 * 20)) / (2pi) * 360 = 84 degrees. But... my problem comes in when I want to find, say, (2, -20). I still come up with 84 degrees. What am I overlooking (something with signs I'm sure)? Thanks in advance. |
|
| |
||
|
tylerthedrui 1/20/08 1:51:03 PM
|
||
|
Novice Member
Joined: 3/20/07
RATING MMOS: |
2, -20 would still be 84 degrees from the x-axis. You could find the 'actual' angle by Degrees are always positive unless you've moved clockwise from the origin. So this point would be -84 degrees. or, if you were moving counterclockwise from origin, it would be 276 degrees (360-84) There are four quadrants, and 2, -20 is in the fourth (the bottom right one). |
|
| |
||
|
eric_w66 1/20/08 1:57:34 PM
|
||
|
Hard Core Member
Joined: 1/12/06 |
So the only thing I can really do is just check the signs of the x and y coords to find the quadrant and work it from there? Poopy, I hate inelegant solutions like that :).
I wanted some clean way to come up with the 276 :). |
|
| |
||
|
tylerthedrui 1/20/08 5:15:39 PM
|
||
|
Novice Member
Joined: 3/20/07
RATING MMOS: |
I would prefer a clean way too, but the arccos has no negative range :(. (I think) |
|
| |
||
|
Nasica 1/20/08 5:17:30 PM
|
||
|
Apprentice Member
Joined: 10/13/04
The Footprint of The Buddha |
Originally posted by tylerthedrui Your using length to calculate angles. |
|
| |
||
|
Adreal 1/20/08 7:08:54 PM
|
||
|
Apprentice Member
Joined: 2/05/04
Scripture is only as ambiguous as our ignorance of it allows it to be. |
Ah, to be young and work with numbers in math... *sigh* I guess it's back to practicing my sideways 8's. |
|
| "Put your foot where your mouth is." - Wisdom from my grandfather |
||
|
eric_w66 1/20/08 7:43:14 PM
|
||
|
Hard Core Member
Joined: 1/12/06 |
Hehe, that's the problem, I'm not young anymore, and I've forgotten how to do the easy stuff LOL. I have a super fancy computer and a super fancy calculator, but I can barely remember how to do this stuff. |
|
| |
||
|
tylerthedrui 1/20/08 10:16:41 PM
|
||
|
Novice Member
Joined: 3/20/07
RATING MMOS: |
Originally posted by Nasica Wasn't talking about a negative length. Negative angles are measured clockwise from the origin. GB lost because we were calling stupid plays and trying to be heroes rather than jump on the fumble :'( |
|
| |
||
|
Nasica 1/20/08 10:26:37 PM
|
||
|
Apprentice Member
Joined: 10/13/04
The Footprint of The Buddha |
Originally posted by tylerthedrui My apologies, i actually didnt mean to quote you, but to quote the message above yours by the OP |
|
| |
||
|
Sharajat 1/20/08 10:26:42 PM
|
||
|
Elite Member
Joined: 12/14/07 |
Remember, the Tangent of an angle is the opposite over the adjacent. Divide the Y coordinate by the X coordinate, then take the inverse tangent of that number, and boom, you have the angle. Its a joke, really, when you remember the method. |
|
| |
||
|
eric_w66 1/20/08 11:26:34 PM
|
||
|
| ||