Question: I am getting a quaternion from sensor data that is in the coordinate system Y=up, X=right, and Z= backwards.Mine is X=forward, Y=right, Z=up.

So OX=Y, OY=Z and OZ=-X.

I have a function that can convert quaternions into 4by4 matrices, but no idea where to go from here. Any help would be greatly appreciated.

Answer: 
Quaternions in the form of [X, Y, Z, W] are equivalent to axis-angle rotations where W is dependent only on the angle of rotation (but not the axis) and X, Y, Z are the axis of rotation multiplied by sin(Angle/2). Since X, Y, Z have this property, you can just swap and negate them as you would to convert a 3D coordinate between. To convert from your sensor's coordinate system to yours, you can simply do this:

```

MyQuat.X = -SensorQuat.Z
MyQuat.Y = SensorQuat.X
MyQuat.Z = SensorQuat.Y
MyQuat.W = SensorQuat.W

```
You just Need to Multiply it by q, which is the quaternion that converts points from Coord2 to the Coord1 equivalent.
Explanation:

```
q2 * point2 * (q2)^(-1) = (q1 * (q^(-1))) * point2 * (q1 * (q^(-1)))^(-1) 
= q1 * (q^(-1)) * point2 * q * (q1^(-1)) = q1 * ((q^(-1)) * point2 * q) * (q1^(-1))
= q1 * point1_equivalent * (q1^(-1))

```