2
$\begingroup$

I try to use the result from the function FindGeometricTransform. It returns an error and a TransformationFunction.

The TransformationFunction is technically a $4\times 4$ matrix. But how can I use the result? It is not really a $4\times 4$ matrix like

(m = {{1., 0., 0., 1.}, {0., 1., 0., 2.}, {0., 0., 1., 0.}, {0., 0., 
     0., 1.}}) // MatrixForm

result = FindGeometricTransform[{{2, 2, 0}, {2, 4, 0}}, {{1, 2, 0}, {3, 
     2, 0}}];

I would like to multiply the TransformationFunction with m. How can I do that? Trying result[[2]].m does not work.

$\endgroup$

3 Answers 3

2
$\begingroup$

You have to use the TransformationMatrix instead of the TransformationFunction:

TransformationMatrix@result[[2]]

{{0., -1., 0., 4.}, {1., 0., 0., 1.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}}

TransformationMatrix@result[[2]].m

{{0., -1., 0., 2.}, {1., 0., 0., 2.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}}

$\endgroup$
1
$\begingroup$

You can extract the matrix from result using Part:

result[[2, 1]].m
{{0., -1., 0., 2.}, {1., 0., 0., 2.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}}
$\endgroup$
1
$\begingroup$

Karsten shows what you can do if you want the homogeneous matrix and not the TransformationFunction[] itself. If you want a TransformationFunction[] result, use Composition[]:

result = FindGeometricTransform[{{2, 2, 0}, {2, 4, 0}}, {{1, 2, 0}, {3, 2, 0}}];
m = {{1., 0., 0., 1.}, {0., 1., 0., 2.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}};

Composition[result[[2]], TransformationFunction[m]]
   TransformationFunction[{{0., -1., 0., 2.}, {1., 0., 0., 2.},
                           {0., 0., 1., 0.}, {0., 0., 0., 1.}}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.