How does vrrotvec calculate rotation?
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Michael McGeehan
il 17 Nov 2021
Modificato: James Tursa
il 12 Mag 2023
Can anybody describe the math behind vrrotvec? The documentation for this function is very sparse and I would like to know how the rotational transformation is being calculated for my own confiendence in my code.
Thanks!
0 Commenti
Risposta accettata
James Tursa
il 17 Nov 2021
It is a simple algorithm that uses the cross product for the axis (normalized), and the dot product is used to calculate the angle. I.e., vrrotvec(x,y) is equivalent to the following (but with error checking etc.)
rotation axis = cross(x,y)/norm(cross(x,y))
rotation angle = acos(dot(x,y)/(norm(x)*norm(y)))
then these are concatenated into a 4-element vector
3 Commenti
Vignesh Radhakrishnan
il 21 Apr 2023
Can I get the point y again from x using the inverse of the output of vrrotvec or vrrotvec2mat?
James Tursa
il 12 Mag 2023
Modificato: James Tursa
il 12 Mag 2023
Do you mean like this?
x = rand(3,1); x = x/norm(x)
y = rand(3,1); y = y/norm(y)
r = vrrotvec(x,y)
m = vrrotvec2mat(r)
m * x
norm(ans-y)
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!