3
$\begingroup$

I have vectors E1 = {22.607, 3.495, -30.795}; and R1 = { 4.74061, 21.7549, 30.6501};. This vectors are conneted by a 3D rotation such that R1 = Rot. E1 Rot is the roation matrix (there can be some error due to measurment). How to find the optimal rotation matrix so that it can be applied to another set of vectors which goes through same transformation. PS. the other set is let's say E2 = {-13.236, 25.903, 13.937}; and R2 = {-17.5342, -26.6773, -0.10567};. Now we know only R2

$\endgroup$
  • 1
    $\begingroup$ @MichaelE2 you mean FindGeometricTransform. $\endgroup$ – rhermans Jun 25 '18 at 12:44
  • 2
    $\begingroup$ Note that with just E1 and R1, the answer is ambiguous. Given a rotation that takes E1 to R1, you may follow it with any rotation about the R1 axis and still have a correct result. Which result will take E2 to R2 is unpredictable without an additional constraint. $\endgroup$ – John Doty Jun 25 '18 at 12:45
  • $\begingroup$ @John Exactly this is the point I was wondering. Could you please something more about the constrains? $\endgroup$ – Xavier Jun 25 '18 at 12:52
  • $\begingroup$ @rhermans So much for going from memory. Thx. $\endgroup$ – Michael E2 Jun 25 '18 at 12:57
  • $\begingroup$ @Xavier Please edit your question to explain what do you mean by "Optimal" and explain in detail what you really need. Please don't make us guess. $\endgroup$ – rhermans Jun 25 '18 at 13:17
7
$\begingroup$

RotationMatrix

rotm = With[
   {
    e1 = {22.607, 3.495, -30.795},
    r1 = {4.74061, 21.7549, 30.6501}
    }
   , (Norm[r1]/Norm[e1]) RotationMatrix[{e1, r1}]
   ];

MatrixForm[rotm]

Mathematica graphics

rotm.{22.607, 3.495, -30.795}
(* {4.74061, 21.7549, 30.6501} *)

TransformationFunction

transfunc = With[
  {
   e1 = {22.607, 3.495, -30.795},
   r1 = {4.74061, 21.7549, 30.6501}
   },
  Last@FindGeometricTransform[{r1}, {e1}]
  ]

transfunc[{22.607, 3.495, -30.795}]
(* {4.74061, 21.7549, 30.6501} *)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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