389place

0
votes Vote

I'm trying to use atan on the slope of a line to calculate the angle to rotate an object, however atan doesn't seem to give the correct results. I have no problems with sin and cos. I can give a test watchface that demonstrates the problem if you like.

Richard , 25.11.2015, 15:21

Idea status:
**
under consideration **

After doing more research, I understand what was going wrong.

I can't do something like

math.atan(math.tan(45)) = 45; it will equal 1.0177

I need to do this

math.deg(math.atan(math.tan(math.rad(45)))) = 45

You can remove this bug report as I'm not sure how to get rid of it.

I can't do something like

math.atan(math.tan(45)) = 45; it will equal 1.0177

I need to do this

math.deg(math.atan(math.tan(math.rad(45)))) = 45

You can remove this bug report as I'm not sure how to get rid of it.

Looks like there is a problem with atan (y, x) it gives a different result from atan(y/x)

With the second form (y/x) you need to compensate for when x is negative but at least it works.

With the second form (y/x) you need to compensate for when x is negative but at least it works.