当前位置:网站首页>Rotation matrix derivation process
Rotation matrix derivation process
2022-07-24 19:24:00 【I don't know anything about Phuket】
Why is the rotation matrix a set of many sine and cosine function values , What are the properties of rotation matrix ? What is the meaning of the rotation matrix ? What is the difference between the expressions of two-dimensional rotation and three-dimensional rotation ?
In this paper, firstly, the rotation matrix algebra and matrix expression in two-dimensional case are derived , Then the results are extended to three-dimensional .
One 、 Rotation matrix in two-dimensional space
What if P P P In the coordinate system { B } \{B\} { B} The coordinates of the for P = { x , y } P=\{x,y\} P={ x,y}, There is another coordinate system { A } \{A\} { A}, Can you give the same point P P P stay { A } \{A\} { A} Coordinate values in a coordinate system P ′ = { x ′ , y ′ } P'=\{x',y'\} P′={ x′,y′}? The answer is yes , The premise is that these two coordinate systems are known { A } \{A\} { A} { B } \{B\} { B} The relationship between , When the relationship between two coordinate systems is pure rotation , Rotation matrix is an expression used to describe the relationship between two coordinate systems .( Simply speaking , Is known { B } \{B\} { B} Point coordinates under , seek { A } \{A\} { A} Point coordinates under ). Here's the picture :

{ A } \{A\} { A} The coordinate system rotates counterclockwise θ \theta θ Degree and { B } \{B\} { B} The winning system completely overlaps , For ease of description , Let's assume the origin to P P P The distance to r r r, Consider the coordinate system { B } \{B\} { B}, According to the definition of rectangular coordinate system :
x = r cos α y = r sin α (1) x=r\cos\alpha\\ y=r\sin\alpha\tag{1} x=rcosαy=rsinα(1)
Consider the coordinate system { A } \{A\} { A}, Yes :
x ′ = r cos ( α + θ ) y ′ = r sin ( α + θ ) (2) x'=r\cos(\alpha+\theta)\\ y'=r\sin(\alpha+\theta)\tag{2} x′=rcos(α+θ)y′=rsin(α+θ)(2)
The expanded expression is :
x ′ = r ( cos α cos θ − sin α sin θ ) y ′ = r ( sin θ cos α + cos θ sin α ) (3) x'=r(\cos\alpha\cos\theta-\sin\alpha\sin\theta)\\ y'=r(\sin\theta\cos\alpha+\cos\theta\sin\alpha)\tag{3} x′=r(cosαcosθ−sinαsinθ)y′=r(sinθcosα+cosθsinα)(3)
take (1) Into the (3) have to :
x ′ = x cos α − y sin α y ′ = y cos α + x sin α (4) x'=x\cos\alpha-y\sin\alpha\\ y'=y\cos\alpha+x\sin\alpha\tag{4} x′=xcosα−ysinαy′=ycosα+xsinα(4)
(4) That's what we're looking for , Realize the algebraic expression of the same point in different coordinate systems , This expression is completed by { A } \{A\} { A} Indicates that the dot arrives { B } \{B\} { B} Transformation of points in coordinate system . Write it in matrix form :
[ x ′ y ′ ] = [ cos α − sin α sin α cos α ] [ x y ] (5) \begin{bmatrix} x'\\y' \end{bmatrix}= \begin{bmatrix}\cos\alpha&-\sin\alpha\\\sin\alpha&\cos\alpha\end{bmatrix} \begin{bmatrix}x\\y\end{bmatrix}\tag{5} [x′y′]=[cosαsinα−sinαcosα][xy](5)
Note that the matrix formed by the sine and cosine values in the above formula is A B R ^B_AR ABR, By { A } \{A\} { A} Switch the coordinate system to { B } \{B\} { B} The rotation matrix of , about { B } \{B\} { B} All points can be obtained by left multiplying the rotation matrix . remember B P ^BP BP For the coordinate system { B } \{B\} { B} Next point , A P ^AP AP For the coordinate system { A } \{A\} { A} Next point , therefore (5) Can be written as :
A P = B A R B P (6) ^AP=^A_BR^BP\tag{6} AP=BARBP(6)
So the expression of two-dimensional rotation matrix is :
B A R = [ cos α − sin α sin α cos α ] (7) ^A_BR=\begin{bmatrix}\cos\alpha&-\sin\alpha\\\sin\alpha&\cos\alpha\end{bmatrix}\tag{7} BAR=[cosαsinα−sinαcosα](7)
Two 、 Rotation matrix in three-dimensional space
For two-dimensional space , Rotate around X × Y X\times Y X×Y Direction of rotation , Observe the rotation behavior from the opposite direction of the arrow , Clockwise angle is positive , Counter clockwise is negative , Pure rotation in three-dimensional space , There will be three situations , Along the coordinate system X X X Y Y Y Z Z Z Observe the rotation in the opposite direction , The same is “ Positive and negative ”. The following is the plan view of rotating a certain angle in three cases :


