Skip to main content
Illustration and response.
Source Link
Nolnoch
  • 103
  • 1
  • 8

[EDIT] The first sentence is true, but to adjust your original quaternion to match the new basis, it would be an additional rotation about [1, 0, 0], not [-1, 0, 0]. Also:

The[EDIT 1]
The thing is, quaternions have no inherent handedness or attachment to a particular basis. They are simply a quantity of motion about directional components defined in reference to the origin. Additionally, they store no explicit information about previous rotations.

Under what context are you implementing this quaternion in your other application? If it's the same hierarchical structure, try transforming your ModelView by this correctional quaternion before you start the recursive rendering, then transform back when you're done (or use a matrix stack).

[EDIT 2]
What is QNX? You define an axis with no associated movement. If you are trying to use a zero or "empty" quaternion, it's [w, x, y, z] = [1, 0, 0, 0].

Quaternion multiplication, unless modified in a library's implementation, is from right (base rotation) to left (new rotation). I checked on Eigen, and it doesn't mention switching things around in the docs.

Also, every rotation transforms the global axes along with the object, so as I mentioned above, this correctional quaternion (QX90) should be added to the global, absolute rotation before the hierarchical model is ever rendered. See below.

Identity Matrix (clean slate)             Rotations in effect: [ ]
  Rotation 1                                                   [1]
    Draw some object                                           [1]

Identity Matrix                                                [ ]
  Rotation Q (QX90)                                            [Q]
    Rotation A (hip)                                           [A*Q]
      Draw hip                                                 [A*Q]
      Rotation B (spine)                                       [B*A*Q]
        Draw spine                                             [B*A*Q]
        Rotation C (shoulder)                                  [C*B*A*Q]
          Draw shoulder                                        [C*B*A*Q]

I've only rendered hierarchical models recursively as opposed to the iterative structure of the MSDN guide you posted. Still, this is the idea behind the state of the global transformation matrix with respect to its rotational components.

[EDIT] The first sentence is true, but to adjust your original quaternion to match the new basis, it would be an additional rotation about [1, 0, 0], not [-1, 0, 0]. Also:

The thing is, quaternions have no inherent handedness or attachment to a particular basis. They are simply a quantity of motion about directional components defined in reference to the origin. Additionally, they store no explicit information about previous rotations.

Under what context are you implementing this quaternion in your other application? If it's the same hierarchical structure, try transforming your ModelView by this correctional quaternion before you start the recursive rendering, then transform back when you're done (or use a matrix stack).

[EDIT 1]
The thing is, quaternions have no inherent handedness or attachment to a particular basis. They are simply a quantity of motion about directional components defined in reference to the origin. Additionally, they store no explicit information about previous rotations.

Under what context are you implementing this quaternion in your other application? If it's the same hierarchical structure, try transforming your ModelView by this correctional quaternion before you start the recursive rendering, then transform back when you're done (or use a matrix stack).

[EDIT 2]
What is QNX? You define an axis with no associated movement. If you are trying to use a zero or "empty" quaternion, it's [w, x, y, z] = [1, 0, 0, 0].

Quaternion multiplication, unless modified in a library's implementation, is from right (base rotation) to left (new rotation). I checked on Eigen, and it doesn't mention switching things around in the docs.

Also, every rotation transforms the global axes along with the object, so as I mentioned above, this correctional quaternion (QX90) should be added to the global, absolute rotation before the hierarchical model is ever rendered. See below.

Identity Matrix (clean slate)             Rotations in effect: [ ]
  Rotation 1                                                   [1]
    Draw some object                                           [1]

Identity Matrix                                                [ ]
  Rotation Q (QX90)                                            [Q]
    Rotation A (hip)                                           [A*Q]
      Draw hip                                                 [A*Q]
      Rotation B (spine)                                       [B*A*Q]
        Draw spine                                             [B*A*Q]
        Rotation C (shoulder)                                  [C*B*A*Q]
          Draw shoulder                                        [C*B*A*Q]

I've only rendered hierarchical models recursively as opposed to the iterative structure of the MSDN guide you posted. Still, this is the idea behind the state of the global transformation matrix with respect to its rotational components.

Other ideas.
Source Link
Nolnoch
  • 103
  • 1
  • 8

Can you show what rotations you've tried? It sounds like your secondary basis is the original basis after a 90 degree rotation about the negative X axis.

You can represent this with a quaternion [w, x, y, z] = [cos(PI / 4), sin(PI / 4), 0, 0] based on an angle-axis vector [(PI / 2), 1, 0, 0]. You can also convert your original quaternion to matrix form and concatenate an affine rotational matrix. I forget the order of the sin/cos terms at the moment.

Also be careful in what order you are multiplying your vectors and matrices. (v' = Rv) != (v' = vR).

[EDIT] The first sentence is true, but to adjust your original quaternion to match the new basis, it would be an additional rotation about [1, 0, 0], not [-1, 0, 0]. Also:

