
Does anyone know how to do inverted trigonometry functions in Flash 5? I mean like the ones that say cos 1 etc. on calculator buttons?
I need this do work out some angles.

I just read some notes by Colin Moock about Trig functions.
See if this helps you.
http://www.moock.org/webdesign/lectures/ff2001sfMotion/

Welcome to flavour country
Yeah, I believe you can use the math objects Math.atan (arctangent), Math.acos (arccosine) and Math.asin (arcsin).

proud new daddy!
ignore me! I can't do math!
forget and forgive this post. I'm completely incompetent in Math!
[wrong]I don't think pyez is looking for arctrig functions, but for an inverse trig funtion  sin^1 and so on.
the only one available is Math.atan2, or tan^1. The arguments are y,x:
Math.atan2(y,x);[/wrong]
So for instance if you want to return the angle of the mouse location from the center of a movieclip:
Math.atan2(mc._ymouse, mc._xmouse);
[Edited by LuxFX on 03272001 at 04:28 PM]

Welcome to flavour country
It's been a lot of years since I did trig, and Flash 5 is making me use some previously forgotten grey matter, but I thought that f(x)=sin^1(x) was the same as f(x)=arcsin(x). Perhaps I have some misfiring neurons, but that's what I remember.
Am I wrong? And if so, how?

Senior Member
inverse trig
I can't decipher why Math.atan(y/x) is different from Math.atan2(y,x) but I've been using the latter because the results are right for some reason.
(cos^1) and (arccos) are used interchangably. The cunfusion with cos^1 is this: cos(x)^1 = 1/cos(x); whereas cos^1(x) is just faster than writing arccos. This is how we did it when I went to school, but that was a while ago.

proud new daddy!
Originally posted by thewiz1972
It's been a lot of years since I did trig, and Flash 5 is making me use some previously forgotten grey matter, but I thought that f(x)=sin^1(x) was the same as f(x)=arcsin(x). Perhaps I have some misfiring neurons, but that's what I remember.
Am I wrong? And if so, how?
sorry dude, I'm the one with the seriously misfiring neurons. In fact, they somehow convinced me I was competent in math again.
Rrr...I used to be GOOD at math!

Welcome to flavour country
hehe
Don't worry about it. I just wish I could remember everything I learned in math (and physics).

proud new daddy!
are you kidding? I'd settle for remembering anything at this point!

I did A level pure maths at school (and got a good grade too!)... but I'd settle for remembering what the school looked like right about now!
When did I get that old?....
A

Re: inverse trig
Originally posted by ironmallet
I can't decipher why Math.atan(y/x) is different from Math.atan2(y,x) but I've been using the latter because the results are right for some reason.
I didn't know this until too long ago also...the difference is that "atan2" will check the quadrant the terminal side of the angle is in and return an angle in standard position. However, "atan" only returns the reference angle with the xaxis. For example:
Code:
_ yaxis
\ 
\ 
\ 
\ 
_______\_________ xaxis
In a trigonometry class the above angle would be measured from the xaxis right of the yaxis, counterclockwise to the arrow. However, arctangent, by definition, only returns principal values, which is between pi/2 and pi/2. Therefore arctangent, used strictly, cannot return the angle of the above picture. However, it returns the reference angle which is the angle made up with the xaxis to the right of the yaxis measured clockwise to the arrow. You then just subtract that angle from pi.
Anyway, in conclusion...the "atan2" function would return the entire angle measured counterclockwise whereas "atan" would only return the reference angle measure clockwise.
Good luck.

atan2 ?!?!
I'm pretty good at math (and physics), and Ive had to make a couple of if statements the whole time to get the right quadrant.
I feel stupid now...why the HELL didnt I know that before?!
thanks guys, this will make some of my work a lot easier.
[Edited by PsychoFlasher on 03272001 at 05:51 PM]

Welcome to flavour country
I didn't know that either but it's pretty damn helpful now that I do. Thanks ahab.

flash mangler
dudes, I spent about two hours browsing maths sites for the quadrant approach, only to find a tiny reference to Math.atan2 about 30 minutes after I'd built the (horrific) 'if' nest.
Life sure can be funny.
But I still wanted to beat my mouse with my keyboard.
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
