SlideShare a Scribd company logo
Computing Euler angles from a rotation matrix
Gregory G. Slabaugh
Abstract
This document discusses a simple technique to find all possible Euler angles from
a rotation matrix. Determination of Euler angles is sometimes a necessary step
in computer graphics, vision, robotics, and kinematics. However, the solution
may or may not be obvious.
Rotation matrices
We start off with the standard definition of the rotations about the three prin-
ciple axes.
A rotation of ψ radians about the x-axis is defined as
Rx(ψ) =


1 0 0
0 cos ψ − sin ψ
0 sin ψ cos ψ


Similarly, a rotation of θ radians about the y-axis is defined as
Ry(θ) =


cos θ 0 sin θ
0 1 0
− sin θ 0 cos θ


Finally, a rotation of φ radians about the z-axis is defined as
Rz(φ) =


cos φ − sin φ 0
sin φ cos φ 0
0 0 1


The angles ψ, θ, and φ are the Euler angles.
Generalized rotation matrices
A general rotation matrix can will have the form,
R =


R11 R12 R13
R21 R22 R23
R31 R32 R33


1
This matrix can be thought of a sequence of three rotations, one about each
principle axis. Since matrix multiplication does not commute, the order of the
axes which one rotates about will affect the result. For this analysis, we will
rotate first about the x-axis, then the y-axis, and finally the z-axis. Such a
sequence of rotations can be represented as the matrix product,
R = Rz(φ)Ry(θ)Rx(ψ)
=


cos θ cos φ sin ψ sin θ cos φ − cos ψ sin φ cos ψ sin θ cos φ + sin ψ sin φ
cos θ sin φ sin ψ sin θ sin φ + cos ψ cos φ cos ψ sin θ sin φ − sin ψ cos φ
− sin θ sin ψ cos θ cos ψ cos θ


Given a rotation matrix R, we can compute the Euler angles, ψ, θ, and φ
by equating each element in R with the corresponding element in the matrix
product Rz(φ)Ry(θ)Rx(ψ). This results in nine equations that can be used to
find the Euler angles.
Finding two possible angles for θ
Starting with R31, we find
R31 = − sin θ.
This equation can be inverted to yield
θ = − sin−1
(R31). (1)
However, one must be careful in interpreting this equation. Since sin(π − θ) =
sin(θ), there are actually two distinct values (for R31 = ±1) of θ that satisfy
Equation 1. Therefore, both the values
θ1 = − sin−1
(R31)
θ2 = π − θ1 = π + sin−1
(R31)
are valid solutions. We will handle the special case of R31 = ±1 later in this
report. So using the R31 element of the rotation matrix, we are able to determine
two possible values for θ.
Finding the corresponding angles of ψ
To find the values for ψ, we observe that
R32
R33
= tan(ψ).
We use this equation to solve for ψ, as
ψ = atan2(R32, R33), (2)
2
where atan2(y, x) is arc tangent of the two variables x and y. It is similar to
calculating the arc tangent of y/x, except that the signs of both arguments are
used to determine the quadrant of the result, which lies in the range [−π, π].
The function atan2 is available in many programming languages.
One must be careful in interpreting Equation 2. If cos(θ) > 0, then ψ =
atan2(R32, R33). However, when cos(θ) < 0, ψ = atan2(−R32, −R33). A simple
way to handle this is to use the equation
ψ = atan2
R32
cos θ
,
R33
cos θ
(3)
to compute ψ.
Equation 3 is valid for all cases except when cos θ = 0. We will deal with this
special case later in this report. For each value of θ, we compute a corresponding
value of ψ using Equation 3, yielding
ψ1 = atan2
R32
cos θ1
,
R33
cos θ1
(4)
ψ2 = atan2
R32
cos θ2
,
R33
cos θ2
(5)
Finding the corresponding angles of φ
A similar analysis holds for finding φ. We observe that
R21
R11
= tan φ.
We solve for φ using the equation
φ = atan2
R21
cos θ
,
R11
cos θ
(6)
Again, this equation is valid for all cases except when cos θ = 0. We will
deal with this special case later in this report. For each value of θ, we compute
a corresponding value of φ using Equation 6,
φ1 = atan2
R21
cos θ1
,
R11
cos θ1
(7)
φ2 = atan2
R21
cos θ2
,
R11
cos θ2
(8)
Two solutions if cos θ = 0
For the case of cos θ = 0, we now have two triplets of Euler angles that reproduce
the rotation matrix, namely
(ψ1, θ1, φ1)
(ψ2, θ2, φ2)
Both of these solutions will be valid.
3
What if cos θ = 0?
This technique described above does not work if the R31 element of the rotation
matrix is 1 or −1, which corresponds to θ = −π/2 or θ = π/2, respectively, and
to cos θ = 0. When we try to solve for the possible values of ψ and φ using
the above technique, problems will occur, since the elements R11, R21, R32, and
R33 will all be zero, and therefore Equations 3 and 6 will become
ψ = atan2
0
0
,
0
0
φ = atan2
0
0
,
0
0
.
In this case R11, R21, R32, and R33 do not constrain the values of ψ and φ.
Therefore, we must use different elements of the rotation matrix to compute the
values of ψ and φ.
θ = π/2 case: Consider the case when θ = π/2. Then,
R12 = sin ψ cos φ − cos ψ sin φ = sin(ψ − φ)
R13 = cos ψ cos φ + sin ψ sin φ = cos(ψ − φ)
R22 = sin ψ sin φ + cos ψ cos φ = cos(ψ − φ) = R13
R23 = cos ψ sin φ − sin ψ cos φ = − sin(ψ − φ) = −R12
Any ψ and φ that satisfy these equations will be a valid solution. Using
the equations for R12 and R13, we find that
(ψ − φ) = atan2(R12, R13)
ψ = φ + atan2(R12, R13)
θ = −π/2 case: Not surprisingly, a similar result holds for the case when θ =
−π/2, for which
R12 = − sin ψ cos φ − cos ψ sin φ = − sin(ψ + φ)
R13 = − cos ψ cos φ + sin ψ sin φ = − cos(ψ + φ)
R22 = − sin ψ sin φ + cos ψ cos φ = cos(ψ + φ) = −R13
R23 = − cos ψ sin φ − sin ψ cos φ = − sin(ψ + φ) = R12
Again, using the equations for R12 and R13, we find that
(ψ + φ) = atan2(−R12, −R13)
ψ = −φ + atan2(−R12, −R13)
4
if (R31 = ±1)
θ1 = −asin(R31)
θ2 = π − θ1
ψ1 = atan2 R32
cos θ1
, R33
cos θ1
ψ2 = atan2 R32
cos θ2
, R33
cos θ2
φ1 = atan2 R21
cos θ1
, R11
cos θ1
φ2 = atan2 R21
cos θ2
, R11
cos θ2
else
φ = anything; can set to 0
if (R31 = −1)
θ = π/2
ψ = φ + atan2(R12, R13)
else
θ = −π/2
ψ = −φ + atan2(−R12, −R13)
end if
end if
Figure 1: Pseudo-code for computing Euler angles from a rotation matrix. See
text for details.
Either case: In both the θ = π/2 and θ = −π/2 cases, we have found that
ψ and φ are linked. This phenomenon is called Gimbal lock. Although
in this case, there are an infinite number of solutions to the problem, in
practice, one is often interested in finding one solution. For this task, it is
convenient to set φ = 0 and compute ψ as described above.
Pseudo-code
We now summarize the method by providing a pseudo-code implementation in
Figure 1. The code is very simple.
Example
An example that demonstrates the computation of ψ, θ, and φ from a rotation
matrix is provided below.
Suppose we are asked to find the Euler angles that produce the matrix
R =


.5 −.1464 .8536
.5 .8536 −.1464
−.7071 .5 .5


