### Calculating angles

Hey people

This is my first post on this forum. I am quite new to max/msp, but I’m getting the hang of it.

I have been searching the documentation, and also been searching this forum, but I cannot seem to find what I have been looking for. Therefore I have decided to ask you guys.

I am wondering if there exists an object in max/msp that makes it possible to take the reversed cosine (also sin and tan). When looking in the documentation it says nothing about it.

But I need my program to calculate the angles in a triangle so if you guys could help in any ways, it would be most appreciated.

Just to explain:

I am able to do the following:

sin(A) = x / dist

cos(A) = y / dist

tan(A) = y / x

But I want to do this:

A = reversed-sin(x / dist)

A = reversed-cos(y / dist)

A = reversed-tan(y / x)

I hope that you understand, and that you can help me.

Best regards

Johnny

look for [asin] etc.

vb

I have spottet that one, but it seems to be giving the result in radians (or something). I need degrees.

JohnnyMyhre wrote on Sun, 19 April 2009 10:15 |

I have spottet that one, but it seems to be giving the result in radians (or something). I need degrees. |

generally all those trigonometric functions calculate in radians.

but it really doesn’t matter much, as the conversion to degrees is simple.

#P window setfont "Sans Serif" 9.;

#P window linecount 1;

#P comment 156 227 100 196617 radians;

#P comment 156 171 100 196617 radians;

#P comment 156 300 100 196617 degree;

#P comment 156 115 100 196617 radians;

#P flonum 90 298 54 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;

#P newex 90 262 141 196617 expr $f1*180./3.14159265;

#P flonum 90 50 54 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;

#P newex 90 77 141 196617 expr $f1*3.14159265/180.;

#P flonum 90 225 54 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;

#P newex 90 197 26 196617 asin;

#P flonum 90 115 54 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;

#P flonum 90 168 54 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;

#P newex 90 140 21 196617 sin;

#P comment 156 51 100 196617 degree;

#P connect 3 0 1 0;

#P connect 6 0 3 0;

#P connect 8 0 9 0;

#P connect 5 0 8 0;

#P connect 7 0 6 0;

#P connect 2 0 4 0;

#P connect 4 0 5 0;

#P connect 1 0 2 0;

#P window clipboard copycount 14;

I did not know the expr object. It seems to do the trick.

Thanks a lot.