Computer graphics and OpenGL learning five (two-dimensional geometric transformation 3. two-dimensional coordinate transformation)

Transformation between two-dimensional coordinate systems

1. Transformation between two-dimensional coordinate systems

In the two-dimensional observation in the next section, the transformation from the observation coordinate system to the world coordinate system will be involved, so we introduce the idea of ​​transforming from a Cartesian coordinate system xy to another Cartesian coordinate system (x', y'). . The x'y' coordinate system uses a point (xo, yo) of the xy coordinate as the origin, and has a specified direction angle θ.

Transformation steps :

1) Translate the coordinate origin of the x'y' system to the origin (0,0) of the xy system;

2) Rotate the x' axis to the x axis.

 

 

The translation of the coordinate origin can be represented using the following matrix operations:

  

After the translation operation, in order to coincide the axes of the two systems, you can rotate clockwise:

Combining these two transformation matrices defines a conforming matrix that transforms from the x'y' system to the xy system:

Alternatively, specify a vector V that indicates the direction of the positive y' axis . Specifies the vector V as a point in the xy reference system relative to the origin of the xy coordinate system. Then, the unit vector in the y' direction can be calculated as

The unit vector u along the x' axis is obtained by rotating v 90° clockwise:

Because the elements of any rotation matrix can be represented as the elements of a set of orthogonal unit vectors, the matrices where the x'y' system is rotated to the xy system coincident can be written as:


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324421625&siteId=291194637