In basic words I need a simple and fast algorithm to find the solution X from C * X = M where all variable are matrices. More explanations below.
I'm trying to compute one specific matrix but it doesn't really work as expected:
Vz - negative Z-axis vector (or any other)
Vg - current gravity vector
Vc - zero reference vector (for gravity calibration)
M0 - current rotation matrix
C0 - reference rotation matrix
X0 - unknown rotation matrix to find
*t - transposed versions of above matrices
Upong runtime only Vg, M and C are known.
Rules:
1) Vz == Vg * M0
2) Vg == Vz * Mt
3) Vz == Vc * C0
4) Vc == Vz * Ct
5) Vz == Vx * X0
6) Vx == Vz * Xt
7) Vx == Vg * C0
8) M0 == C0 * X0 (wrong!!! see update notes below)
...
?) X0 = ?
I tried to use formula like that:
X0 = M0 * Ct
But the resulting matrix does not satifsy the rules (5) and (6) as expected.
Any ideas what's wrong here?
UPDATE:
The formula I tried (X0 = M0 * Ct) is correct. The question was incorrect as (8) is actually M0 = X0 * C0.
The problem why I thought it doesn't work was because I tried to compute Vx = Vg * C0 - but actually neither Vx = Vg * C0 nor Vg = Vx * Ct are correct.
Thus I'm moving to the next task - that is better to describe as a n开发者_如何学JAVAew question :-)
If M0 = C0 * X0
(rule 8), then X0 = Ct * M0
(your formula X0 = M0 * Ct
is wrong).
If this X0
does not also satisfy the other rules, then your set of rules doesn't have a solution.
You need to know two things:
- For rotations, transposes are inverses
- Matrix multiplication does not commute.
We know:
M0 = C0 * X0 (8)
and these are rotations. So:
inverse (C0) = Ct
Pre-multiply (8) by Ct:
Ct * M0 = Ct * C0 * X0
= X0
And hence we have X0.
精彩评论