Abstract

Plane computer graphics are basic information carriers in many industrial scenarios, such as engineering simulation, automatic control, and software design. Plane computer graphics are generally a kind of digital signals guided by mathematical symbols, and each vertex of a plane computer graph forms a graph matrix. Therefore, linear matrix transformation serves as the most common algorithmic unit to realize various information processing operations. To improve ease of graph matrix computing in practical engineering scenarios, this paper proposes a theoretical scientific programming framework for application of linear matrix transformation in plane computer graphics. Firstly, theoretical basis of linear matrix transformation in homogeneous plane coordinates is displayed and analyzed. Then, the universal theorem about linear transformation of graph matrices is deduced, and corresponding proofs are also given. Finally, a case study is set up to demonstrate the main workflow of the proposed theoretical scientific programming framework. The simulative results reveal feasibility of the proposal.

1. Introduction

Geometric graphics transformation refers to some specific graphics process operations [1, 2], including movement of the defined graphics from one position to another [3], change of size and shape for graphics, or generation of complex graphics from existing graphics [4, 5]. And it is also named as graphics transformation for short [6, 7]. Graphics transformation can help deduce required graphics with the aid of two-dimensional or three-dimensional transformation operations [8, 9]. Figure 1 gives a typical example of 2D linear matrix transformation in plane space [10, 11]. Graphic transformation is usually realized via matrix transformation, and matrices used for transformation varies with different scenes [12, 13]. With the development of computer science and simulation modeling, graphics transformation is usually implemented by computer algorithms [14], forming the discipline of computer graphics [15]. In order to enhance engineering ease of digital signal processing in plane graphics [16], this work concentrates the theoretical scientific programming framework for application of linear matrix transformation in plane computer graphics [17, 18].

Points are the basic elements of a graph [19]. In analytic geometry, points are represented by vectors [20, 21]. For example, points in two-dimensional space (plane) and in three-dimensional space are separately represented by

A planar (two-dimensional) figure or a spatial (three-dimensional) shape can be represented by a set of points (referred to as a set of points) [22, 23]. A planar graph can be represented by a matrix as follows:where the set of vertices are included and a three-dimensional graph can be represented by a matrix as follows:

When the point set is represented by a matrix, the transformation of the point can be realized by the following linear transformation:where denotes the old point coordinates, denotes the transformation matrix, and denotes the new point coordinates. There is a one-to-one correspondence between linear transformation and matrix.

2. Plane Graph Transformation in Homogeneous Coordinates

First of all, it is supposed to illustrate four basic transformation types which are shown in Figure 2: translation, scale, rotation, and skew [24, 25]. The commonly used transformation matrix of plane graphics contains four types: proportional transformation, symmetrical transformation, rotation transformation, and the translation transformation [26, 27].

Definition 1. The proportional transformation is represented as the following format:where and are the proportional coefficient along the x-axis and y-axis, respectively, and they satisfy the condition: . The different value setting of and leads to different scenes.(i)When , it is a constant proportional transformation, that is, the figure is unchanged.(ii)When , the figure magnifies proportionally along the two axes.(iii)When , the figure shrinks proportionally along the two axes.(iv)When , the figure changes nonuniformly along the two axes, and the result is graphic distortion.

Definition 2. The symmetrical transformation is represented as the following format:where , , , and are the symmetrical coefficients. The different value setting of , , , and leads to different scenes.(i)When , it is a symmetrical transformation about the X-axis.(ii)When , it is the symmetric transformation about the Y-axis.(iii)When , it is the symmetric transformation about the origin.(iv)When , it is the symmetric transformation about the straight line .(v)When , it is the symmetric transformation about the straight line .

Definition 3. The rotation transformation is represented as the following format:where is the angle rotated around the origin of the coordinate. The different value setting of leads to different scenes.(i)The value of this angle is positive when it rotates counterclockwise.(ii)The value of this angle is negative when it rotates clockwise.

Definition 4. The translation transformation is represented as the following format:or the following format:As the translation transformation cannot be written in form of , it is not with the linear type. In order to change translation transformation into linear transformation, we can uniformly use linear matrix operations to study plane graphic transformation [28]. The homogeneous coordinates are generated, in which -dimensional vectors are represented by -dimensional ones. When the homogeneous coordinate of the vector equals to , where is a real number, the homogeneous coordinate representation of a vector is not unique, and different values of the homogeneous coordinate represents the same point. A homogeneous coordinate represents the point on the plane. Hence, the following definition can be deduced.

Definition 5. When , the homogeneous coordinate is called as the normalized homogeneous coordinate.
After the introduction of homogeneous coordinates, translation transformation defined in Definition 4 can be written as follows:It is a linear transformation, and the different value setting of , , , and leads to different scenes.(i)When , the graph translates positively along the X-axis.(ii)When , the graph translates negatively along the X-axis.(iii)When , the graph translates positively along the Y-axis.(iv)When , the graph translates negatively along the Y-axis.