First, we find the possible values for θ to be
θ1 = − sin(−.7071) =
π
4
5
θ2 = π − θ1 =
3π
4
Then, we find the corresponding values of ψ to be
ψ1 = atan2
.5
cos(π/4)
,
.5
cos(π/4)
=
π
4
ψ2 = atan2
.5
cos(3π/4)
,
.5
cos(3π/4)
= −
3π
4
And we find φ to be
φ1 = atan2
.5
cos(π/4)
,
.5
cos(π/4)
=
π
4
φ2 = atan2
.5
cos(3π/4)
,
.5
cos(3π/4)
= −
3π
4
Therefore, the solutions are
π
4
,
π
4
,
π
4
−
3π
4
,
3π
4
, −
3π
4
More than one solution?
It is interesting to note that there is always more than one sequence of rotations
about the three principle axes that results in the same orientation of an object.
As we have shown in this report, in the non-degenerate case of cos θ = 0, there
are two solutions. For the degenerate case of cos θ = 0, an infinite number of
solutions exist.
As an example, consider a book laying on a table face up in front of you.
Define the x-axis as to the right, the y-axis as away from you, and the z-axis
up. A rotation of π radians about the y-axis will turn the book so that the back
cover is now facing up. Another way to achieve the same orientation would be
to rotate the book π radians about the x-axis, and then π radians about the
z-axis. Thus, there is more than one way to achieve a desired rotation.
Acknowledgement
I wish to thank Sinisa Segvic, from the University of Zagreb, for providing some
insights into how to reduce the number of possible solutions to two for the
non-degenerate case. Also, many thanks to Tobias Ziegler from the Fraunhofer
Institute for pointing out the need for negative signs on R12 and R13 in the
θ = −π/2 case.
6
References
[1] Ken Shoemake, Animating Rotation with Quaternion Curves Proc. SIG-
GRAPH 1985, pp. 245 - 254.
7

More Related Content

What's hot

Basic mathematics integration
Basic mathematics integrationBasic mathematics integration
Basic mathematics integrationMuhammad Luthfan
 
Mathematics assignment
Mathematics assignmentMathematics assignment
Mathematics assignment
Aditya Chowdhary
 
Extension 1 miscellaneous worksheet
Extension 1 miscellaneous worksheetExtension 1 miscellaneous worksheet
Extension 1 miscellaneous worksheet
Andrew Rybkow
 
Appendex b
Appendex bAppendex b
Appendex bswavicky
 
Appendex d
Appendex dAppendex d
Appendex dswavicky
 
euclids division lemma
euclids division lemmaeuclids division lemma
euclids division lemmaJashan Kainth
 
Maths project
Maths projectMaths project
Maths project
Faizal Hasanwala
 
Chapter 3 exponential and logarithmic functions
Chapter 3 exponential and logarithmic functionsChapter 3 exponential and logarithmic functions
Chapter 3 exponential and logarithmic functions
Sarah Sue Calbio
 
Trignometry
TrignometryTrignometry
Open methods
Open methodsOpen methods
Open methodstatopc88
 
Query optimization in database
Query optimization in databaseQuery optimization in database
Query optimization in database
Rakesh Kumar
 
Algebra 2 unit 12.1
Algebra 2 unit 12.1Algebra 2 unit 12.1
Algebra 2 unit 12.1
Mark Ryder
 
Improved Inference for First-Order Autocorrelation Using Likelihood Analysis
Improved Inference for First-Order Autocorrelation Using Likelihood AnalysisImproved Inference for First-Order Autocorrelation Using Likelihood Analysis
Improved Inference for First-Order Autocorrelation Using Likelihood Analysisjachno
 
Appendex c
Appendex cAppendex c
Appendex cswavicky
 
Master thesis presentation
Master thesis presentationMaster thesis presentation
Master thesis presentation
Jordi París López, PhD
 
A disproof of the Riemann hypothesis
A disproof of the Riemann hypothesisA disproof of the Riemann hypothesis
A disproof of the Riemann hypothesis
iosrjce
 
Trigonometry - Trigonometric Identities
Trigonometry - Trigonometric IdentitiesTrigonometry - Trigonometric Identities
Trigonometry - Trigonometric Identities
JosefMikaeldelCorro
 

What's hot (20)

Real numbers
Real numbersReal numbers
Real numbers
 
Basic mathematics integration
Basic mathematics integrationBasic mathematics integration
Basic mathematics integration
 
Mathematics assignment
Mathematics assignmentMathematics assignment
Mathematics assignment
 
Extension 1 miscellaneous worksheet
Extension 1 miscellaneous worksheetExtension 1 miscellaneous worksheet
Extension 1 miscellaneous worksheet
 
Appendex b
Appendex bAppendex b
Appendex b
 
Appendex d
Appendex dAppendex d
Appendex d
 
