A Flash Developer Resource Site

# Thread: "sin" is magic. I hate magic.

1. ## "sin" is magic. I hate magic.

I know how to use sin and cos, but what I dont know is how they work.

To me they are magic processes, can someone explain how they work - in an effort to make them seem less magical to me?

crack open the black box of the Math.sin function if you will.

Thankyou!

2. My experience with sine started with analog synthesizers, in which they were used to make music. I treated them as magic (useful magic) for years before I found out more about them. Although I don't like magic either, I think it helps to have played with sin/cos a bit (as you have) before having them fully explained.

I suspect a lot of trigonometry students are at a loss to understand sin/cos, because they don't get a chance to play with them, in the way that we do.

I wrote the following movie to help you get a more intuitive understanding of what they're about.

Basically, sin describes the relationship between one side of a right triangle and the hypoteneuse (the long side). Cos describes the relationship between the other side of the same right triangle and the hypoteneuse.

The movie demonstrates why they work to draw circles.

Sine/Cosine Movie

The Source Code

Play with the movie a while, perhaps in a separate window, before continuing.

When you view the movie, use the mouse to guide the triangle around the circle. As you go around, note the relationship between the blue line (sine) and the blue sine wave in the diagram.

Note the relationship between the green line and the green cosine waveform in the diagram.

The hypotenuse of the triangle is at an angle that corresponds to the angle that is being passed to sin/cos. The black line in the waveform diagram corresponds to that angle.

So sin(angle_of_hypoteneuse) gives us the length of the blue line if the hypoteneuse is 1.

So cos(angle_of_hypoteneuse) gives us the length of the green line if the hypoteneuse is 1.

When the hypoteneuse is 1, the perimeter of the circle has a length of 2*PI. This is why the angular units passed to sin and cos go from 0 to 2*PI.

3. And if you want to explore the relationships among the various trig functions in more detail here is another example.

Cheers,

Flick

4. this is sick...but useful

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap