Many people have studied the imation editor of GL, but I don't think everyone can understand the sprite m00 M01 M02 M10 M11 M12 in its XML data file, in fact, they are six parameters of the Java image transformation class affinetransform. Affinetransform is a very important class in j2se for processing 2D image affine transformations, which is often used in game tools. The constructor of this class has six parameters: m00 M10 M01 M11 M02 M12, A matrix [m00 M01 M02] [M10 M11 M12] [0 0 1] is constructed. Pay attention to the order of these six parameters, cocomo used to get the wrong result because of the wrong Parameter order, the most depressing thing is that it was also fooled by Jedi to say that there was a kind of identity matrix that was not stored in [1 0 0 0] [0 1 0] [0 0 1] format, I have not found the problem for half a day. After this matrix is built, then, when the translation is performed, the left side is multiplied by a translation matrix [1 0 TX] [0 1 ty] [0 0 1] When the X is reversed, the left side is multiplied by a scaling matrix [-1 0 0] [0 1 0] [0 0 1] When Y is reversed, the left side is multiplied by a scaling matrix [1 0 0] [0-1 0] [0 0 1] When the rotation is performed, the left side is multiplied by a rotating matrix [cos (theta) -Sin (theta) 0] [sin (theta) Cos (theta) 0] [0 0 1] Then the settransform matrix can be drawn in graphics2d. To get the transformed data, call getmatrix to obtain a double array matrix. Matrix [4] is the X axis offset, and matrix [5] is the Y axis offset. If Matrix [0] <0, x is reversed, and matrix [3] <0, Y is reversed. Double Degree = math. todegrees (math. asin (Matrix [1]); If (degree <0) degree + = 360; then the rotation angle is obtained.
Original: http://j2medev.spaces.live.com/blog/cns! 8d09cff9fe06ed5d! 1065. Entry