1. Introduction
Straight line drawing is among the important fields of various industries, such as straight-line interpolation [1], stepper motor cooperative control [2], 3D printing [3], 3D model building [4], and image drawing [5]. To quickly draw straight lines, the speed of the applied algorithm is critical. The Bresenham’s algorithm [6,7], DDA algorithm [8,9,10], and midpoint algorithm [11,12,13] are two-dimensional straight-line generation algorithms. Among which, the most famous is the Bresenham’s algorithm, which is introduced during the 1960s. The advantage of Bresenham’s algorithm is that all the operations are integers, without division or decimals. This approach is efficient at selecting a set of grid points to represent a straight line in a two-dimensional space. Space symmetry and simplifying computation are two major aspects of the algorithm towards high efficiency [14].
Stephenson et al. [15] present a line drawing algorithm based on runs of runs and discussed a number of special cases in the structure of runs and runs; it is proved that the algorithm can also be applied to short straight lines; this algorithm is formed to draw the line that has an identical iterative structure to Bresenham’s algorithm, except that at each iteration, it is not a pixel that is set but a run of runs; thus, the speed of line drawing is improved. Li et al. [16] proposed a fast line drawing algorithm using circular subtraction based on Bresenham’s algorithm. This algorithm makes use of the corresponding relationship between the two ends of the line and its symmetry to quickly draw multiple pixels, which enhances the speed of drawing straight lines. Liu et al. [1] extended Bresenham’s algorithm to a spatial straight line; the straight line is decomposed into the motion of two planes, which realize a three-dimensional Bresenham’s algorithm; the actual errors of the algorithm at each sampling point are less than the maximum theoretical error; however, because of the discriminant containing decimals, the actual line may deviate from the theoretical straight line due to the problem of retaining decimal digits. Dai et al. [2] also extended Bresenham’s algorithm from two dimensions to three, and applied it to multidimensional stepper motor cooperative control. Although the control accuracy requirements can be met by this algorithm, it is triggered by the interruption of the timer during motion, which leads to a noncontinuous algorithm.
To solve the above problems, a spatial straight line drawing algorithm based on the method of discriminate regions is proposed in this paper. Our innovation is that the discriminant in our algorithm is the integer; only the coordinates of the starting and end point of the spatial straight line are needed to be input in this algorithm; then, the distribution of spatial straight lines in three-dimensional space and the location of the end point can be quickly determined, and then the corresponding discriminant is obtained and the selection points of lines in each three-dimensional mesh are determined. Finally, the selected points are connected to complete the spatial space line drawing. This method can avoid the decimal in the discriminant completely, so all the operations are integers in the algorithm of this paper; therefore, the problem of deviation from the theoretical straight line caused by the retention of decimals of significant digits will be avoided. This algorithm is applied to the cooperative control of the stepping motor. A proportional integral differential (PID) control algorithm is often used for the control of a single motor and the parameters need to be tuned [17]. This paper mainly explains the process of multistep motor cooperative control.
2. Space Line Drawing Algorithm
In this paper, Bresenham’s algorithm is extended from a two-dimensional plane to a three-dimensional space. Meantime, in order to avoid the problem of deviation between the actual straight line and the theoretical straight line caused by the decimals of the discriminant, a method of discriminate regions is designed, and the discriminant is improved.
2.1. Analysis of the Two-Dimensional Straight Line of Bresenham’s Algorithm
A recursive step method is used in Bresenham’s algorithm [18]. The axis with the largest change is taken as the active direction and it progresses one grid at a time; the other direction is taken as the passive direction, along which whether to progress one grid is decided according to the sign of the discriminant, as shown in Figure 1.
2.2. Analysis of the Spatial Straight Line
From the starting to the ending points of the spatial straight line, the displacement of the three axes are generally different, but each axis will reach the corresponding end coordinates at the same time. The axis with the greatest distance from the beginning to the end of the straight line is the active direction and progresses a unit at a time; the other two axes are the passive directions and only progress at specific times to maintain their relative slopes (stop). The drawing speed and the precision of the straight line are directly determined by where and how long they will stop [19]. Therefore, the following spatial straight-line drawing algorithm is designed.
The starting point of spatial straight line is set as and the end point is ), where , , and . Therefore, the equation for the spatial straight line is:
(1)
As three-dimensional space has intrinsic symmetry [11], only the following types for spatial straight lines in which , and are all positive directions are discussed. Assume three-dimensional space consists of innumerable three-dimensional meshes; the side length of each grid is one pixel or one step angle. In this paper, three-dimensional space is regarded as a cube, and the six surfaces of the cube are, respectively, called: front surface, back surface, left surface, right surface, upper surface, and lower surface; each three-dimensional mesh is called a unit grid, the side length of unit grid is called a unit, and its length is L, in Figure 2.
Figure 2a shows the distribution types of straight lines in three-dimensional space; assume that the starting point of each straight line is at the origin, and the distribution of the straight line is determined by the end point. There are seven types, as shown in Figure 2a; by judging the relationship between the values of , , and , the position of the end point can be determined as follows:
(1). If , the straight line is type ①, as shown in Figure 2a, and the end point is on the right surface of the cube; this type of straight line corresponds to algorithm 1; is taken as the active direction and it progresses one grid at a time; and are taken as passive directions, along which whether to progress one grid is decided according to the sign of the discriminant;
(2). If , the straight line is type ②, as shown in Figure 2a, and the end point is on the vertex opposite to the origin; this type of straight line corresponds to algorithm 2; , and are taken as the active direction, and progress one grid at a time;
(3). If , the straight line is type ③, as shown in Figure 2a, and the end point is on the upper surface of the cube; this type of straight line corresponds to algorithm 3; is taken as the active direction and it progresses one grid at a time, and are taken as passive directions, along which whether to progress one grid is decided according to the sign of the discriminant;
(4). If , the straight line is type ④, as shown in Figure 2a, and the end point is on the front surface of the cube; this type of straight line corresponds to algorithm 4; is taken as the active direction and it progresses one grid at a time, and are taken as passive directions, along which whether to progress one grid is decided according to the sign of the discriminant;
(5). If , the straight line is type ⑤, as shown in Figure 2a, the end point is on the intersection line of the upper surface and the right surface of the cube; This type of straight line corresponds to algorithm 5; and are taken as the active direction, and they are progress one grid at a time, is taken as the passive direction along which whether to progress one grid is decided according to the sign of the discriminant;
(6). If , the straight line is type ⑥, as shown in Figure 2a, and the end point is on the intersection line of the upper surface and the front surface of the cube; this type of straight line corresponds to algorithm 6, and are taken as the active directions, and they progress one grid at a time; is taken as the passive direction, along which whether to progress one grid is decided according to the sign of the discriminant;
(7). If , the straight line is type ⑦, as shown in Figure 2a, and the end point is on the intersection line of the front surface and the right surface of the cube; this type of straight line corresponds to algorithm 7; and are taken as the active directions, and they progress one grid at a time; is taken as the passive direction, along which whether to progress one grid is decided according to the sign of the discriminant.
Seven types of straight lines correspond to seven algorithms. By judging the relationship of , , and , the position of the end of the straight line is determined, so as to determine the corresponding algorithm. The flow chart of this algorithm is shown in Figure 3.
2.3. Method of Discriminate Regions
The basic principle of all the above algorithms is the same, except for the variable (, , and ). The corresponding algorithm is determined by judging the relationship among , , and . As an example, this algorithm 1 is designed and discussed in this paper; and the method of discriminate regions is proposed.
Three-dimensional space is divided into innumerable three-dimensional meshes; one of the unit grid is taken, as shown in Figure 4a.
For case ①, the end point of the straight line is on the right surface of the cube, so the end point of all the straight lines in the unit grid is also on the right surface of the unit grid. Figure 4a shows a straight line in a unit grid, and the coordinate system here is the local coordinate system of each unit grid. Where is the selection point of point , the origin of the unit grid, and the starting point of the straight line in the unit grid. is the intersection of the theoretical straight line and the upper right surface of the unit grid; because the selection point of is an integer point, as shown in Figure 4a, the selection point of can only be one of A, B, C, D. Each time a point is selected, it will serve as the origin of the local coordinate system of the next unit grid and the starting point of the line in the next unit grid, where (. The right surface of the unit grid is divided into four regions (a, b, c, and d) by four lines (e, f, g and h); the corresponding selection points of each region are A, B, C, and D, respectively, as shown in Figure 4b. According to the discriminant, the location of point in the region is determined, and the selection point is chosen. The coordinates of the four points (A, B, C, and D) are, respectively, , , and ,where is the distance between the actual coordinate of point and , is the distance between the actual coordinate of point and , is the distance between the actual coordinate of point and , and is the distance between the actual coordinate of point and . The and coordinates are determined using Equation (1), as follows:
(2)
(3)
(4)
Then, the discriminant is obtained as:
(5)
2.4. Improved Discriminant
To simplify the discriminant in Equation (5), and being all multiplied by ; then, an improved discriminant is proposed:
(6)
because , and have the same sign, and and have the same sign. Therefore, we can decide which point to choose next from the signs of and . From Equation (6), the discriminant at is:(7)
Then, the recursive equations are obtained as:
(8)
As the starting point of the spatial straight line is , it is obtained that:
(9)
Considering Equation (6), the initial value of the discriminant is obtained as:
(10)
2.5. The Process of Discriminate Region
Considering the positive and negative signs of the above discriminants and , which region the point is in can be determined, and then which point of A, B, C, and D will be selected.
(1). If , the point is in region a; the point A will be selected at this point.
(2). If , the point is in region b; the point B will be selected at this point.
(3). If , the point is in region c; the point C will be selected at this point.
(4). If , the point is in region d; the point D will be selected at this point.
(5). If , the point is on segment e; the point A or B will be selected at this point.
(6). If , the point is on segment f; the point B or C will be selected at this point.
(7). If , the point is on segment g; the point A or D will be selected at this point.
(8). If , the point is on segment h; the point D or A will be selected at this point.
(9). If , the point is at central point o; the point A or B or C or D will be selected at this point.
Therefore, only the signs of and are needed to judge to determine the next selection point. Assuming that n steps are required from the starting point to ending point of the spatial straight line, the judging algorithm flow chart is given in Figure 5.
3. Algorithm Verification and Application
3.1. Algorithm Verification Based on Matlab
For the purpose of verification of the algorithm in this paper, it is assumed that the starting point of the spatial straight line is , 300 integers of 0–100 are randomly generated in MATLAB, and three numbers of them are a group of coordinates as the end point of a straight line; There are totally 100 groups, and one group of them is taken as an example, such as ; therefore, , , and .
From Equation (10), the initial value of the discriminants are and for . The above algorithm is used to draw the spatial straight lines, as shown in Figure 6.
In this case study, the end point coordinate for the -axis is eight, which required eight steps forward. Thus, the -axis progressed one unit at a time, and the actual x-axis value coincided with the theoretical value. The end points for the and -axis are six and five, respectively. Therefore, there are two steps without progression along the -axis, and there are three along the -axis. In Figure 6a, is the error of each step, and n steps needed totally for the straight-line, then:
(11)
In Figure 6b, the black dashed line is the actual generated spatial straight line, and the red dashed line is the theoretical Spatial straight line. The cylinder is the minimum inclusive region of the spatial straight-line straightness error [20], which is parallel to the theoretical straight line. All parts of the spatial straight line drawn by the algorithm are in the cylinder, whose diameter is the maximum error of the spatial straight line [21,22], and , all the results are shown in Figure 7.
Figure 7a–c, respectively, show the largest change of x-axis, y-axis, and z-axis in 100 groups of data and the local enlarged drawing, and B is the enlarged figure of A, where the black line is the x-axis, red line is the y-axis, and blue line is the z-axis.
3.2. Error Analysis
When the point is at the center O of the right surface of the unit grid, the distance from to any point of A, B, C, and D is the same , which is called the maximum theoretical error of the spatial straight line, as shown in Figure 8.
According to Figure 8, the maximum theoretical error . Where L is the side length of the unit grid, that is, the step length of each step of each axis—for example, in general industrial machine tools—L represents the moving distance of the actuator driven by a pulse of stepping motor. The step angle of the stepping motor is θ, subdivided is s; the pulse number of one turn of the stepping motor is ; and the screw pitch is p, then:
(12)
The stepper motor receives one pulse, and the lead screw movement distance L is
(13)
If , , , obtain:
, and the maximum theoretical error It can be seen that the value of L is related to the parameters of the stepping motor and the actuator, and the error distribution of each straight line is as shown in Figure 9.
Let L be 1, and in Figure 9, is the average value of error of each straight line in 100 straight lines; this reflects the concentration trend of error of each straight line. is the maximum value of which is 0.4119; here, the straight-line error is relatively large. is the minimum value of , which is 0.2469; here, the straight-line error is relatively small. is the average value of which is 0.3792; this reflects the concentration trend of errors of all straight lines. is the maximum error of each straight line in 100 straight lines, that is, the straightness error. is the maximum value of which is 0.7071; here, the straightness error is relatively large. is the minimum value of which is 0.7071; here, the straightness error is relatively small. is the average value of which is 0.6472; this reflects the concentration trend of the straightness error of the straight line. is the standard deviation of the error of each straight line in 100 straight lines; this reflects the measures of dispersion of each straight-line error. is the maximum value of which is 0.2250; here, the measures of dispersion are relatively large. is the maximum value of which is 0.1390; here, the measures of dispersion are relatively small. is the average value of which is 0.1534; this reflects the concentration trend of the measures of dispersion of all straight-line errors.
From the above results, all errors are less than or equal to the maximum theoretical error of 0.7071.
In addition, according to the algorithm provided by Liu [1], a random function in MATLAB to set several sets of samples including origin and target points is used. Then, Liu’s algorithm and our algorithm are all programmed in MATLAB to generate a straight line with the above-mentioned randomly generated origin and end points. In this way, the ideal line is drawn, and the actual line generated by these two different algorithms are obtained, respectively. Finally, the ideal curve and the actual curve generated by the two algorithms are drawn in one graph, as shown in Figure 10 (green and blue lines represent the results of retaining four and one decimal places, respectively, and the detailed explanation of Figure 10a is in the sixth paragraph of the fourth section).
A specific example is now given to explain the difference. As Liu’s paper shows: given that the two end-points of a straight-line segment are specified at positions (0, 0, 0) and (10, 7, 6), it follows that kyx = 0.7, and kzx = 0.6, then
ε(y1) = y1 − y0r − 0.5 = kyx − 0.5 = 0.2(14)
ε(z1) = z1− z0r − 0.5 = kzx − 0.5 = 0.1(15)
From the above two equations, it is possible to calculate the generated pixels and the decision parameters at each inter x position, starting from 0, 0, 0, as listed in Table 1. The error listed in the last column of the table is the distance between the generated pixel and the given line path at each inter x position.
Bringing this case into the algorithm in this article can obtain the data in Table 2.
In addition, the difference between the seventh and ninth steps of the two methods can be clearly seen below in Table 1, Table 2, and Figure 11. When step 9 is performed, the error is different, which can be seen from Table 1 and Table 2, respectively, and the error is sightly less than that in the literature.
3.3. Conversion of Unit Grid Number and Pulse Number
Step motor is an open-loop control motor which transforms electric pulse signal into angular displacement or linear displacement [23]. When a pulse is received, it will drive the step motor to rotate a fixed angle (step angle θ) according to the set direction. The algorithm in this paper can be used for controlling three stepping motors cooperatively. In the research of Dulf [24,25] et al., a new method for designing a fractional-order controller and a method for designing a DC motor speed control fractional-order PI controller are proposed, and the method is proved through an example analysis. The feasibility and superiority of the fractional-order controller can greatly reduce the overshoot and make its performance better than the traditional Kessler controller. Through specific experiments, its performance is evaluated and compared to other types of implementation possibilities. Three stepper motors control the -axis, -axis, and -axis, respectively; the three-dimensional space described in the algorithm is the working space of three stepping motors; and the unit is a pulse. , and are the number of pulses required to reach the target point for the motor, motor, and motor, respectively. The number of forward steps mentioned in this paper is the number of pulses required for the axis with the largest moving distance.
In industrial machine tools, the three coordinate axes are all driven by lead screw, and the lead screw pitch is mm. Three axes are set to move mm, mm, mm, respectively; then, the step motor turns a circle while lead screw moves mm(one pitch), and three motors rotate circle, circle, and circle, respectively, to reach the target point. The step angle of all three stepper motors is 1.8°, and the subdivision is 8. According to Equation (12), 1600 pulses are needed for one turn of the stepper motor. The number of pulses of the three stepper motors for reaching the target point are (1600 × ), (1600 × ), (1600 × ), respectively.
3.4. Algorithm Extension
The algorithm in this paper can be extended to five dimensions; assuming that the other two axes are A and B, respectively, the corresponding discriminant is H and K, respectively. According to Equation (8), the H and K are obtained:
(16)
Considering Equation (10), the initial value of the discriminant H and K are obtained as:
(17)
According to the above rules, when , , and when , . Therefore, the algorithm in this paper can be extended to five or more dimensions, which means that more motors can be controlled cooperatively by this algorithm in this paper.
4. Discussion
Matlab Simulation Discussion
The type ① is discussed as one example of the algorithm in this paper; that is, the end point of the straight line is on the right surface of the cube, and algorithm 1 is designed. The x axis is taken as the active direction, and progresses one unit at a time; y and z are taken as the passive direction; by judging the sign of discriminant and , which regions of the right surface of the unit grid the point is located in will be determined, and then whether or not to progress one unit will be determined. There are seven types of spatial line distribution; for the other six types, the end position of the straight line is different, and the variables (, , and ) are different, but the algorithm structure is the same: only the corresponding variables need to be exchanged. In addition, in this paper, the ,, and in the discriminant of the algorithm possess a proportion relation. For example, if , , and , the corresponding step size of 8000, and there is the greatest common factor (), that is 1000, then , , and ; the ,, and are taken as variables of discriminants; moreover, the discriminants are all integers. Therefore, the proposed algorithm could be simplified to calculate for drawing spatial straight lines. The 100 groups of data are randomly generated by MATLAB, and the algorithm is verified in this paper. It is proved that the algorithm is suitable for straight lines in any direction.
According to the algorithm verification results in Section 3, several sets of data generated by MATLAB are brought into the three-dimensional algorithm of Liu [1], and the results are shown in Figure 12.
It can be seen from the results of the comparison algorithm that this algorithm produced the same results as the algorithm in this paper; meanwhile, the same case is brought into Dai [2], in which also the same results occurred. It is noted that the selection points for the and -axis in the comparison algorithm are judged separately in the XY and XZ planes. In addition, the discriminant contains decimals in the reference algorithm; however, there are not the above two phenomena in the algorithm of this paper.
Because of the retention number of significant digits and the gradual accumulation of the discriminant the positive and negative signs of the discriminant may be changed, the selective point also may be altered. Furthermore, there is a greater deviation of the drawn straight line from the theoretical straight line, which increases the straightness error. In order to verify the possibility of the above problems, the discriminant of different decimal places (four, three, two, and one decimals) is calculated by the comparison algorithm, after testing; when the discriminant retains one decimal, the straight line will deviate from its ideal straight line, as shown in Figure 10a.
In the Figure 10a, B is enlarged pictures of A; the black and red lines represent the and -axis, respectively; green and blue lines represent the results of retaining four and one decimal places, respectively. It can be seen in the figure that the z-axis deviates from the theoretical straight line with the reserved one decimal place: at this time, the straightness error is greater than the maximum theoretical error of 0.7071. The z-axis oscillates on the theoretical straight line with the reserved four decimal places.
Additionally, the following conclusions have been reached through multiple verifications; the Liu [1] algorithm will not deviate from the theoretical line when more than two decimals are reserved, and may deviate from the theoretical line when one decimal is reserved.
In this paper, according to a given rule (such as a pixel or a step angle), three-dimensional space is divided into innumerable three-dimensional meshes, namely unit grids. The right surface of each unit grid is divided into four regions, and two discriminants are determined at the same time to determine the selection point. One point is selected each time: this point would be the origin of the coordinate system of the next unit grid, and also the starting point of the straight line in this unit grid. The discriminants of the algorithm in this paper are all integers; that the problem of deviation from the theoretical straight line caused by the retention of decimals of significant digits can be avoided. Some other literatures also proposed some new algorithms or related error analysis: they verify the effectiveness and advantages of the algorithm through comparison and analysis with other related literatures [26,27]. In this article, the effectiveness and advantages of our algorithm are shown through MATLAB simulation, comparison, and analysis with other related literature. There are still some shortcomings in this algorithm. A large number of samples are needed for comparative analysis to verify whether the computational efficiency of this algorithm is improved; at present, this algorithm is only suitable for the space straight line, and not for the space curve.
5. Conclusions
First, the Bresenham’s algorithm is extended to three-dimensional space in this paper. Bresenham algorithm is two-dimensional. To draw three-dimensional space straight lines, a novelty method of discriminate regions is proposed in this paper. Based on the discriminant, the selection points for each step will be provided. Only the coordinates of the starting and ending points of the spatial straight line are needed to be input in this algorithm, and the discriminants of the region can be quickly determined. All the discriminants are integers, making the calculations simple to quickly draw the spatial straight line; and the problem of deviation from the theoretical straight line caused by the retention of decimals of significant digits can be avoided. By analyzing the error of the straight line, the result shows that the error of the algorithm is related to the step length . The maximum theoretical error is , where . In addition, in this paper, the , , and in the discriminant of the algorithm possess a proportion relation, which could be replaced by the simplest integer. Moreover, the discriminants of this paper are all integers; therefore, the proposed algorithm in this paper could be used to calculate drawing both short and long straight lines more simply than the algorithm of decimals of other discriminants, while the accuracy is guaranteed. Meanwhile, the algorithm’s conversion application between unit grid number of algorithm and pulse of motors is performed, and the algorithm in this paper can be used for controlling three stepper motors cooperatively or be extended to five dimensions.
Author Contributions
Conceptualization, J.W.; methodology, S.X.; software, J.Y.; validation, S.X., J.Y.; formal analysis, S.X.; investigation, J.W., Y.L.; resources, Y.L.; data curation, S.X.; writing—original draft preparation, S.X.; writing—review and editing, P.B.; visualization, T.S.; supervision, Y.L., T.S.; project administration, Y.L.; funding acquisition, J.W. All authors have read and agreed to the published version of the manuscript.
Funding
This investigation is supported by the National Natural Science Foundation of China (31370999). (Information for disclosures can be taken from the online abstract system after entering all authors).
Conflicts of Interest
The authors declare no conflict of interest.
Figures and Tables
Figure 1. Schematic of Bresenham’s algorithm. Note: (xi+1−xi)>(yi+1−yi), so x is the active direction, y is passive direction.
Figure 2. Three-dimensional space. (a) Distribution types of straight lines in three-dimensional space. (b) Three-dimensional space meshing.
Figure 3. Flow chart for judging the distribution of straight lines in three-dimensional space.
Figure 4. Method of discriminate regions. (a) A straight line in a unit grid. (b) The position of the desire point in the plane.
Figure 6. Results of the spatial straight-line algorithm. (a) The motion process of each axis. (b) Spatial straight line and straightness error. Note: Figure 6a shows the motion process for each axis. The ordinate is the number of units, and the abscissa is the number of forward steps. The black, red, and blue lines represent the x, y, and z -axis. The solid line is the theoretical value, while the dashed line is the actual value.
Figure 7. The 100 groups of straight-line results. (a) The x-axis with the largest change. (b) The y -axis with the largest change. (c) The z -axis with the largest change.
Figure 8. The maximum theoretical error of a spatial straight line. (a) A straight line in a unit grid. (b) The position of the maximum theoretical error point in the plane.
Figure 10. The result of algorithm to generate straight lines. (a) Liu’s algorithm keeps one decimal place. (b) Algorithm in this article.
Figure 11. Differences between two different algorithms. (a) Line generation based on Liu’s algorithm (b) Line generation based on this article’s algorithm.
Figure 11. Differences between two different algorithms. (a) Line generation based on Liu’s algorithm (b) Line generation based on this article’s algorithm.
Figure 12. Results of the spatial straight-line algorithm. (a) The motion process of each axis. (b) Spatial straight line and straightness error.
Line generation based on Liu’s algorithm.
i | xi | yir | zir | ε(yi+1) | ε(zi+1) | Error |
---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0.2 | 0.1 | 0 |
1 | 1 | 1 | 1 | −0.1 | −0.3 | 0.374887 |
2 | 2 | 1 | 1 | 0.6 | 0.3 | 0.336918 |
3 | 3 | 2 | 2 | 0.3 | −0.1 | 0.220564 |
4 | 4 | 3 | 2 | 0 | 0.5 | 0.441129 |
5 | 5 | 4 | 3 | −0.3 | 0.1 | 0.428700 |
6 | 6 | 4 | 4 | 0.4 | −0.3 | 0.441129 |
7 | 7 | 5 | 4 | 0.1 | 0.3 | 0.225064 |
8 | 8 | 6 | 5 | −0.2 | 0.1 | 0.336918 |
9 | 9 | 6 | 5 | 0.5 | 0.5 | 0.374887 |
10 | 10 | 7 | 6 | 0.2 | 0.1 | 0 |
Line generation based on this article’s algorithm.
i | xi | yi | zi | Mi | Ni | Error |
---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 | 4 | 2 | 0.374887 |
2 | 2 | 1 | 1 | −2 | −6 | 0.336918 |
3 | 3 | 2 | 2 | 12 | 6 | 0.220564 |
4 | 4 | 3 | 2 | 6 | −2 | 0.441129 |
5 | 5 | 4 | 3 | 0 | 18 | 0.428700 |
6 | 6 | 4 | 4 | −6 | 10 | 0.441129 |
7 | 7 | 5 | 5 | 8 | 2 | 0.220564 |
8 | 8 | 6 | 5 | 2 | −6 | 0.336918 |
9 | 9 | 6 | 6 | −4 | 6 | 0.334534 |
10 | 10 | 7 | 6 | 10 | −2 | 0 |
You have requested "on-the-fly" machine translation of selected content from our databases. This functionality is provided solely for your convenience and is in no way intended to replace human translation. Show full disclaimer
Neither ProQuest nor its licensors make any representations or warranties with respect to the translations. The translations are automatically generated "AS IS" and "AS AVAILABLE" and are not retained in our systems. PROQUEST AND ITS LICENSORS SPECIFICALLY DISCLAIM ANY AND ALL EXPRESS OR IMPLIED WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES FOR AVAILABILITY, ACCURACY, TIMELINESS, COMPLETENESS, NON-INFRINGMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Your use of the translations is subject to all use restrictions contained in your Electronic Products License Agreement and by using the translation functionality you agree to forgo any and all claims against ProQuest or its licensors for your use of the translation functionality and any output derived there from. Hide full disclaimer
© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/). Notwithstanding the ProQuest Terms and Conditions, you may use this content in accordance with the terms of the License.
Abstract
A novelty algorithm of spatial straight-line drawing based on a method of discriminate regions is proposed in this paper based on Bresenham’s algorithm. Three-dimensional space is divided into innumerable three-dimensional meshes according to the given rule; the distance between the start and the end points of the three coordinates is Δx, Δy, and Δz, respectively; the distribution types of spatial straight line and the position of the end point are determined by judging the relationship among Δx, Δy, and Δz; then, the active-passive directions can be determined. The plane of the ending point of the straight line in a three-dimensional mesh is divided into four regions; then, the discriminant is obtained; and this discriminant determine which region the point is located in The algorithm is verified and analyzed by the method of contrastive analysis; the results show that: the error of the algorithm is related to the step length L; the maximum theoretical error is 0.7071*L. The discriminants are all integers, so the problem of deviation from the theoretical straight line caused by the retention of decimals of significant digits can be avoided. Finally, the algorithm is applied to the cooperative control of multiple motors, and conversion between unit grid number and pulse number of motors is performed.
You have requested "on-the-fly" machine translation of selected content from our databases. This functionality is provided solely for your convenience and is in no way intended to replace human translation. Show full disclaimer
Neither ProQuest nor its licensors make any representations or warranties with respect to the translations. The translations are automatically generated "AS IS" and "AS AVAILABLE" and are not retained in our systems. PROQUEST AND ITS LICENSORS SPECIFICALLY DISCLAIM ANY AND ALL EXPRESS OR IMPLIED WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES FOR AVAILABILITY, ACCURACY, TIMELINESS, COMPLETENESS, NON-INFRINGMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Your use of the translations is subject to all use restrictions contained in your Electronic Products License Agreement and by using the translation functionality you agree to forgo any and all claims against ProQuest or its licensors for your use of the translation functionality and any output derived there from. Hide full disclaimer
Details

1 School of Mechanical and Power Engineering, Henan Polytechnic University, Jiaozuo 454000, China;
2 State Grid Jiaozuo Power Supply Company, Jiaozuo 454000, China;