Converting QBasic Angles to Mathematical Angles
Date: 08/11/99 at 20:06:14 From: Anonymous Subject: Angles in general I have been taking a look through your archives and found a doctor's response talking about negative angles. I realized I must have something wrong. I thought angles were measured like this: (This is supposed to be a circle, but is hard to draw.) 360 /|\ / | \ / | \ 270 /___|___\ 90 \ | / \ | / \ | / \|/ 180 Is this right? Is this sort of thing standardized? How can you have a negative angle? And is there an angle 0, or 360, or both, or what? Please clarify - I would be so grateful. Thank you so much. Anonymous
Date: 08/12/99 at 11:17:20 From: Doctor Annie Subject: Re: Angles in general Hi there. Good questions! I hope I can shed some light on the subject for you. Mathematicians look at angles in a way that's different from, say, navigators. I think that the way you've drawn your "circle" is how the captain of a ship would look at the angles - 0 (or 360) is north, etc. Mathematicians number the circle like this: 90 180 0 270 That is the standardized way, in the "coordinate plane," of labeling angles. Now, about negative angles. In the coordinate plane, 270 degrees is the same as -90 degrees: you can go 270 degrees counterclockwise, or you can go 90 degrees clockwise, and you'll get to the same place. So there _are_ such things as negative angles. If we are looking at the angle below, we would just call it "37 degrees." It doesn't have a frame of reference the way an angle that starts at the origin does. And we wouldn't ever call it -323 degrees. \ / \ / \ / \ / \/ As for 0/360, you can have a 360-degree angle, in a way, especially on the coordinate plane. You end up in the same place as if you have a 0-degree angle, but it implies that you've moved around the circle once. A 720-degree angle would imply that you've moved around the circle twice. A 540-degree angle implies that you've moved around the circle 1.5 times, and are in the same place as a 180-degree angle. I sure hope this helps some. Feel free to write back if you need something explained in a different way. - Doctor Annie, The Math Forum http://mathforum.org/dr.math/
Date: 08/12/99 at 12:59:19 From: Anonymous Subject: Re: Angles in general Dear Dr. Annie, Thank you for your help. I have one more question, though. I am currently programming with QBasic and it shows degrees like so: 0 270 90 180 which is wrong, correct? How can I correct what it is doing? I have thought about everything, but how can I "invert" it, or do something to it, to change it to: 90 180 0 270 It's basically going the wrong way, so somehow I need to fix it to go the other way, and then possibly subtract 90 degrees to make it start in the right place. So basically I need a formula that I can run angles through to fix or convert them. I think you know what I mean. Thanks a lot, Anonymous P.S. You guys are great - keep up the good work! :-)
Date: 08/13/99 at 20:00:32 From: Doctor Annie Subject: Re: Angles in general >I have one more question, though. I am currently programming with >QBasic and it shows degrees like so: > > 0 > 270 90 > 180 > >which is wrong, correct? Well, not "wrong," but it's not the system that mathematicians use. >How can I correct what it is doing? Let's think about this. I can explain one way to do it, but then I will have to think about the math behind doing it. Stick with me, and make sure you have a pencil :-) If you _reflected_ the QBasic version over a "vertical" line (like the y-axis in the coordinate plane), you would get: 0 90 270 180 That gets things going counterclockwise. Then you subtract 90 degrees (or add 90, depending on how you look at it), and you're back where the mathematicians say you should be. But how do you do the "reflection"? (You could also do the -90 and then the reflection, though it would now be over a horizontal axis.) Hmmmm... Another way to do it is to reflect any angle you get over the line y = x (or 45 degrees). (Draw a picture of that and I think you'll see how it works.) So let's say that QBasic gives you 30 degrees. That's really 60 degrees in "our" system. I am guessing that if QBasic says 30, you want it to spit out 60. If that's not right, then you'll have to adapt this, or write back. Let's give it a shot. Since 45 degrees is our "line of reflection," take 45-30. You get 15. Then add 45 to 15, to get 60. This also works with 15 degrees: 45 - 15 = 30 30 + 45 = 75 Start with 60: 45 - 60 = -15 -15 + 45 = 30 So far so good. Does it work for things that aren't in that corner of the world? Let's see. If QBasic gives you 120, that's really 330: 45 - 120 = -75, -75 + 45 = -30, which is really 330. Hey - that's darn close! Let's try another one. 240 in QBasic is 210 in the real world. 45 - 240 = -195, -195 + 45 = -150, and -150 = 210. This might actually work! Then you could put in a check so that if the result you get in the end is less than zero, you add it to 360 to get the answer. How's that? Please let me know if it actually works - since I'm not 100% sure what you're doing, it might or might not be easy to implement. :-) - Doctor Annie, The Math Forum http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.