In the first , Around the Z Z Z Take rotation as an example , Explain its rotation matrix expression . Suppose the point before rotation is O X Y P = { x , y , z } ^{OXY}P=\{x,y,z\} OXYP={ x,y,z}, The point after rotation is marked as O X ′ Y ′ P = { x ′ , y ′ , z ′ } ^{OX'Y'}P=\{x',y',z'\} OX′Y′P={ x′,y′,z′}, The original coordinate system rotates to the new coordinate system θ \theta θ Completely coincide with the new coordinates , It is similar to the derivation of rotation matrix in two-dimensional space :
x ′ = x cos α − y sin α y ′ = y cos α + x sin α z ′ = z (8) \begin{aligned} x'&=x\cos\alpha-y\sin\alpha\\ y'&=y\cos\alpha+x\sin\alpha\\ z'&=z\end{aligned} \tag{8} x′y′z′=xcosα−ysinα=ycosα+xsinα=z(8)
In matrix form :
[ x ′ y ′ z ′ ] = [ cos α − sin α 0 sin α cos α 0 0 0 1 ] [ x ′ y ′ z ′ ] (9) \begin{bmatrix} x'\\y'\\z' \end{bmatrix}=\begin{bmatrix}\cos\alpha&-\sin\alpha&0\\\sin\alpha&\cos\alpha&0\\0&0&1\end{bmatrix}\begin{bmatrix}x'\\y'\\z'\end{bmatrix}\tag{9} ⎣⎡x′y′z′⎦⎤=⎣⎡cosαsinα0−sinαcosα0001⎦⎤⎣⎡x′y′z′⎦⎤(9)
Remember that the rotation matrix is r o t z rotz rotz:
r o t z ( θ ) = [ cos α − sin α 0 sin α cos α 0 0 0 1 ] (10) rotz(\theta)=\begin{bmatrix}\cos\alpha&-\sin\alpha&0\\\sin\alpha&\cos\alpha&0\\0&0&1\end{bmatrix}\tag{10} rotz(θ)=⎣⎡cosαsinα0−sinαcosα0001⎦⎤(10)
In the same way, we can get r o t y roty roty and r o t x rotx rotx:
r o t y ( θ ) = [ cos θ 0 sin θ 0 1 0 − sin θ 0 cos θ ] (11) roty(\theta)= \begin{bmatrix} \cos\theta&0&\sin\theta\\ 0&1&0\\ -\sin\theta&0&\cos\theta \end{bmatrix}\tag{11} roty(θ)=⎣⎡cosθ0−sinθ010sinθ0cosθ⎦⎤(11)
r o t x ( θ ) = [ 1 0 0 0 cos θ sin θ 0 − sin θ cos θ ] (12) rotx(\theta)= \begin{bmatrix} 1&0&0\\ 0&\cos\theta&\sin\theta\\ 0&-\sin\theta&\cos\theta \end{bmatrix}\tag{12} rotx(θ)=⎣⎡1000cosθ−sinθ0sinθcosθ⎦⎤(12)
3、 ... and 、 Point rotation corresponds to rotation matrix
What I mentioned earlier is the change of point coordinates caused by coordinate system switching , If a point in space really rotates around an axis , So how should this point change ? Here's the picture :
P ( x , y ) P(x,y) P(x,y) The dot rotates counterclockwise to P ′ ( x ′ , y ′ ) P'(x',y') P′(x′,y′),, There is an equation before the rotation :
x = r cos α y = r sin α (13) x=r\cos\alpha\\ y=r\sin\alpha\tag{13} x=rcosαy=rsinα(13)
After rotation , radius r r r No change :
x ′ = cos ( α + θ ) y ′ = sin ( α + θ ) (14) x'=\cos(\alpha+\theta)\\ y'=\sin(\alpha+\theta)\tag{14} x′=cos(α+θ)y′=sin(α+θ)(14)
After expansion, there are :
x ′ = r cos α cos θ − r s i n α sin θ y ′ = r sin α cos θ + r cos α sin θ (15) x'=r\cos\alpha\cos\theta-rsin\alpha\sin\theta\\ y'=r\sin\alpha\cos\theta+r\cos\alpha\sin\theta\tag{15} x′=rcosαcosθ−rsinαsinθy′=rsinαcosθ+rcosαsinθ(15)
simultaneous equation (13)(15) Yes :
x ′ = x cos θ − y sin θ y ′ = y cos θ + x sin θ (16) x'=x\cos\theta-y\sin\theta\\ y'=y\cos\theta+x\sin\theta\tag{16} x′=xcosθ−ysinθy′=ycosθ+xsinθ(16)
In the form of a matrix :
[ x ′ y ′ ] = [ cos θ − sin θ sin θ cos θ ] [ x y ] (17) \begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}\tag{17} [x′y′]=[cosθsinθ−sinθcosθ][xy](17)
Make :
R = [ cos θ − sin θ sin θ cos θ ] R=\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix} R=[cosθsinθ−sinθcosθ]
(17) It can be written. :
P ′ = R P (18) P'=RP\tag{18} P′=RP(18)
Because only one coordinate system is involved , So this matrix coordinates without any letters , This matrix can help us calculate the coordinates of the points after rotation , It is also known as the rotation matrix , It is exactly the same as the rotation expression of the coordinate system , The rotation matrix of the actual rotation of three-dimensional points , There is no further derivation here .
Four 、 The meaning of rotation matrix
There are three meanings of rotation matrix :
- Describe the relationship between coordinate systems , The three principal axes of the coordinate system project to the three principal axes of another coordinate system ;
- Transformation left multiplication matrix of the same point in different coordinate systems ;
- The transformation left multiplication matrix in the same coordinate system after point rotation ;
If there is only rotation relationship between two coordinate systems , Then this relationship can be expressed by the rotation matrix , This relationship is directional , That is to say { A } \{A\} { A} Coordinate system to { B } \{B\} { B} It's not equal to { A } \{A\} { A} To { B } \{B\} { B}, But there are the following relationships :
B A R = A B R − 1 (19) ^A_BR=^B_AR^{-1}\tag{19} BAR=ABR−1(19)
And because the rotation matrix is a unit orthogonal matrix , So there is :
B A R = A B R T (20) ^A_BR=^B_AR^T\tag{20} BAR=ABRT(20)
In practical use , This directionality should be made clear , If you know { B } \{B\} { B} A point in a coordinate system B P ^BP BP Ask for in { B } \{B\} { B} Next point , Then rotate the matrix θ \theta θ A variable's value , Should be { A } \{A\} { A} How many angles does the coordinate system rotate in which direction , If it's clockwise , Then this value should be negative , On the contrary, it is a positive number .
Tips: How to determine the positive and negative of the rotation matrix ? For the rotation matrix of the actual rotation type of the point , It should be how many degrees of counterclockwise rotation to reach the new point before rotation ; For the rotation matrix of points in different coordinate systems , It should be how the target coordinate system rotates to the coordinate system of the current point .
边栏推荐
- In the spring of domestic databases
- Mysql8.0 learning record 19 - Page segments and tablespaces
- [JVM learning 03] class loading and bytecode Technology
- 【JVM学习03】类加载与字节码技术
- Day 6 (array example)
- Serial vector format (SVF) file format
- 文献阅读:GoPose 3D Human Pose Estimation Using WiFi
- 2022 Hangdian multi school second session 1009 shuangq (Mathematics)
- asp. Net coree file upload and download example
- Ensure the health and safety of front-line construction personnel, and implement wrong time construction at Shenzhen construction site
猜你喜欢

