Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Sine and Cosine Help
- flynn2019pw
-
55 posts
Sine and Cosine Help
Nearly every awesome project i've seen has sine or cosine in it. I get how it draws a triangle, but how does it draw it? does it draw it to the corner, edge, angle, mouse… I can't figure it out.
- drmcw
-
1000+ posts
Sine and Cosine Help
They don't draw anything, they just relate the angles of a right angled triangle to the lengths of it's sides.
http://en.wikipedia.org/wiki/Trigonometry
You could think of them as ways to map between polar and cartesian coordinates.
http://en.wikipedia.org/wiki/Trigonometry
You could think of them as ways to map between polar and cartesian coordinates.
Last edited by drmcw (May 27, 2014 21:03:04)
- bobbybee
-
1000+ posts
Sine and Cosine Help
More specifically, the sine of angle θ (theta) is the points on a circle represented as a 1D line (cosine is sine of θ-90 degrees).
A point on a circle is equal to (sin θ, cos θ) in Cartesian coordinates.
You can draw a unit circle by setting pen down, looping from zero to 360 and moving to designated coordinate for that value of theta, then finally taking pen up.
Play with it!
A point on a circle is equal to (sin θ, cos θ) in Cartesian coordinates.
You can draw a unit circle by setting pen down, looping from zero to 360 and moving to designated coordinate for that value of theta, then finally taking pen up.
Play with it!
- flynn2019pw
-
55 posts
Sine and Cosine Help
So how does Scratch know the length of the triangle's sides to relate to the angles? They don't draw anything, they just relate the angles of a right angled triangle to the lengths of it's sides.
http://en.wikipedia.org/wiki/Trigonometry
You could think of them as ways to map between polar and cartesian coordinates.
- drmcw
-
1000+ posts
Sine and Cosine Help
You tell it! If you have an angle and one side then you can calculate the other sides using trigonometry or by having 2 sides you can calculate the angles, look at the Wikipedia link, that has more info than I could type here.So how does Scratch know the length of the triangle's sides to relate to the angles? They don't draw anything, they just relate the angles of a right angled triangle to the lengths of it's sides.
http://en.wikipedia.org/wiki/Trigonometry
You could think of them as ways to map between polar and cartesian coordinates.
As an example this project http://scratch.mit.edu.ezproxyberklee.flo.org/projects/11178361/ moves a sprite in an arc as it knows the length of the pendulum and it's angle it can use trigonometry to calculate the x and y coordinates for the sprite.
Last edited by drmcw (May 27, 2014 21:55:16)
- flynn2019pw
-
55 posts
Sine and Cosine Help
Oh, Okay! I remember something about this I learned a while ago….. triangle's angles determine it's side ratios, so a right triangle with an angle of 45 and 45 will equal out to about .59 when the opposite is divided by the hypotenuse. Thanks!
- Discussion Forums
- » Advanced Topics
-
» Sine and Cosine Help