euclids division lemma
euclids division lemmaeuclids division lemma
euclids division lemma
 
Maths project
Maths projectMaths project
Maths project
 
Chapter 3 exponential and logarithmic functions
Chapter 3 exponential and logarithmic functionsChapter 3 exponential and logarithmic functions
Chapter 3 exponential and logarithmic functions
 
Trignometry
TrignometryTrignometry
Trignometry
 
Day 4 examples
Day 4 examplesDay 4 examples
Day 4 examples
 
Open methods
Open methodsOpen methods
Open methods
 
Query optimization in database
Query optimization in databaseQuery optimization in database
Query optimization in database
 
Algebra 2 unit 12.1
Algebra 2 unit 12.1Algebra 2 unit 12.1
Algebra 2 unit 12.1
 
Improved Inference for First-Order Autocorrelation Using Likelihood Analysis
Improved Inference for First-Order Autocorrelation Using Likelihood AnalysisImproved Inference for First-Order Autocorrelation Using Likelihood Analysis
Improved Inference for First-Order Autocorrelation Using Likelihood Analysis
 
Cs419 lec6 lexical analysis using nfa
Cs419 lec6   lexical analysis using nfaCs419 lec6   lexical analysis using nfa
Cs419 lec6 lexical analysis using nfa
 
Appendex c
Appendex cAppendex c
Appendex c
 
Master thesis presentation
Master thesis presentationMaster thesis presentation
Master thesis presentation
 
A disproof of the Riemann hypothesis
A disproof of the Riemann hypothesisA disproof of the Riemann hypothesis
A disproof of the Riemann hypothesis
 
Trigonometry - Trigonometric Identities
Trigonometry - Trigonometric IdentitiesTrigonometry - Trigonometric Identities
Trigonometry - Trigonometric Identities
 

Viewers also liked

5555
55555555
5555
melmcnm
 
Autointruccional de analisis financiero
Autointruccional de analisis financieroAutointruccional de analisis financiero
Autointruccional de analisis financiero
vmantilla1955
 
Pagina
PaginaPagina
Organigrama
OrganigramaOrganigrama
Organigrama
yetzenia_16
 
F 2740803
F 2740803F 2740803
F 2740803daisyrj
 
Presentación 5.
Presentación 5.Presentación 5.
Presentación 5.
vmantilla1955
 
Presentation2
Presentation2Presentation2
Presentation2beccamori
 
Elpajarodelapaz
ElpajarodelapazElpajarodelapaz
Elpajarodelapaz
guestbe6386
 
Artilheiros 20º camp-4ª Rodada
Artilheiros 20º camp-4ª RodadaArtilheiros 20º camp-4ª Rodada
Artilheiros 20º camp-4ª Rodadacairo
 
Audio Sources Sheet Tom Adams
Audio Sources Sheet Tom AdamsAudio Sources Sheet Tom Adams
Audio Sources Sheet Tom Adams
Tom_Adams
 
Alfresco Rulez
Alfresco RulezAlfresco Rulez
Alfresco Rulez
Jeff Smith
 
Apresentacao Numeracao10
Apresentacao Numeracao10Apresentacao Numeracao10
Apresentacao Numeracao10
cleusamoreira
 
Enea Drama ©
Enea Drama ©Enea Drama ©
Enea Drama ©
Felipe Moreno
 

Viewers also liked (20)

5555
55555555
5555
 
Remodeez LinkedIn
Remodeez LinkedInRemodeez LinkedIn
Remodeez LinkedIn
 
Masters degree chinese
Masters degree chineseMasters degree chinese
Masters degree chinese
 
Masters degree english
Masters degree englishMasters degree english
Masters degree english
 
Autointruccional de analisis financiero
Autointruccional de analisis financieroAutointruccional de analisis financiero
Autointruccional de analisis financiero
 
Pagina
PaginaPagina
Pagina
 
Organigrama
OrganigramaOrganigrama
Organigrama
 
F 2740803
F 2740803F 2740803
F 2740803
 
Proyecto x
Proyecto xProyecto x
Proyecto x
 
Estado del arte
Estado del arteEstado del arte
Estado del arte
 
Presentación 5.
Presentación 5.Presentación 5.
Presentación 5.
 
1001
10011001
1001
 