3. Theorem and Proof for Plane Graphics Transformation

Theorem 1. When the transformation matrix of the plane graph is denoted as follows:the causes proportional, symmetric, and rotational transformation of the planar graph, and causes the plane graph to produce translation transformation.

Proof. Supposing that , the following formula can be deduced:where , , and are separately represented as follows:According to the matrix block method, the following six formulas can be further deduced as follows:Then, the can be rewritten as follows:Obviously, is the basic transformation of two-dimensional graphics, thus translation transformation can be deduced as follows:To sum up, the transformation of plane graphics can be represented by a unified matrix.The proof for Theorem 1 is to be finished so far.
Points are often used in computer graphics, and if the position of point changes, so does the figure [29]. Therefore, if transform the graph, it is needed to change the point [30]. The effect of the product of a matrix and a vector in linear transformation provides a method of graphic transformation, which can be used to produce the effect of the graphic change in the computer [31, 32].
For a closed figure in a plane coordinate system, it is represented by a matrix , and each column of represents the coordinates of a vertex of the graph. To close the graph, the last column of is the same as the first column [33]. In order to realize the translation of graphics by using linear transformation, a row with elements of 1 is added to matrix so that the shape of matrix .
The following two transformation matrices are given asfor two transformation processes and , they can be separately explained as follows:(i) is the transformation result of , in which is translated along the positive direction of the X-axis, is translated along the positive direction of the Y-axis.(ii) is the result of the inverse (clockwise) rotation of the angle of the graph with the coordinate origin as the center.The letter A is moved 15 up, 30 to the left, the counterclockwise, and then 30 up, 20 to the right, then turn counterclockwise by , and the MATLAB software is used to draw transformed graphics [34, 35]. The graphic matrix of the letter A can be constructed from Table 1. For this example, is deduced as follows:From the meaning of the question, it can be seen that the transformation matrix of figure a moving up 15 and moving left 30, which can be represented as the following matrix:And the transformation matrix can be represented aswhere rotating counterclockwise of graph A is . The transformation matrices of moving figure A up 30, 20 to the right, and counterclockwise, respectively, are as follows:So, these three transformation matrices are respectively , , and , and one of them is a combinatorial transformation.

4. Scientific Programming Demo for the Case Study

Having analyzed basic linear matrix transformation theory and proved its efficiency, this section manages to give a practical scientific programming demo for the above case study. Its pseudo codes reveal major workflow of the proposed theoretical scientific programming framework, which is illustrated in Algorithm 1. Through such suggested theoretical scientific programming framework, it is expected to facilitate engineering practice in relevant areas. The proposed scientific programming demo for the above case study in MATLAB is given as follows:>>close all;>>X = [0,4,6,10,8,5,3.5,6.1,6.5,3.2,2,0;0,14,14,0,0,11,6,6,4.5,4.5,0,0;ones(1,12)];>>plot(X(1,:),X(2,:));% Draw the letter A figure hold on;>>M1 = [1,0,−30; 0,1,15; 0,0,1];>>Y1 = M1X;hold on;>>fill(Y1(1,:),Y1(2,:), “red”);%Draw the figure after the translation of the letter A.>>R1 = [cos(pi/3), −sin(pi/3),0];sin(pi/3),cos(pi/3),0;[0,0,1];>>Y2 = R1X;hold on;>>fill(Y2(1,:),Y2(2,:), “blue”);%Draw the figure after the letter A is rotated.>>M2 = [1,0,20; 0,1,30; 0,0,1];>>R2 = [cos(3pi/4), −sin(3pi/4),0];sin(3pi/4),cos(3pi/4),0;[0,0,1];>>Y3 = M2R2X;hold on;>>fill(Y3(1,:),Y3(2,:), “black”);%Draw the figure after the letter A is translated and rotated.

INPUT: , , , ,
OUTPUT: ,
(1)while Each graph do
(2)for Dimension: do
(3)  Plot plane graph of letter A
(4)  Define transformation matrix for letter A
(5)  Calculate transformation result for letter A
(6)  Define transformation matrix for letter A
(7)  Calculate transformation result for letter A
(8)  Define transformation matrices and for letter A
(9)  Calculate transformation result for letter A
(10)  Output graphics for letter A
(11)end for
(12)end while

Running result of the above programming code leads to the graph in Figure 3.

5. Conclusion

Plane graph transformation mainly includes proportion, symmetry, rotation, translation, and so on [36]. These transformations are unified into linear transformations under homogeneous coordinates and studied by the matrix [37]. This provides a unified transformation matrix method for coordinate transformation of two-dimensional, three-dimensional, and even high-dimensional space of geometric graphics, and these transformations can be easily combined [38]. The complexity of the transformation matrix is related to transformation steps, that is, the more steps, the more transformation matrix, which can produce the transformation of the complex graph [39, 40].

Data Availability

The data are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.