TransWikia.com

Vectors do not define a plane when constructing a RotationMatrix

Mathematica Asked by Chris Guo on August 7, 2021

The following code:

RotationMatrix[{{0, 1, 0}, {0, -1, 0}}]

Gives an assertion message:

RotationMatrix::spln: Vectors {0,1,0} and {0,-1,0} do not define a plane.

Why can I define a RotationMatrix in this way?

Edit I found the reason in here: Calculate Rotation Matrix to align Vector A to Vector B, this is caused by the dot product of two vectors is -1,then the equation is divided by 0.

2 Answers

Edit

Another way is use perturbation.

u = {0, 1, 0};
v = {0, -1, 0};
m = Limit[RotationMatrix[{u, v + t*RandomInteger[20, 3]}], t -> 0]

{{0, 0, -1}, {0, -1, 0}, {-1, 0, 0}}

{{-(87/425), 0, -(416/425)}, {0, -1, 0}, {-(416/425), 0, 87/425}}

etc.

Original

We can find an orthogonal matrix satisfied $m^{T}bullet m=mathrm{Id},mathrm{Det}(m)=1$ which transform $(0,1,0)$ to $(0,-1,0)$

m = Array[a, {3, 3}];
sol = Solve[{Transpose[m] . m == IdentityMatrix[3], 
     Det[m] == 1, {0, 1, 0} . m == {0, -1, 0}}][[1]];
m /. sol
({0, 1, 0} . m /. sol) == {0, -1, 0}

{{a[1, 1], 0, -Sqrt[1 - a[1, 1]^2]}, {0, -1, 0}, {-Sqrt[1 - a[1, 1]^2], 0, -a[1, 1]}}

True

For example we can set a[1,1]->1/2

{{1/2, 0, -(Sqrt[3]/2)}, {0, -1, 0}, {-(Sqrt[3]/2), 0, -(1/2)}}

Correct answer by cvgmt on August 7, 2021

This situation is another reason why I wrote the vectorRotate[] function in this answer, which implements the method of Möller and Hughes:

vectorRotate[{0, 1, 0}, {0, -1, 0}]
   {{-1, 0, 0}, {0, -1, 0}, {0, 0, 1}}

Answered by J. M.'s torpor on August 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP