Đang chuẩn bị liên kết để tải về tài liệu:
Foundation Silverlight 3 Animation- P9
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Foundation Silverlight 3 Animation- P9: Silverlight has really come a long way since I started using it. It’s kind of interesting to look back a mere two years (roughly) and think about how the workflow has changed. Of even more interest is the staggering speed at which new features are being added. In the time I’ve been using Silverlight, it has grown from a somewhat limited toolset to an ever-more-impressive technology that has really started to come into its own. | USING TRIGONOMETRY FOR ANIMATION Sine Sin An angle s sine is the ratio of the angle s opposite side to the hypotenuse. To calculate the sine of an angle with code we use the built-in sine function of C Math.Sin AnglelnRadians So in code assuming our conversion functions are in place we would use the following Math.Sin DegreesToRadians 35 And we get 0.573576436351046. This does not seem like a meaningful number at first glance does it This number describes the relationship of the opposite side of the triangle to the hypotenuse. What we have determined is that sine 35 0.573576436351046 opposite hypotenuse. We now know that for any right triangle that has a 35-degree angle the ratio of the opposite side to the hypotenuse will be 0.573576436351046. I know you re waiting for me to explain how this helps us. Let s assume the hypotenuse of our triangle is 15 feet long. How long is the opposite side sine 35 opposite hypotenuse In order to solve for the opposite side we multiply both sides of this equation by the hypotenuse. This effectively negates the hypotenuse in the right side of the equation see Figure 6-7 . sine 35 x hypotenuse opposite hypotenuse x hypotenuse 0.573576436351046 x hypotenuse opposite hypotenuse x hypotenuse 0.573576436351046 X hypotenuse opposite 0.573576436351046 X 15 opposite opposite 8.60 Figure 6-7. The sine of our angle multiplied by the length of the hypotenuse gives us the length of the opposite side. So there you have it we just used the sine function to figure out how long the opposite side of a triangle is. We ll put this into a Silverlight context in a bit right now we re going to move on to the cosine function. 221 CHAPTER 6 Cosine Cos The cosine function is the ratio of the angle s adjacent side to the hypotenuse. To calculate the cosine of an angle with code use the built-in cosine function of C see Figure 6-8 Math.Cos AnglelnRadians Once again assuming our degrees radians conversion functions are in place we would use the following .