Presentation2
Presentation2Presentation2
Presentation2
 
Elpajarodelapaz
ElpajarodelapazElpajarodelapaz
Elpajarodelapaz
 
Artilheiros 20º camp-4ª Rodada
Artilheiros 20º camp-4ª RodadaArtilheiros 20º camp-4ª Rodada
Artilheiros 20º camp-4ª Rodada
 
Audio Sources Sheet Tom Adams
Audio Sources Sheet Tom AdamsAudio Sources Sheet Tom Adams
Audio Sources Sheet Tom Adams
 
Alfresco Rulez
Alfresco RulezAlfresco Rulez
Alfresco Rulez
 
Apresentacao Numeracao10
Apresentacao Numeracao10Apresentacao Numeracao10
Apresentacao Numeracao10
 
Enea Drama ©
Enea Drama ©Enea Drama ©
Enea Drama ©
 
Diploma
DiplomaDiploma
Diploma
 

Similar to Euler

Permutations 2020
Permutations 2020Permutations 2020
Permutations 2020
Robert Geofroy
 
A note on arithmetic progressions in sets of integers
A note on arithmetic progressions in sets of integersA note on arithmetic progressions in sets of integers
A note on arithmetic progressions in sets of integersLukas Nabergall
 
A New Approach on Proportional Fuzzy Likelihood Ratio orderings of Triangular...
A New Approach on Proportional Fuzzy Likelihood Ratio orderings of Triangular...A New Approach on Proportional Fuzzy Likelihood Ratio orderings of Triangular...
A New Approach on Proportional Fuzzy Likelihood Ratio orderings of Triangular...
IJRESJOURNAL
 
Geometric Progressions
Geometric ProgressionsGeometric Progressions
Geometric Progressions
Akash Saha
 
Curve tracing
Curve tracingCurve tracing
Curve tracing
Kalpna Sharma
 
Hydrogen Schrodinger Equation.pdf
Hydrogen Schrodinger Equation.pdfHydrogen Schrodinger Equation.pdf
Hydrogen Schrodinger Equation.pdf
ssuser0b5a9c1
 
6.sequences and series Further Mathematics Zimbabwe Zimsec Cambridge
6.sequences and series   Further Mathematics Zimbabwe Zimsec Cambridge6.sequences and series   Further Mathematics Zimbabwe Zimsec Cambridge
6.sequences and series Further Mathematics Zimbabwe Zimsec Cambridge
alproelearning
 
Approximate Bayesian Computation with Quasi-Likelihoods
Approximate Bayesian Computation with Quasi-LikelihoodsApproximate Bayesian Computation with Quasi-Likelihoods
Approximate Bayesian Computation with Quasi-Likelihoods
Stefano Cabras
 
4.6 Relative product and composition
4.6 Relative product and composition4.6 Relative product and composition
4.6 Relative product and composition
Jan Plaza
 
Ramsey number lower bounds
Ramsey number lower  boundsRamsey number lower  bounds
Ramsey number lower bounds
Smit Raj
 
t5 graphs of trig functions and inverse trig functions
t5 graphs of trig functions and inverse trig functionst5 graphs of trig functions and inverse trig functions
t5 graphs of trig functions and inverse trig functionsmath260
 
Ramsey Theory
Ramsey TheoryRamsey Theory
Ramsey Theory
Suparno Ghoshal
 
Review of Trigonometry for Calculus “Trigon” =triangle +“metry”=measurement =...
Review of Trigonometry for Calculus “Trigon” =triangle +“metry”=measurement =...Review of Trigonometry for Calculus “Trigon” =triangle +“metry”=measurement =...
Review of Trigonometry for Calculus “Trigon” =triangle +“metry”=measurement =...
KyungKoh2
 
Hawkinrad a sourceasd
Hawkinrad a sourceasdHawkinrad a sourceasd
Hawkinrad a sourceasd
foxtrot jp R
 
Single Variable Calculus Assignment Help
Single Variable Calculus Assignment HelpSingle Variable Calculus Assignment Help
Single Variable Calculus Assignment Help
Math Homework Solver
 
Concepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotConcepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotTarun Gehlot
 
Concepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotConcepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotTarun Gehlot
 

Similar to Euler (20)

