Moderator Summary:
Sine (sin), cosine (cos), and tangent (tan) are trigonometric functions. They are useful in projects concerning direction. To read more about trigonometry you can view the wikipedia article here.
If you have further, specific questions about these blocks you can ask on this topic.
I have been taught in my algebra class how to use these formulas, but my math teacher didn't mention how to use the formulas on just numbers. So how do I use this formula?
because I still don't understand how I scroll in steps
/ \ / \
<change X by I sin of direction * 1 I * I speed * -1 I>
\ / \ /
/ \ / \
<change Y by I cos of direction * 1 I * I speed *-1 I>
\ / \ /
Last edited by demosthenes (2010-12-17 17:39:57)
Offline
The trigonometry functions are functions not formulas. It is a lot to explain in trig so I would rather not go into detail.
What do you know about trig already? It shouldn't be too hard to figure out uses for trig if you have been learning it in school.
Offline
Do you want me to write up a small lesson on trig? It might be a bit difficult for someone who is in 7th grade (and a lot to type out for me).
Offline
one more thing, I posted a neat idea on multiplayer idea in "show and tell" you should see that, it's a pretty basic idea, I don't know why nobody thought of it yet, it's not code
Last edited by dingdong (2008-05-10 00:51:53)
Offline
dingdong wrote:
I guess so, I really want to try understand sin, cos, and tan so I can make better games
To be honest it won't really help you that much but I'll try to explain anyways.
Trigonometry is a branch of mathematics that deals with triangles and right angled triangles in particular.
Sin is short for sine, tan is short for tangent, and cos is short for cosine.
All these are ratios between the sides of a triangle.
Tan is the ratio of the side opposite an angle to the side adjacent to an angle.
tan(B)=6/4
Cos is the ratio of the side adjacent to an angle to the hypotenuse.
cos(B)=4/7.21
Sin is the ratio of the side opposite an angle to the hypotenuse.
sin(B)=6/7.21
Example question:
In a right angled triangle the side opposite angle b is 3 and if angle b is 37 degrees then what size is the side adjacent to angle b?
tan(37)=3/adjacent
tan(37)= 0.753
0.753=3/adjacent
3/0.753= adjacent
3.984=adjacent
Rounded up adjacent = 4
Therefore the side adjacent to angle b is 4.
That is the very basics of trig. I am not very good with explaining math stuff so I am sorry if you don't understand it.
Last edited by archmage (2008-05-10 01:31:42)
Offline
That's useful, and i kinda get it, since we just got done studying triangles and Pythagoreans Theorem and stuff
Offline
Bluestribute wrote:
That's useful, and i kinda get it, since we just got done studying triangles and Pythagoreans Theorem and stuff
Yeah normally in programming you would the Pythagorean Theorem to find the distance between 2 points.
And you would normally use a formula to make a sprite point to a coordinate.
And you would normally use a formula to move a sprite in the direction it is facing.
But thanks to the distance to, point to, and move blocks scratch programmers don't have to worry about some of that complicated math stuff.
Offline
archmage wrote:
Bluestribute wrote:
That's useful, and i kinda get it, since we just got done studying triangles and Pythagoreans Theorem and stuff
Yeah normally in programming you would the Pythagorean Theorem to find the distance between 2 points.
And you would normally use a formula to make a sprite point to a coordinate.
And you would normally use a formula to move a sprite in the direction it is facing.
But thanks to the distance to, point to, and move blocks scratch programmers don't have to worry about some of that complicated math stuff.
Wait, I can use the Pythagoreans Theorem? I don't wait...........
Offline
Bluestribute wrote:
Wait, I can use the Pythagoreans Theorem? I don't wait...........
I made a challenge to people once if they could find distances using the Pythagoreans Theorem. Here is that thread http://scratch.mit.edu/forums/viewtopic.php?id=1802&p=2
Offline
I don't think I'm ready for that, since this is the first time understanding the trig blocks. I looked at it. Let me try to make a trig project. I'll post it here when I'm done.
Offline
archmage wrote:
dingdong wrote:
I guess so, I really want to try understand sin, cos, and tan so I can make better games
To be honest it won't really help you that much but I'll try to explain anyways.
Trigonometry is a branch of mathematics that deals with triangles and right angled triangles in particular.
Sin is short for sine, tan is short for tangent, and cos is short for cosine.
All these are ratios between the sides of a triangle.
http://id.mind.net/~zona/mmts/trigonome … /trig3.gif
Tan is the ratio of the side opposite an angle to the side adjacent to an angle.
tan(B)=6/4
Cos is the ratio of the side adjacent to an angle to the hypotenuse.
cos(B)=4/7.21
Sin is the ratio of the side opposite an angle to the hypotenuse.
sin(B)=6/7.21
Example question:
In a right angled triangle the side opposite angle b is 3 and if angle b is 37 degrees then what size is the side adjacent to angle b?
tan(37)=3/adjacent
tan(37)= 0.753
0.753=3/adjacent
3/0.753= adjacent
3.984=adjacent
Rounded up adjacent = 4
Therefore the side adjacent to angle b is 4.
That is the very basics of trig. I am not very good with explaining math stuff so I am sorry if you don't understand it.
I think I understand it, although I'm in 6th grade and don't have algebra yet... I just have no idea of how I can use those functions in a Scratch project. -_-
Offline
MyRedNeptune wrote:
I think I understand it, although I'm in 6th grade and don't have algebra yet... I just have no idea of how I can use those functions in a Scratch project. -_-
Let's say you have a sprite moving across the screen, and it's rotating as well. You want another sprite to move with it and appear to be attached to it. Maybe you are trying to make a mechanical arm of some sort, with an upper arm, forearm, and wrist sections, maybe like in my project Power Shovel 1.0 (hint hint). If all the sprites share the same origin, the problem is pretty simple, you just have all the parts Go To the main sprite.
But if the attached sprites are NOT at the same origin (maybe because they are rotating as well, then trig is very handy for calculating where they need to be and locating them there.
http://scratch.mit.edu/projects/Paddle2See/62394
Take a look at Power Shovel (link above) and look at the positioning logic for the Forearm and Thumb sprites. Trig is used to position both of those sprites so they appear to all be attached, yet they don't share an origin and they all can rotate independently.
Offline
archmage wrote:
dingdong wrote:
I guess so, I really want to try understand sin, cos, and tan so I can make better games
To be honest it won't really help you that much but I'll try to explain anyways.
Trigonometry is a branch of mathematics that deals with triangles and right angled triangles in particular.
Sin is short for sine, tan is short for tangent, and cos is short for cosine.
All these are ratios between the sides of a triangle.
http://id.mind.net/~zona/mmts/trigonome … /trig3.gif
Tan is the ratio of the side opposite an angle to the side adjacent to an angle.
tan(B)=6/4
Cos is the ratio of the side adjacent to an angle to the hypotenuse.
cos(B)=4/7.21
Sin is the ratio of the side opposite an angle to the hypotenuse.
sin(B)=6/7.21
Example question:
In a right angled triangle the side opposite angle b is 3 and if angle b is 37 degrees then what size is the side adjacent to angle b?
tan(37)=3/adjacent
tan(37)= 0.753
0.753=3/adjacent
3/0.753= adjacent
3.984=adjacent
Rounded up adjacent = 4
Therefore the side adjacent to angle b is 4.
That is the very basics of trig. I am not very good with explaining math stuff so I am sorry if you don't understand it.
Thanks! I won't be doing sin, cos and tan until 2 years time in school, so that's really useful. I love maths (and I find it really easy) but though I understand the basics of all that, it's quite hard because I've learnt most of that vocabulary in French (been here almost 2 years, now), not English, so although I'd know the french word for it, I don't actually know what the English word means!
Offline
dingdong wrote:
crud! that's exactly what I learned and I still don't get it! you're teaching me thg exact same thing! I guess I just don't understand it
Yeah. I know what you mean. Staring at triangles doesn't help much, sometimes. What are needed are some projects that are interactive and show you what sin and cos "feel" like. Once you get a foothold, it will get a lot easier.
I think there may be some projects that fit the bill; I'll take a look.
Offline
chalkmarrow wrote:
dingdong wrote:
crud! that's exactly what I learned and I still don't get it! you're teaching me thg exact same thing! I guess I just don't understand it
Yeah. I know what you mean. Staring at triangles doesn't help much, sometimes. What are needed are some projects that are interactive and show you what sin and cos "feel" like. Once you get a foothold, it will get a lot easier.
I think there may be some projects that fit the bill; I'll take a look.
I get it. Not how to use it, but what it is
Offline
jwiens wrote:
Cos, Sin and Tan areused to tell te distance in relation to one another <when green flag clicked><forever><if><(cos of Sprite 1<=>#)<move(10)steps>
I don't understand what you mean. Perhaps you could elaborate?
Offline
My "planet Staker" game uses the trig functions to allow blocks to rotate around a central point that is not their own centre of rotation.
They are used to calculate how far vertically and horizontally a given block must move in order to appear to be rotating around a given point, based on their distance from that point and the change in angle (how many degrees it turns).
Offline
Paddle2See wrote:
MyRedNeptune wrote:
I think I understand it, although I'm in 6th grade and don't have algebra yet... I just have no idea of how I can use those functions in a Scratch project. -_-
Let's say you have a sprite moving across the screen, and it's rotating as well. You want another sprite to move with it and appear to be attached to it. Maybe you are trying to make a mechanical arm of some sort, with an upper arm, forearm, and wrist sections, maybe like in my project Power Shovel 1.0 (hint hint). If all the sprites share the same origin, the problem is pretty simple, you just have all the parts Go To the main sprite.
But if the attached sprites are NOT at the same origin (maybe because they are rotating as well, then trig is very handy for calculating where they need to be and locating them there.
http://scratch.mit.edu/projects/Paddle2See/62394
Take a look at Power Shovel (link above) and look at the positioning logic for the Forearm and Thumb sprites. Trig is used to position both of those sprites so they appear to all be attached, yet they don't share an origin and they all can rotate independently.
Oh, thanks Paddle2See! ^^ I guess I understand it, a little. Well, at least I got a grip at it!
Offline
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
How old are u then? just wondering PS im 11<next costume>
Offline
Yeah, trig stuff is complicated. BTW, Archmage, I wanted to explain it!
Delving into more complicated stuff ( tell me if I messed it up, been a while since I used it.) I will now explain how to use it for finding sides on any triangle.
All you need are 2 sides and the angle in between them. This will get you the length of the other opposite side.
Okay, I am useing this triangle for refence.
The Law of sines is:
a c
------ =--------
sinA SinC
Okay, lets say side a=20, c=14 and C=40 degrees.
Okay now the formula is
20 14
-----=-------
SinA Sin40
Or 12.8557 (20*Sin40) = 14 SinA
Divide the 14
.9182=SinA
Now we do Sin-1(.9182)
Angle A equals 66.6
I have no clue on how to use this in scratch. Writing this out just made me feel samrt.
Offline