Meshlab&PCL ISS关键点

多线程与并发编程常见问题(未完待续)

asp. Net coree file upload and download example

Leetcode652 finding duplicate subtrees

Decision tree_ ID3_ C4.5_ CART

Nftscan and port3 have reached strategic cooperation in the field of NFT data

The ark compiler is coming. What about APK reinforcement
![[JVM learning 03] class loading and bytecode Technology](/img/b4/9482b02b58580171235fd4c36129e9.png)
[JVM learning 03] class loading and bytecode Technology

Timed task framework

OpenGL learning (IV) glut 3D image rendering
随机推荐
Timed task framework
Sequences, time series and prediction in tessorflow quizs on coursera (II)
JVM method call
Meshlab&PCL ISS关键点
Sequences, time series and prediction in tessorflow quizs on coursera (I)
He has been in charge of the British Society of engineering and technology for 13 years, and van nugget officially retired
[in depth study of 4g/5g/6g topic -39]: urllc-10 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -3- how to distinguish urllc services? Detailed expl
Jedi survive and eat chicken F12 screenshot save path reference
LSTM and Gru of RNN_ Attention mechanism
SATA protocol OOB essay
This visual analysis library makes it easy for you to play with data science!
Hangdian multi School Game 1 question 3 backpack (XOR dp+bitset)
Common methods of string class
OPENGL学习(二)OPENGL渲染管线
FPGA 20 routines: 9. DDR3 memory particle initialization write and read through RS232 (Part 2)
Those gods on Zhihu reply
Tupu software digital twin civil aviation flight networking, building a new business form of smart Civil Aviation
Database index: index is not a panacea
pyhanlp安装教程
Detailed explanation of the relationship between MySQL tables