Skip to content

Fix matrix multiplication order in point-based gluing#1652

Open
ahoenselaar wants to merge 1 commit into
cnr-isti-vclab:mainfrom
ahoenselaar:align-matmul-fix
Open

Fix matrix multiplication order in point-based gluing#1652
ahoenselaar wants to merge 1 commit into
cnr-isti-vclab:mainfrom
ahoenselaar:align-matmul-fix

Conversation

@ahoenselaar

Copy link
Copy Markdown

Closes #1651

Let:

  • $\mathbf{p}_{\text{local}}$ be a point in the local coordinate space of the free mesh.
  • $T_{\text{old}}$ be the current transformation matrix of the free mesh (currentNode()->tr()).
  • $\mathbf{p}_{\text{global}} = T_{\text{old}} \cdot \mathbf{p}_{\text{local}}$ be the point's current global position.
  • $R$ be the alignment/registration transformation matrix (res) computed by ComputeRigidMatchMatrix or ComputeSimilarityMatchMatrix.

The registration algorithm finds a transformation $R$ that registers the picked points $\mathbf{p}_{\text{free, global}}$ to the glued points $\mathbf{p}_{\text{glued, global}}$, both of which are in global coordinates. Therefore, the registered global position is:
$\mathbf{p}_{\text{global, new}} = R \cdot \mathbf{p}_{\text{global, old}}$

Substituting the definition of $\mathbf{p}_{\text{global}}$:
$\mathbf{p}_{\text{global, new}} = R \cdot (T_{\text{old}} \cdot \mathbf{p}_{\text{local}}) = (R \cdot T_{\text{old}}) \cdot \mathbf{p}_{\text{local}}$

Then the new transformation matrix of the mesh must be:
$$T_{\text{new}} = R \cdot T_{\text{old}}$$
which is pre-multiplication (res * currentNode()->tr()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect order of matrix multiplication in point-based gluing

1 participant