Ecl17
Ecl17Ecl17
Ecl17
 
Permutations 2020
Permutations 2020Permutations 2020
Permutations 2020
 
A note on arithmetic progressions in sets of integers
A note on arithmetic progressions in sets of integersA note on arithmetic progressions in sets of integers
A note on arithmetic progressions in sets of integers
 
A New Approach on Proportional Fuzzy Likelihood Ratio orderings of Triangular...
A New Approach on Proportional Fuzzy Likelihood Ratio orderings of Triangular...A New Approach on Proportional Fuzzy Likelihood Ratio orderings of Triangular...
A New Approach on Proportional Fuzzy Likelihood Ratio orderings of Triangular...
 
Geometric Progressions
Geometric ProgressionsGeometric Progressions
Geometric Progressions
 
Curve tracing
Curve tracingCurve tracing
Curve tracing
 
Hydrogen Schrodinger Equation.pdf
Hydrogen Schrodinger Equation.pdfHydrogen Schrodinger Equation.pdf
Hydrogen Schrodinger Equation.pdf
 
Sol68
Sol68Sol68
Sol68
 
Sol68
Sol68Sol68
Sol68
 
6.sequences and series Further Mathematics Zimbabwe Zimsec Cambridge
6.sequences and series   Further Mathematics Zimbabwe Zimsec Cambridge6.sequences and series   Further Mathematics Zimbabwe Zimsec Cambridge
6.sequences and series Further Mathematics Zimbabwe Zimsec Cambridge
 
Approximate Bayesian Computation with Quasi-Likelihoods
Approximate Bayesian Computation with Quasi-LikelihoodsApproximate Bayesian Computation with Quasi-Likelihoods
Approximate Bayesian Computation with Quasi-Likelihoods
 
4.6 Relative product and composition
4.6 Relative product and composition4.6 Relative product and composition
4.6 Relative product and composition
 
Ramsey number lower bounds
Ramsey number lower  boundsRamsey number lower  bounds
Ramsey number lower bounds
 
t5 graphs of trig functions and inverse trig functions
t5 graphs of trig functions and inverse trig functionst5 graphs of trig functions and inverse trig functions
t5 graphs of trig functions and inverse trig functions
 
Ramsey Theory
Ramsey TheoryRamsey Theory
Ramsey Theory
 
Review of Trigonometry for Calculus “Trigon” =triangle +“metry”=measurement =...
Review of Trigonometry for Calculus “Trigon” =triangle +“metry”=measurement =...Review of Trigonometry for Calculus “Trigon” =triangle +“metry”=measurement =...
Review of Trigonometry for Calculus “Trigon” =triangle +“metry”=measurement =...
 
Hawkinrad a sourceasd
Hawkinrad a sourceasdHawkinrad a sourceasd
Hawkinrad a sourceasd
 
Single Variable Calculus Assignment Help
Single Variable Calculus Assignment HelpSingle Variable Calculus Assignment Help
Single Variable Calculus Assignment Help
 
Concepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotConcepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlot
 
Concepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotConcepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlot
 

Recently uploaded

一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
v3tuleee
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
NABLAS株式会社
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
ukgaet
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
vcaxypu
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
oz8q3jxlp
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
ahzuo
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
MaleehaSheikh2
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
ewymefz
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
Tiktokethiodaily
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
enxupq
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Linda486226
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
axoqas
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 

Recently uploaded (20)

一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 

Euler

  • 1. Computing Euler angles from a rotation matrix Gregory G. Slabaugh Abstract This document discusses a simple technique to find all possible Euler angles from a rotation matrix. Determination of Euler angles is sometimes a necessary step in computer graphics, vision, robotics, and kinematics. However, the solution may or may not be obvious. Rotation matrices We start off with the standard definition of the rotations about the three prin- ciple axes. A rotation of ψ radians about the x-axis is defined as Rx(ψ) =   1 0 0 0 cos ψ − sin ψ 0 sin ψ cos ψ   Similarly, a rotation of θ radians about the y-axis is defined as Ry(θ) =   cos θ 0 sin θ 0 1 0 − sin θ 0 cos θ   Finally, a rotation of φ radians about the z-axis is defined as Rz(φ) =   cos φ − sin φ 0 sin φ cos φ 0 0 0 1   The angles ψ, θ, and φ are the Euler angles. Generalized rotation matrices A general rotation matrix can will have the form, R =   R11 R12 R13 R21 R22 R23 R31 R32 R33   1
  • 2. This matrix can be thought of a sequence of three rotations, one about each principle axis. Since matrix multiplication does not commute, the order of the axes which one rotates about will affect the result. For this analysis, we will rotate first about the x-axis, then the y-axis, and finally the z-axis. Such a sequence of rotations can be represented as the matrix product, R = Rz(φ)Ry(θ)Rx(ψ) =   cos θ cos φ sin ψ sin θ cos φ − cos ψ sin φ cos ψ sin θ cos φ + sin ψ sin φ cos θ sin φ sin ψ sin θ sin φ + cos ψ cos φ cos ψ sin θ sin φ − sin ψ cos φ − sin θ sin ψ cos θ cos ψ cos θ   Given a rotation matrix R, we can compute the Euler angles, ψ, θ, and φ by equating each element in R with the corresponding element in the matrix product Rz(φ)Ry(θ)Rx(ψ). This results in nine equations that can be used to find the Euler angles. Finding two possible angles for θ Starting with R31, we find R31 = − sin θ. This equation can be inverted to yield θ = − sin−1 (R31). (1) However, one must be careful in interpreting this equation. Since sin(π − θ) = sin(θ), there are actually two distinct values (for R31 = ±1) of θ that satisfy Equation 1. Therefore, both the values θ1 = − sin−1 (R31) θ2 = π − θ1 = π + sin−1 (R31) are valid solutions. We will handle the special case of R31 = ±1 later in this report. So using the R31 element of the rotation matrix, we are able to determine two possible values for θ. Finding the corresponding angles of ψ To find the values for ψ, we observe that R32 R33 = tan(ψ). We use this equation to solve for ψ, as ψ = atan2(R32, R33), (2) 2
  • 3. where atan2(y, x) is arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y/x, except that the signs of both arguments are used to determine the quadrant of the result, which lies in the range [−π, π]. The function atan2 is available in many programming languages. One must be careful in interpreting Equation 2. If cos(θ) > 0, then ψ = atan2(R32, R33). However, when cos(θ) < 0, ψ = atan2(−R32, −R33). A simple way to handle this is to use the equation ψ = atan2 R32 cos θ , R33 cos θ (3) to compute ψ. Equation 3 is valid for all cases except when cos θ = 0. We will deal with this special case later in this report. For each value of θ, we compute a corresponding value of ψ using Equation 3, yielding ψ1 = atan2 R32 cos θ1 , R33 cos θ1 (4) ψ2 = atan2 R32 cos θ2 , R33 cos θ2 (5) Finding the corresponding angles of φ A similar analysis holds for finding φ. We observe that R21 R11 = tan φ. We solve for φ using the equation φ = atan2 R21 cos θ , R11 cos θ (6) Again, this equation is valid for all cases except when cos θ = 0. We will deal with this special case later in this report. For each value of θ, we compute a corresponding value of φ using Equation 6, φ1 = atan2 R21 cos θ1 , R11 cos θ1 (7) φ2 = atan2 R21 cos θ2 , R11 cos θ2 (8) Two solutions if cos θ = 0 For the case of cos θ = 0, we now have two triplets of Euler angles that reproduce the rotation matrix, namely (ψ1, θ1, φ1) (ψ2, θ2, φ2) Both of these solutions will be valid. 3
  • 4. What if cos θ = 0? This technique described above does not work if the R31 element of the rotation matrix is 1 or −1, which corresponds to θ = −π/2 or θ = π/2, respectively, and to cos θ = 0. When we try to solve for the possible values of ψ and φ using the above technique, problems will occur, since the elements R11, R21, R32, and R33 will all be zero, and therefore Equations 3 and 6 will become ψ = atan2 0 0 , 0 0 φ = atan2 0 0 , 0 0 . In this case R11, R21, R32, and R33 do not constrain the values of ψ and φ. Therefore, we must use different elements of the rotation matrix to compute the values of ψ and φ. θ = π/2 case: Consider the case when θ = π/2. Then, R12 = sin ψ cos φ − cos ψ sin φ = sin(ψ − φ) R13 = cos ψ cos φ + sin ψ sin φ = cos(ψ − φ) R22 = sin ψ sin φ + cos ψ cos φ = cos(ψ − φ) = R13 R23 = cos ψ sin φ − sin ψ cos φ = − sin(ψ − φ) = −R12 Any ψ and φ that satisfy these equations will be a valid solution. Using the equations for R12 and R13, we find that (ψ − φ) = atan2(R12, R13) ψ = φ + atan2(R12, R13) θ = −π/2 case: Not surprisingly, a similar result holds for the case when θ = −π/2, for which R12 = − sin ψ cos φ − cos ψ sin φ = − sin(ψ + φ) R13 = − cos ψ cos φ + sin ψ sin φ = − cos(ψ + φ) R22 = − sin ψ sin φ + cos ψ cos φ = cos(ψ + φ) = −R13 R23 = − cos ψ sin φ − sin ψ cos φ = − sin(ψ + φ) = R12 Again, using the equations for R12 and R13, we find that (ψ + φ) = atan2(−R12, −R13) ψ = −φ + atan2(−R12, −R13) 4
  • 5. if (R31 = ±1) θ1 = −asin(R31) θ2 = π − θ1 ψ1 = atan2 R32 cos θ1 , R33 cos θ1 ψ2 = atan2 R32 cos θ2 , R33 cos θ2 φ1 = atan2 R21 cos θ1 , R11 cos θ1 φ2 = atan2 R21 cos θ2 , R11 cos θ2 else φ = anything; can set to 0 if (R31 = −1) θ = π/2 ψ = φ + atan2(R12, R13) else θ = −π/2 ψ = −φ + atan2(−R12, −R13) end if end if Figure 1: Pseudo-code for computing Euler angles from a rotation matrix. See text for details. Either case: In both the θ = π/2 and θ = −π/2 cases, we have found that ψ and φ are linked. This phenomenon is called Gimbal lock. Although in this case, there are an infinite number of solutions to the problem, in practice, one is often interested in finding one solution. For this task, it is convenient to set φ = 0 and compute ψ as described above. Pseudo-code We now summarize the method by providing a pseudo-code implementation in Figure 1. The code is very simple. Example An example that demonstrates the computation of ψ, θ, and φ from a rotation matrix is provided below. Suppose we are asked to find the Euler angles that produce the matrix R =   .5 −.1464 .8536 .5 .8536 −.1464 −.7071 .5 .5   First, we find the possible values for θ to be θ1 = − sin(−.7071) = π 4 5
  • 6. θ2 = π − θ1 = 3π 4 Then, we find the corresponding values of ψ to be ψ1 = atan2 .5 cos(π/4) , .5 cos(π/4) = π 4 ψ2 = atan2 .5 cos(3π/4) , .5 cos(3π/4) = − 3π 4 And we find φ to be φ1 = atan2 .5 cos(π/4) , .5 cos(π/4) = π 4 φ2 = atan2 .5 cos(3π/4) , .5 cos(3π/4) = − 3π 4 Therefore, the solutions are π 4 , π 4 , π 4 − 3π 4 , 3π 4 , − 3π 4 More than one solution? It is interesting to note that there is always more than one sequence of rotations about the three principle axes that results in the same orientation of an object. As we have shown in this report, in the non-degenerate case of cos θ = 0, there are two solutions. For the degenerate case of cos θ = 0, an infinite number of solutions exist. As an example, consider a book laying on a table face up in front of you. Define the x-axis as to the right, the y-axis as away from you, and the z-axis up. A rotation of π radians about the y-axis will turn the book so that the back cover is now facing up. Another way to achieve the same orientation would be to rotate the book π radians about the x-axis, and then π radians about the z-axis. Thus, there is more than one way to achieve a desired rotation. Acknowledgement I wish to thank Sinisa Segvic, from the University of Zagreb, for providing some insights into how to reduce the number of possible solutions to two for the non-degenerate case. Also, many thanks to Tobias Ziegler from the Fraunhofer Institute for pointing out the need for negative signs on R12 and R13 in the θ = −π/2 case. 6
  • 7. References [1] Ken Shoemake, Animating Rotation with Quaternion Curves Proc. SIG- GRAPH 1985, pp. 245 - 254. 7