Shop OBEX P1 Docs P2 Docs Learn Events
Use of arcsin in Trig.java (JavelinCode) — Parallax Forums

Use of arcsin in Trig.java (JavelinCode)

AjenjoAjenjo Posts: 5
edited 2007-07-02 14:31 in General Discussion
Greetings.

I've use the function arcsin in my code, but I don´t know how use it.

That is. I obtaint the correct result of the function usqrt in UnsignedIntMath.java (JavelinCode) dividing the return number by 256.

How I obtain the correct result of the funtion arcsin in Trig.java (JavelinCode)???? What steps I must follow????

Waiting for your help. Thanks so much.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-07-02 14:31
    The javadoc of arcsin says:

    · /**
    ·· * Calculate arcsin(x)
    ·· * Returns angle in 1st or 4th quadrant
    ·· *
    ·· * @param x Sine value in 0.0001 units (-10000 to +10000)
    ·· * @return Angle in 0.1 degree units (-900 to +900)
    ·· */

    Example,·sin(45.0 degrees)· = sin(450) = 10000*(0.7071) = 7071
    arcsin(7071) = 450
    Angles are specified in 0.1 degree units, so range is 0-3599, which represents 0.0-359.9 degrees
    Sine values are specified in 0.0001 units, so range is 0-10000, which represent values 0.0000-1.0000
    The javelin has no floating point, so integers are used to represent values as fixed point floating point.

    regards peter

    Post Edited (Peter Verkaik) : 7/2/2007 2:42:23 PM GMT
Sign In or Register to comment.