About two-dimensional graphics rotation may be in a lot of computer graphics related books will be introduced, but really understand the formula derivation process is not much.
So how to deduce a two-dimensional graph around a certain point of rotation formula? I'll give a brief explanation of the derivation process here.
In fact, the derivation process is relatively simple, first we look at a picture to see how to derive a two-dimensional graph around the origin of the rotation of the formula.
The drawing is relatively sketchy, but it is enough to illustrate the problem. If the point before the rotation is at p. The point after rotation is at p '.
How do I find the point P ' coordinates after rotation?
In the diagram. The direction angle of p before rotation is a, and the direction angle of P ' after rotation becomes a+b, where B is the angle of rotation. The so-called direction angle is the angle between the pity Dorado and the Origin line and the x-axis forward. The positive direction of rotation is counterclockwise
In the diagram, the vertical line from P ' point to the x-axis, perpendicular to point B, is based on the basic knowledge of the triangle and is able to write an equation such as the following.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvemhvdxh1z3vhbmcymzy=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "/>
The R in Equation 1 is the distance from point P and P ' to Origin.
By equation 1, according to the knowledge of the high school trigonometric function, i.e., and the difference formula get for example the following equation 2
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvemhvdxh1z3vhbmcymzy=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "/>
By observing the above formula, RCOs (a) =x,rsin (a) =y, so the upper-type further flower can be given the following equation.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvemhvdxh1z3vhbmcymzy=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "/>
This formula is the formula for the rotation of two-dimensional graphics that we often see. So the rotation around the origin of the formula deduced, then hi often encountered around a point of rotation, such as around the center of the vector graphics rotation.
In such a case, the first translation is required. and then rotate. Finally pan back, detailed steps such as the following.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvemhvdxh1z3vhbmcymzy=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "/>
It is known that (X0,Y0) is the vertex of rotation. Then translate the graphic to the origin, then rotate the b angle around the origin, and finally pan to (X0,Y0).
So very easy to know a little bit (x0,y0) rotation around the formula is
Isn't it simpler, I think it's OK.
Derivation of two-dimensional graphic rotation formula