>> Yes, or in other words, quadrants, right?

There's quadrants issues.

because for all the Euler angles,

the first and the third are always defined for all four quadrants.

So if it only gives you inverse cosine,

the cosine only gives you something in the first two quadrants.

And inverse sine kind of gives you something in the first and the fourth

quadrant, if you look at the sine curve and what it typically gives you.

So you only get part of the answer, but then there's issues and

in fact, gives you wrong latitudes, if you don't use the quadrants correctly.

So very good, that's exactly what's going on.

That's why we always use the arctangent function here, which I'm

just writing as the inverse tangent, but that's the arctangent function.

And I'm writing it as a ratio.

In your code, which function do you use?

What's that function called?

>> 8 times 2?

>> Yeah, 8 times 2, right?

That's the one, it takes a numerator and denominator.

Now, again, to make your life exciting, MATLab does it one way.

Denominator and numerator or numerator, denominator,

I never remember, we have to look it up.

because I also use a lot of Mathematica, and it's just flipped.

And C code is one of the two, because it's only 50, 50, right?

And Fortra has to be one of those two.

So always check if you use a 10, 2, what comes first, what comes second, all right?

But you want to give two arguments, and

now you get something that will give you the proper quadrants, that's critical.

Whereas the second angle, in this case,

pitch is actually defined between plus minus 90.

And the inverse sign gives you the plus minus 90 range.

So this is perfect, that's exactly what we need, and we're happy.

And this is for a asymmetric set, the angle is defined between plus minus 90.

So again, if you note a asymmetric number,

the second angle has to appear somewhere with the sine.

This is asymmetric, and the second angle is with the cosine,

you did something wrong.

Something flipped somewhere, all right.

Those are the patterns you're looking for, so good, let me see.

Now, yep, here's another one.

If you do the same math for 3, 1, 3, plug them in, multiply it out,

this is the relationship.

Now, again, second angle by itself, but it is for

a symmetric set which gives me an inverse cosine.

And cosine gives you a number between 0 and 180, which is perfect for

inclinations.

That's exactly what we're looking for.

So the second one is easy, inverse cosine here of the 3, 3 element.

The first and third, again, have four quadrants.

So we have to pick the right stuff.

But you can see one of them has a negative sign.

So if I need this ratio, 3, 1, 3, 2, so 3, 1 over 3, 2,

the sine theta 2, sine theta 2s cancel.

I'm going to have to assign theta 1.

And to be a tangent, I need cosine theta 1, but I have minus cosine theta 1.

That's why there's a minus sign here to make that minus minus.

I need a cosine theta1 on the bottom, all right?