Can I switch XYZ to Quaternion?

i has a coordinate system where the y axis is UP. I need to convert it to a coordinate system, where Z is UP. I have rotations stored in quaternions, so my question is: if I have quaternion X, Y, Z, can I switch Y from Z and get the result, what is Z actually UP?

+5
source share
4 answers

Just drag two axes into quaternions? No, it does not work because it flips chirality. However, if you flip the chirality and deny the real part of the quaternion, you will return to the original chirality. In general terms, you can write this as

Q '(Q, i'j'k') = ε i'j'k ' Q w _w + Q i _i + Q j _j + Q k _k

Where

Levi-Cevita Symbol Definition

- , -.

, i², j², k² .

+7

, , , .

, , . Wikipedia , θ (x, y, z)

q = cos (θ/2) + sin (θ/2) (xi + yj + zk)

Y ↦ Z, .. Y - Z. ? , X ↦ X, .

  • Z ↦ Y. , .
  • Z ↦ -Y, 90 ° X. .

. ? , , , . ,

cos (-θ/2) + sin (-θ/2) (xi + zj + yk)

( cos (x) = cos (-x)), . , a + bi + cj + dk, , a − bi − dj − ck. −a + bi + dj + ck, ( θ 360 °, θ/2 180 °).

Z ↦ -Y θ, . Z - Y, Y - Z. a + bi + cj + dk a + bi − dj + ck ( ). , i −i, , . , θ = ± 45 °, , .

+3

, y z - , Right-Handed ( ).

, , :

newX = oldZ
newY = oldX
newZ = oldY

, x. y z, -90 + x ( , ).

+1
source

Try: Quaternion rotation = new quaternion (X, Z, Y, -W); // I had to change Z and Y because

+1
source

All Articles