Timeline for Set rotation on single axis with provided angle using Quaternion
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 18, 2017 at 10:35 | comment | added | DMGregory♦ | (Note in that second example, q_pitch' would be the difference in pitch to apply — ran out of characters) | |
Sep 18, 2017 at 10:16 | comment | added | DMGregory♦ |
If we know our rotation was formed from 3 component rotations, a yaw, pitch, and roll, composed like this: q_old = q_yaw * q_pitch * q_roll and we want to change pitch to a new angle value pitch' , we could either recompose the quaternion from the new components q_new = q_yaw * q_pitch' * q_roll or "undo" the yaw first: q_new = q_yaw * q_pitch' * inverse(q_yaw) * q_old . Either way, we need more than just the new pitch component, since there's nothing about a rotation that's uniquely identifiable as pitch (see the link above for examples where 2-axis rotations can duplicate a third)
|
|
Sep 18, 2017 at 10:08 | comment | added | O-BL | Could you provide a mathematical equations please? | |
Sep 18, 2017 at 10:04 | comment | added | DMGregory♦ | It sounds like you expect to be able to change just the "x part" of a rotation, independent of what's happened on the other axes, the way you might do by setting just one component of a translation vector while leaving the others untouched. Rotations don't work this way - their result is always dependent on the order in which the rotations are applied. So to pull out the "X part" of a quaternion, we need to know what other rotations were applied after X, or recompose the quaternion from the updated contributing rotations. | |
Sep 18, 2017 at 9:56 | comment | added | O-BL | What about this case, where you have whatever rotation represented by quaternion and you want to set the rotation on a single axis? | |
Sep 18, 2017 at 9:54 | comment | added | O-BL | void RotationAroundX(Quaternion q, float Angle) {//implementation... } | |
Sep 18, 2017 at 9:52 | comment | added | O-BL | Thanks DMGregory, when I am rotating around a single axis I have a pre-rotated object, so I cannot do it that simple. | |
Jul 3, 2017 at 1:38 | history | answered | DMGregory♦ | CC BY-SA 3.0 |