Angles and Lengths
Welcome to Foundation Flash tutorials. In today's tutorial, we will learn about the basics of trigonometry. Now, don't just skip this, and think, "wait a minute, what has this got to do with flash?", because in the coming weeks, I will teach you how flash handles trigonometric functions, and how you can use them in your flash games, and eventually, I will teach you how to make a small game, using trigonometry.
But first, you had better know the basics. Now, the first, and very important thing that you have to do is to label the sides of your triangle. This will help you decide which trigonometric function to use. As you know there are three sides to a triangle, so there are three side labels. Opposite, adjacent and hypotenuse. These are easy to understand. As you should know, the hypotenuse of a triangle is the longest side. The opposite side is the side which is opposite the angle in question. The adjacent is the side adjacent to the angle in question, or, as I like to call it "the other one".
So, know you have labeled your triangle, you want to do some trigonometry. Well, say you wanted to find x:
Well, you'd have to know which function to use. There are three: sin, cos, tan. To know which one to use, you have to know which sides will be involved in the equation. The sides involved in that picture are the opposite and the hypotenuse, therefore we use sin. How do I know this? SOH, CAH, TOA. remember it "sohcahtoa". One word. The first one: Sin Opposite Hypotenuse. The second: Cos Adjacent Hypotenuse. The third: Tan Opposite Adjacent. So, if the adjacent and the hypotenuse are involved, use the cos function. If the opposite and the adjacent are involved, use tan. Or, like in this case, if the opposite and the hypotenuse are involved, use sin. So, what do we do with these functions? Well, you'll need a scientific calculator. Or just go to start > accessories > Calculator. We have three buttons, sin cos and tan. These are our trigonometric functions. They deal with the angle. In this situtation you need to know that sin A = O/H. Or sin Angle = Opposite divided by Hypotenuse. It works like sohcahtoa for all three functions. So, cos A = A/H and tan A = O/A.
But like I said, we only need to worry about sin in this case. So, we know that sin A = O/H, and considering A is our angle, we know that sin 60 = x/15, and from that, we can work out that x = 15*sin 60. So type into your calculator: 15 x sin 60, or if you are using calculator in windows, you will have to type: sin 60, then multiply that by 15. You should end up with around 12.99, which would be the length of the opposite side. Well, I hope you've learned about trigonometric functions, and next time, I'll teach you how to find the angle. Thanks for reading this,