The thing is, quaternions have no inherent handedness or attachment to a particular basis. They are simply a quantity of motion about directional components defined in reference to the origin. Additionally, they store no explicit information about previous rotations.

So a final quaternion that is the representation of rotating 35 degrees about the Z axis in one context will still be rotating 35 degree about the Z axis in the other. Since your second basis is a rotation about X away from your original basis, this should work.

Other things to consider:

You mention a shoulder -- is this a hierarchical structure? If so, is this particular quaternion the true final/global quaternion for that limb, or is it in reference to another local context (and being concatenated)?

Under what context are you implementing this quaternion in your other application? If it's the same hierarchical structure, try transforming your ModelView by this correctional quaternion before you start the recursive rendering, then transform back when you're done (or use a matrix stack).

Can you show what rotations you've tried? It sounds like your secondary basis is the original basis after a 90 degree rotation about the negative X axis.

You can represent this with a quaternion [w, x, y, z] = [cos(PI / 4), sin(PI / 4), 0, 0] based on an angle-axis vector [(PI / 2), 1, 0, 0]. You can also convert your original quaternion to matrix form and concatenate an affine rotational matrix. I forget the order of the sin/cos terms at the moment.

Also be careful in what order you are multiplying your vectors and matrices. (v' = Rv) != (v' = vR).

[EDIT] The first sentence is true, but to adjust your original quaternion to match the new basis, it would be an additional rotation about [1, 0, 0], not [-1, 0, 0].

Can you show what rotations you've tried? It sounds like your secondary basis is the original basis after a 90 degree rotation about the negative X axis.

You can represent this with a quaternion [w, x, y, z] = [cos(PI / 4), sin(PI / 4), 0, 0] based on an angle-axis vector [(PI / 2), 1, 0, 0]. You can also convert your original quaternion to matrix form and concatenate an affine rotational matrix. I forget the order of the sin/cos terms at the moment.

Also be careful in what order you are multiplying your vectors and matrices. (v' = Rv) != (v' = vR).

[EDIT] The first sentence is true, but to adjust your original quaternion to match the new basis, it would be an additional rotation about [1, 0, 0], not [-1, 0, 0]. Also:

The thing is, quaternions have no inherent handedness or attachment to a particular basis. They are simply a quantity of motion about directional components defined in reference to the origin. Additionally, they store no explicit information about previous rotations.

So a final quaternion that is the representation of rotating 35 degrees about the Z axis in one context will still be rotating 35 degree about the Z axis in the other. Since your second basis is a rotation about X away from your original basis, this should work.

Other things to consider:

You mention a shoulder -- is this a hierarchical structure? If so, is this particular quaternion the true final/global quaternion for that limb, or is it in reference to another local context (and being concatenated)?

Under what context are you implementing this quaternion in your other application? If it's the same hierarchical structure, try transforming your ModelView by this correctional quaternion before you start the recursive rendering, then transform back when you're done (or use a matrix stack).

logic
Source Link
Nolnoch
  • 103
  • 1
  • 8

Can you show what rotations you've tried? It sounds like your secondary basis is the original basis after a 90 degree rotation about the negative X axis.

You can represent this with a quaternion [w, x, y, z] = [cos(PI / 4), -sinsin(PI / 4), 0, 0] based on an angle-axis vector [(PI / 2), -11, 0, 0]. You can also convert your original quaternion to matrix form and concatenate an affine rotational matrix. I forget the order of the sin/cos terms at the moment.

Also be careful in what order you are multiplying your vectors and matrices. (v' = Rv) != (v' = vR).

[EDIT] The first sentence is true, but to adjust your original quaternion to match the new basis, it would be an additional rotation about [1, 0, 0], not [-1, 0, 0].

Can you show what rotations you've tried? It sounds like your secondary basis is the original basis after a 90 degree rotation about the negative X axis.

You can represent this with a quaternion [w, x, y, z] = [cos(PI / 4), -sin(PI / 4), 0, 0] based on an angle-axis vector [(PI / 2), -1, 0, 0]. You can also convert your original quaternion to matrix form and concatenate an affine rotational matrix. I forget the order of the sin/cos terms at the moment.

Also be careful in what order you are multiplying your vectors and matrices. (v' = Rv) != (v' = vR).

Can you show what rotations you've tried? It sounds like your secondary basis is the original basis after a 90 degree rotation about the negative X axis.

You can represent this with a quaternion [w, x, y, z] = [cos(PI / 4), sin(PI / 4), 0, 0] based on an angle-axis vector [(PI / 2), 1, 0, 0]. You can also convert your original quaternion to matrix form and concatenate an affine rotational matrix. I forget the order of the sin/cos terms at the moment.

Also be careful in what order you are multiplying your vectors and matrices. (v' = Rv) != (v' = vR).

[EDIT] The first sentence is true, but to adjust your original quaternion to match the new basis, it would be an additional rotation about [1, 0, 0], not [-1, 0, 0].

Source Link
Nolnoch
  • 103
  • 1
  • 8
Loading