Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taitbryan.axangle2euler obviously doesn't work (or I missed something obvious) #58

Open
petaflot opened this issue Jul 10, 2023 · 13 comments

Comments

@petaflot
Copy link

here is a bunch of values (points on a half-circle) for the vector (vec), theta rotation around that vector is always zero, norm is always 1

vec 1.0 0.0 0.0
ax = (-0.0, 0.0, -0.0)

vec 0.9510565162951535 0.3090169943749474 0.0
ax = (-0.0, 0.0, -0.0)

vec 0.8090169943749475 0.5877852522924731 0.0
ax = (-0.0, 0.0, -0.0)

vec 0.5877852522924731 0.8090169943749475 0.0
ax = (-0.0, 0.0, -0.0)

vec 0.30901699437494745 0.9510565162951535 0.0
ax = (-0.0, 0.0, -0.0)

vec 6.123233995736766e-17 1.0 0.0
ax = (-0.0, 0.0, -0.0)

I obviously expect something more useful to come out of axangle2euler( vec, 0 )

@matthew-brett
Copy link
Owner

matthew-brett commented Jul 10, 2023

Could you say more about what you're expecting? Here's me running what I think you're running:

transforms3d.taitbryan.axangle2euler([0.30901699437494745, 0.9510565162951535, 0.0], 0)

which gives (-0.0, 0.0, -0.0). That seems right to me - rotating zero radians around any axis will give zero rotations in Euler angles. Did I misunderstand your question?

@petaflot
Copy link
Author

the axii itself is rotated. does this make sense?

@matthew-brett
Copy link
Owner

What do you mean by "the axis itself is rotated"? That it should be rotated? In which case, no, the meaning there is that the rotation is of 0 degrees around the axis - so the axis is static.

@petaflot
Copy link
Author

consider a vector of length 1

this vector, rotated around alpha-beta-gamma Euler angles is a point in space (with orientation relative to the horizon). I am looking for a way to express with vector not in Euler angles, but Tait-Bryan angles. maybe this picture helps?

quaternion

@matthew-brett
Copy link
Owner

Sorry - I think I'm still not following you - you have a vector $\vec{p}$, and you want to express that vector as Euler angles (in Tait-Bryan convention), where the angles are the rotation from the unit vector in x (1, 0, 0) to $\vec{p}$?

@petaflot
Copy link
Author

I don't follow you either, so I'll try to rephrase.

In your lib, I was expecting to find a taitbryan2euler() function. Like... I don't even want to have to use an [x,y,z] vector.

@petaflot
Copy link
Author

as I understand, the sequence-order in which the rotations are applied changes massively. it seems Wikipedia refers to it as gun-order angles1 ; I chose to use this because it seems to me the most intuitive way to represent a quaternion for a human being walking on a "flat" surface (as per my drawing, echo and phi are equal to zero), and eventually throwing a stone at something (phi = 0).

Does this make more sense?

Footnotes

  1. https://en.wikipedia.org/wiki/Euler_angles#Others

@matthew-brett
Copy link
Owner

Just to check we agree - Euler angles are a generic term for triplets of rotation angles. Tait-Bryan angles are just Euler angles using a particular convention for the axes. You said you have a point, p, I've called that $\vec{p}$. You want the Tait-Bryan (=Euler in a particular convention) angles to get from - somewhere - to p. Where is somewhere? I was assuming it was just the unit axis in x.

@petaflot
Copy link
Author

somewhere is the origin, facing towards infinity on x axis (north as per my drawing), orientation parallel to the horizon

@matthew-brett
Copy link
Owner

Right - and given the length of the vector is irrelevant to the rotation, you do in fact want the angles to rotate the unit vector in x to the vector $\vec{p}$ as I had guessed. Does this help?

@petaflot
Copy link
Author

petaflot commented Jul 10, 2023

apparently you edited your first reply, which read

Did you misunderstand your question?

possibly :S

Does this help?

it just confirms that going by trial-and-error is exactly what I wanted to avoid

@matthew-brett
Copy link
Owner

The algorithm proposed was:

 rotx = Math.atan2( y, z );
 if (z >= 0) {
    roty = -Math.atan2( x * Math.cos(rotx), z );
 }else{
    roty = Math.atan2( x * Math.cos(rotx), -z );
 }

That's not a guess - but do you mean - you are not sure it's correct? I can check it more thoroughly if you like.

@petaflot
Copy link
Author

I can check it more thoroughly if you like.

please, don't do this yet. see moble/quaternion#218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants