Skip to content

Commit

Permalink
Create rotation_zyz.tex
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpy authored Mar 6, 2018
1 parent 9d3bf5f commit 5d93cd9
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions rotation_zyz.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
%=======================================================================%
% [Euler] intrinsic (relative) transformation (z-y'-z")
%=======================================================================%
\newcommand{\tdsetzyzrel}{
\renewcommand{\tdplotcalctransformrotmain}{
%-----------------------------------------------------------------------%
% calculate sin and cos from all angles
%-----------------------------------------------------------------------%
\tdplotsinandcos{\sa}{\ca}{\tdplotalpha}
\tdplotsinandcos{\sb}{\cb}{\tdplotbeta}
\tdplotsinandcos{\sg}{\cg}{\tdplotgamma}
%-----------------------------------------------------------------------%
% calculate all possible multiplications of sin/cos in a,b,g
%-----------------------------------------------------------------------%
\tdplotmult{\sasb}{\sa}{\sb}
\tdplotmult{\sacb}{\sa}{\cb}
\tdplotmult{\casb}{\ca}{\sb}
\tdplotmult{\cacb}{\ca}{\cb}
%-----------------------------------------------------------------------%
\tdplotmult{\sasg}{\sa}{\sg}
\tdplotmult{\sacg}{\sa}{\cg}
\tdplotmult{\casg}{\ca}{\sg}
\tdplotmult{\cacg}{\ca}{\cg}
%-----------------------------------------------------------------------%
\tdplotmult{\sbsg}{\sb}{\sg}
\tdplotmult{\sbcg}{\sb}{\cg}
\tdplotmult{\cbsg}{\cb}{\sg}
\tdplotmult{\cbcg}{\cb}{\cg}
%-----------------------------------------------------------------------%
\tdplotmult{\sasbsg}{\sasb}{\sg}
\tdplotmult{\sasbcg}{\sasb}{\cg}
\tdplotmult{\sacbsg}{\sacb}{\sg}
\tdplotmult{\sacbcg}{\sacb}{\cg}
\tdplotmult{\casbsg}{\casb}{\sg}
\tdplotmult{\casbcg}{\casb}{\cg}
\tdplotmult{\cacbsg}{\cacb}{\sg}
\tdplotmult{\cacbcg}{\cacb}{\cg}
%-----------------------------------------------------------------------%
% define rotation matrix according to z-y'-z"-convention
% source: https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix
%-----------------------------------------------------------------------%
\pgfmathsetmacro{\raaeul}{\cacbcg - \sasg}
\pgfmathsetmacro{\rabeul}{-\sacg - \cacbsg}
\pgfmathsetmacro{\raceul}{\casb}
\pgfmathsetmacro{\rbaeul}{\casg + \sacbcg}
\pgfmathsetmacro{\rbbeul}{\cacg - \sacbsg}
\pgfmathsetmacro{\rbceul}{\sasb}
\pgfmathsetmacro{\rcaeul}{-\sbcg}
\pgfmathsetmacro{\rcbeul}{\sbsg}
\pgfmathsetmacro{\rcceul}{\cb}
%-----------------------------------------------------------------------%
}}

%=======================================================================%
% [Euler] extrinsic (absolute) transformation (z-y-z)
%=======================================================================%
\newcommand{\tdsetzyzabs}{
\renewcommand{\tdplotcalctransformrotmain}{
%-----------------------------------------------------------------------%
% calculate sin and cos from all angles
%-----------------------------------------------------------------------%
\tdplotsinandcos{\sa}{\ca}{\tdplotalpha}
\tdplotsinandcos{\sb}{\cb}{\tdplotbeta}
\tdplotsinandcos{\sg}{\cg}{\tdplotgamma}
%-----------------------------------------------------------------------%
% calculate all possible multiplications of sin/cos in a,b,g
%-----------------------------------------------------------------------%
\tdplotmult{\sasb}{\sa}{\sb}
\tdplotmult{\sacb}{\sa}{\cb}
\tdplotmult{\casb}{\ca}{\sb}
\tdplotmult{\cacb}{\ca}{\cb}
%-----------------------------------------------------------------------%
\tdplotmult{\sasg}{\sa}{\sg}
\tdplotmult{\sacg}{\sa}{\cg}
\tdplotmult{\casg}{\ca}{\sg}
\tdplotmult{\cacg}{\ca}{\cg}
%-----------------------------------------------------------------------%
\tdplotmult{\sbsg}{\sb}{\sg}
\tdplotmult{\sbcg}{\sb}{\cg}
\tdplotmult{\cbsg}{\cb}{\sg}
\tdplotmult{\cbcg}{\cb}{\cg}
%-----------------------------------------------------------------------%
\tdplotmult{\sasbsg}{\sasb}{\sg}
\tdplotmult{\sasbcg}{\sasb}{\cg}
\tdplotmult{\sacbsg}{\sacb}{\sg}
\tdplotmult{\sacbcg}{\sacb}{\cg}
\tdplotmult{\casbsg}{\casb}{\sg}
\tdplotmult{\casbcg}{\casb}{\cg}
\tdplotmult{\cacbsg}{\cacb}{\sg}
\tdplotmult{\cacbcg}{\cacb}{\cg}
%-----------------------------------------------------------------------%
% define rotation matrix according to z-y-z-convention
% extrinsic matrix = intrinsic matrix transposed and with negative angles
%-----------------------------------------------------------------------%
\pgfmathsetmacro{\raaeul}{\cacbcg - \sasg}
\pgfmathsetmacro{\rabeul}{-\casg - \sacbcg}
\pgfmathsetmacro{\raceul}{\sbcg}
\pgfmathsetmacro{\rbaeul}{\sacg + \cacbsg}
\pgfmathsetmacro{\rbbeul}{\cacg - \sacbsg}
\pgfmathsetmacro{\rbceul}{\sbsg}
\pgfmathsetmacro{\rcaeul}{-\casb}
\pgfmathsetmacro{\rcbeul}{\sasb}
\pgfmathsetmacro{\rcceul}{\cb}
%-----------------------------------------------------------------------%
}}

0 comments on commit 5d93cd9

Please sign in to comment.