# atan2() Function

New releases and general discussions.

### » Tue Jul 07, 2009 4:11 am

A function I didn't realize was missing until I found out how amazingly awesome it is is atan2(). Any chance it could be added for the next build?
Moderator
B
114
S
41
G
20
Posts: 1,586
Reputation: 19,161

### » Tue Jul 07, 2009 6:24 am

I wrote atan2 as a formula in an event, only to later realize there is an angle compare expression that does the same job I wanted done.
AngleDiff(a, b)

Is that what you're trying to do? measure of the arc between two angles?
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

### » Tue Jul 07, 2009 8:14 am

The angle() expression which measures the angle between two points uses atan2. I'm not aware of any other uses for atan2.

If you pass 0 as one of the two positions the result is exactly equal to atan2, ie. angle(0, 0, x,y) is equal to atan2(y, x).
Scirra Founder
B
413
S
244
G
92
Posts: 25,093
Reputation: 199,794

### » Tue Jul 07, 2009 3:12 pm

I didn't even think of doing that with the angle() expression. I'm using the function to get the angular speed of an object based on it's separate X and Y speeds.
Moderator
B
114
S
41
G
20
Posts: 1,586
Reputation: 19,161