Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Syntax >> Sin and Inverse Sin
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1212346605

Message started by Titus on 06/01/08 at 18:56:45

Title: Sin and Inverse Sin
Post by Titus on 06/01/08 at 18:56:45
Dear Barragan,

We, Kars and I, wondered how to do the Inverse sinus/cosinus/tangens in wiring.
A sinus does
sin(angle);   => value from -1 to 1

But how do you get the angle from that value between -1 and 1

like:
value is between -1 and 1
sinInv(value);=> angle.

Thanks for the fast reply!

Titus

Title: Re: Sin and Inverse Sin
Post by N201LJ on 06/02/08 at 22:56:15
Lookup table?

It's not in the AVR math.h library?

Title: Re: Sin and Inverse Sin
Post by barragan on 06/02/08 at 23:53:51
hi, here is the documentation of what´s included in avr math.h http://www.nongnu.org/avr-libc/user-manual/group__avr__math.html
By default the library is included in the Wiring sketch.

Title: Re: Sin and Inverse Sin
Post by Titus on 06/03/08 at 16:40:15
The awnser I was looking for is:

int x=round(  degrees  (  atan  (  1  )  )  );

Barragan,
perhaps in the reference, the
atan();
asin();
acos();

Could be added?

The convert a number from -1 to 1, to the according value in radian
Because I needed it to be in degrees, and to be an int, I added the degrees() and the round() command.

Found this out, perhaps more people need it.

Titus

Title: Re: Sin and Inverse Sin
Post by barragan on 06/04/08 at 16:04:07
definitely, I added it to the list.

Title: Re: Sin and Inverse Sin
Post by Titus on 04/18/09 at 12:14:15
I needed it again today, but I didn't remember how to do it.
It wasn't added to the reference yet?
Luckely I found this topic again

Titus
P.S. change for 0019?

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.