IanC
(IanC)
August 26, 2003, 12:47pm
1
I am working on a script to calculate angles, but all equations for working out angles that I know require you to use sin-1 tan-1 or cos-1, how can I do this is blender? I have tried all that I can (itan invtan etc) but none work

Can anyone help?

Thanks,
Ian

1 Like

theeth
(theeth)
August 26, 2003, 12:57pm
2
Use the asin, acos and atan function from the math module (it’s a standard Python module, not part of Blender).

```
import math
print math.asin(0.5)
```

or

```
from math import *
print asin(0.5)
```

Note that the trig functions in math return and use radians, not degrees.

Martin

IanC
(IanC)
August 26, 2003, 2:22pm
3
martin: Thanks for the fast reply, but
If sin a = b, then sin^-1 b = a
Using asin, I cannot get the right answer:

sin(2) = 0.909
asin(0.909) = 1.14

I dont think asin is the same as inverse sin.

Does anyone know the formula for the sin curve? I can use that instead of a pre-defined function such as asin.

Thanks

IanC
(IanC)
August 26, 2003, 2:25pm
4
Sorry, I have just tried it again and found that

a = sin(2)
b = asin(a)
b doesnt = 2

but

a = cos(2)
b = acos(a)
b DOES = 2

I think the problem was with the initial number I used.

I had found this earlier on the python site, but had only tried asin and so had thought it didnt work. Sorry!

IAn

alien-xmp
(alien-xmp)
August 26, 2003, 8:47pm
5
Because y = sin(x) is a repetitive function, there is more than one value of x for every value of y. ie sin(2) = sin(1.14) = 0.909

Therefore, when you do x = asin(y), you will only ever get a value between -PI/2 <= x <= PI/2