The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

# Thread: formulae

1. ## formulae

wer we use.....x= r cos(angle) and y= r sin(angle) ( is this for poviding motion to object)

and why we use

angle=Math.atan(yspeed/(xspeed *-1))/math.Pi/180...

is this for cal angle ..wats the meaning of arc tangent....

2. wer we use.....x= r cos(angle) and y= r sin(angle) ( is this for poviding motion to object)

and why we use

angle=Math.atan(yspeed/(xspeed *-1))/math.Pi/180...

is this for cal angle ..wats the meaning of arc tangent....
Its: angle=Math.atan(yspeed/xspeed)*180/Math.PI

It is used to find the current angle the object is travelling in.

I you want to understand, as i always do, you can look at some triganometery websites that will explain sine, cosine and tangent, as well as their inverses, arcsine, arccosine, and arctangent and how to use them.

Try to relate the triangles used in the websites to your graphical display, the amount of x pixels is the length of the adjacent side and the amount of y pixels is the length of the opposite side - etc.
I find its always nice to know how somthing works rather than just going by formulae.
Last edited by dozza92; August 29th, 2008 at 03:08 PM. Reason: wrong use of terms

3. rrh
207
posts
Registered User
And the *180/Math.PI is for converting from radians to degrees.

Flash uses degrees for the rotation property, but uses radians for the trig functions, so you need to convert between the two, sometimes.

#### Thread Information

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
 About kirupa.com