Counter-clockwise matrix rotation algorithm

Source: Internet
Author: User
The Rotationmatrix is a matrix that has the effect of changing the vector direction but not the size when multiplied by a vector. The rotation matrix does not include Inversion. it can change the right coordinate system to the left coordinate system or vice versa. All rotation plus inversion form a set of orthogonal matrices. Rotation can be divided into active rotation and passive rotation. Active rotation refers to the rotation of the vector around the rotating axis counterclockwise. Passive rotation is a counter-clockwise rotation of the coordinate axis itself.

The Rotation matrix is a matrix that has the effect of changing the vector direction but not the size when multiplied by a vector. The rotation matrix does not include Inversion. it can change the right coordinate system to the left coordinate system or vice versa. All rotation plus inversion form a set of orthogonal matrices. Rotation can be divided into active rotation and passive rotation. Active rotation refers to the rotation of the vector around the rotating axis counterclockwise. Passive rotation is a counter-clockwise rotation of the axis itself, which is equivalent to the inverse operation of active rotation.

The following uses homogeneous coordinates to transform the matrix:

/* Enter a character matrix of n * n and rotate it counter-clockwise for 90 degrees. output: After calculation, the transformation matrix of n * n square matrix rotation of 90 degrees is: 0, 1, 0, 0,-1, 0-1, 0, 0, 0, the inverse matrix is, 1, 0, 0 n-1, 0, 1 0, n-1, 1 */# include
 
  
# Define N 4 char m [N] [N] = {'a', 'B', 'c', 'D'}, {'e ', 'F', 'G', 'H'}, {'I', 'J', 'K', 'l'}, {'M', 'n ', 'o', 'P' }}; int main () {int I, j; for (I = 0; I
          
   

A detailed program:

/* Enter the N-level matrix and rotate 90 ° counter-clockwise */# include
    
     
# Include
     
      
# Define N 20int a [N] [N]; main () {int I, k, n, j; printf ("Enter n <= % d \ n ", n); scanf ("% d", & n); // input order if (n> N) {printf ("input error \ n "); exit (0) ;}for (I = 0; I
      
       

This article is available at http://www.nowamagic.net/librarys/veda/detail/4254.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.