We've noticed the arctan block takes two parameters, is that a bug?

Also, we seem to be missing the arcsin and arcos primitives.

Thanks! :)

## arctan takes two parameters?

**Moderator:** MSandro

### Re: arctan takes two parameters?

The two-parameter form of arctan takes the length of the opposite and adjacent sides of a right triangle (i.e. dy and dx) and returns the angle. For example, "arctan 1 10" is about 5.7 degrees, "arctan 10 1" is about 84.3 degrees, and "arctan 10 0" is 90 degrees. (Note: when both parameters are zero -- i.e. all three points of the triangle are at the same position -- the angle could be anything. GP arbitrarily chooses to return zero degrees for this case.)

You can get the equivalent of the normal arctan function by putting the value you want the arctan of into the first argument slot and 1 into the second slot.

The two-parameter form of arctan has several advantages:

You can compute arcsin and arccos using arctan. Do you think arcsin and arccos are useful enough to include blocks for them? What are the applications you have in mind?

You can get the equivalent of the normal arctan function by putting the value you want the arctan of into the first argument slot and 1 into the second slot.

The two-parameter form of arctan has several advantages:

- it avoids the problem of dividing by zero when dx is zero
- it works around the entire circle, not just the first quadrant
- it has a nice geometric explanation: for any change of position, arctan computes the direction of motion from the change in y and change in x

You can compute arcsin and arccos using arctan. Do you think arcsin and arccos are useful enough to include blocks for them? What are the applications you have in mind?

### Re: arctan takes two parameters?

I see! I understand now.

My coworker is playing with some simple engine simulations and is using lots of trigonometry for those, that's why he felt he needed these primitives. I'll forward this info to him, thanks!

My coworker is playing with some simple engine simulations and is using lots of trigonometry for those, that's why he felt he needed these primitives. I'll forward this info to him, thanks!

### Re: arctan takes two parameters?

Why not add an optional parameter that determines the direction of rotation?JohnM wrote: The second problem is that GP's directions currently increase clockwise, whereas "arctan" assumes that angles increase counterclockwise. We've had discussions in the GP team about which way angles should increase. One argument is that most users would expect "increase rotation by 30" to turn the object clockwise, as they do in Logo. In contrast, trigonometry textbooks show angles as increasing counter-clockwise. So, we should either change GP's convention about direction or change arctan so that they are consistent with each other.