10.8 C
New York
Friday, March 14, 2025

rotation – Easy methods to convert a quaternion to a different coordinate system the place y and z are inverted?


I’ve quaternion representing a digital camera pose in a coordinate area known as “World Body 2”:

  • x+ = proper
  • y+ = up
  • z+ = out

…and I need to convert it to a different area known as “World Body 1”:

  • x+ = proper
  • y+ = down
  • z+ = in

(So, y and z are every inverted)

How can I do that conversion?

In one other thread, I reasoned it ought to work like so: (Name this “Method 1”)

When altering the digital camera coordinate system, we alter the transformation of a 3D level from the world body to the digital camera body.
The unique transformation from the world to the unique digital camera is:

$$P_{oc} = R cdot P w + T$$

The transformation from the unique digital camera to Habitat’s digital camera is:

$$P_{hc} = start{bmatrix} 1&0& 0
0& −1& 0
0 &0& −1 finish{bmatrix} P_{oc} = R_x ( pi) P_{o c} $$

By combining the above transformations, the interpretation $( t_x, t_y, t_z )$ will change to $( t_x, − t_y, − t_z )$, the rotation R will change to $R_x ( 180 ° ) R$, and in quaternion kind: $ i cdot ( w + x i + y j + z ok ) = − x + w i − z j + y ok $. Right here, i represents a 180-degree rotation across the x-axis.

One other consumer proposed this: (“Method 2”)

I agree that it is a 180-degree rotation across the x-axis. So the angle axis is:

$$
(textual content{angle, axis}) = (start{pmatrix}
1
0
0
finish{pmatrix}, pi)
$$

If we convert it to quaternion, it needs to be

$$
q = start{pmatrix}
cos(pi / 2)
sin(pi / 2)
cos(pi / 2)
cos(pi / 2)
finish{pmatrix}
= start{pmatrix}0 1 0 0end{pmatrix}
$$

So the end result might be $$q p q^{-1} = [0 1 0 0] [w x y z] [0 1 0 0]^{-1} = [w x -y -z]$$

I requested one other consumer and they linked to this thread (“Method 3”), which says the ensuing quaternion needs to be:

$$q = w + ix – jy – kw$$

Which one is appropriate, and why are the others flawed?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles