Graphics Programs Reference
In-Depth Information
off to the nearest integer, and this number is divided by 10000 to get a number with a
decimal point. The net effect of multiplying and then dividing by 10000 is to round the
sin and cos functions off to the nearest four decimal points.
36
37
38
39
40
41
42
// display the numerical values
degrees_txt.text = angleInDegrees;
sin_txt.text = Math.round(10000*Math.sin(angleInRadians))
/10000;
cos_txt.text = Math.round(10000*Math.cos(angleInRadians))
/10000;
};
Exercise 5.4: Using Sine Wave Motion
Now that we have seen what a sine wave looks like, let's take a look at an example of
sinusoidal motion. One of the first and most classical demonstrations of this appeared
in the study of the motion of a clock's pendulum, a major advance in technology at the
time. Open 5_4_clockWatcher.swf in the Chapter 5 Completed_Exercises folder to
see the motion of a pendulum and test your powers of observation like a true scientist.
For our pendulum we will assume that all of its weight is concentrated at a point in the
bottom, and we'll live in an ideal world that has no friction.
Figure 5.26 Sinusoidal motion in a pendulum
Search WWH ::




Custom Search