This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-12-30 21:05:36

jag97
Scratcher
Registered: 2010-02-05
Posts: 5

Sine, Cosine and Tangent

I have not Scratch 2.0, but it seems like it would be easy to impliment trigonometric functions into the operators tab. Sine, Cosine and Tangent may seem like unnecesary, obscure mathematical functions, but they have a key use that would open many new animation and game posibilities - they let you put one sprite in a location relative to another sprite. For example:

when gf clicked
forever
set x to <(sprite1 x v) + < <cos (sprite1 direction v)> * [10]> >
set y to <(sprite1 y v)  + < <sin (sprite1 direction v)> * [10]> >
end
A sprite with this script will always be 10 units in front of sprite1, and will maintain that position as sprite1 moves or rotates. Relative position would let you make joints, chains, and all sorts of other connections.

As of now, this can be done by having a sprite's center located at the position you want it to be relative to, and have it point in the same direction as the sprite it is centered on. But this only works for one link, nothing can be relative to the sprite with an off-center center. So add Sine and Cosine (and possibly tangent) to make more things possible!

Last edited by jag97 (2012-12-30 21:12:41)

Offline

 

#2 2012-12-30 21:10:23

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Sine, Cosine and Tangent

These already exist:

([sin v] of [10])
([cos v] of [10])
([tan v] of [10])

Last edited by Mokat (2012-12-30 21:12:13)


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#3 2012-12-30 21:19:48

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: Sine, Cosine and Tangent

^^That's right.

Look for the "sqrt of" block in Operators and change the option to any of the trig functions.


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#4 2012-12-30 21:28:26

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Sine, Cosine and Tangent

they also have the inverses of those
although they should also have the more obscure ones and their inverses (secant, cosecant, and cotangent)


........................................................................................................................................................................................................................................

Offline

 

#5 2012-12-30 21:42:52

BlackKyurem
Scratcher
Registered: 2012-12-22
Posts: 100+

Re: Sine, Cosine and Tangent

Those blocks already exist. Check the operators tab.


inspirational quote as of now: anything you can imagine is real | Main Account: ProgrammingPro01
http://img843.imageshack.us/img843/1205/blackkyuremsig.png

Offline

 

#6 2012-12-30 21:43:13

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Sine, Cosine and Tangent

zubblewu wrote:

they also have the inverses of those
although they should also have the more obscure ones and their inverses (secant, cosecant, and cotangent)

sec = 1/cos
csc = 1/sin
cot = 1/tan


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

Board footer