Spatial Straight-Line Drawing Algorithm Based on Method of Discriminate Regions—A Control Algorithm of Motors
Abstract
:1. Introduction
2. Space Line Drawing Algorithm
2.1. Analysis of the Two-Dimensional Straight Line of Bresenham’s Algorithm
2.2. Analysis of the Spatial Straight Line
- (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.
2.3. Method of Discriminate Regions
2.4. Improved Discriminant
2.5. The Process of Discriminate Region
- (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.
3. Algorithm Verification and Application
3.1. Algorithm Verification Based on Matlab
3.2. Error Analysis
3.3. Conversion of Unit Grid Number and Pulse Number
3.4. Algorithm Extension
4. Discussion
Matlab Simulation Discussion
5. Conclusions
Author Contributions
Funding
Conflicts of Interest
References
- Liu, X.W.; Cheng, K. Three-dimensional extension of Bresenham’s algorithm and its application in straight-line interpolation. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf. 2002, 216, 459–463. [Google Scholar]
- Dai, M.; Chen, Y.; Zheng, C.; Yiming, G. Design of multistep stepper motor coordinated control system based on bresenham algorithm. In Proceedings of the 2017 24th International Conference on Mechatronics and Machine Vision in Practice (M2VIP), Auckland, New Zealand, 21–23 November 2017. [Google Scholar]
- Chen, Z.; Shen, Z.; Guo, J.; Cao, J.; Zeng, X. Line drawing for 3D printing. Comput. Graph. 2017, 66, 85–92. [Google Scholar]
- Meng, Q.; Geng, G.; Zhang, J. A line drawing method of the 3D models based on partial sharpening. In Proceedings of the 2012 International Conference on Image Analysis and Signal Processing, Zhejiang, China, 9–11 November 2012; pp. 9–11. [Google Scholar]
- Guo, T.; Wang, Y.; Zhou, Y.; He, Z.; Tang, Z. Geometric object 3D reconstruction from single line drawing image with Bottom-Up and Top-Down classification and sketch generation. In Proceedings of the 2017 14th IAPR International Conference on Document Analysis and Recognition (ICDAR), Kyoto, Japan, 9–15 November 2017; pp. 670–676. [Google Scholar]
- Skala, V. An intersecting modification to the bresenham algorithm. Comput. Graph. Forum 1987, 6, 343–347. [Google Scholar]
- Bresenham, J.E. Algorithm for computer control of a digital plotter. IBM Syst. J. 1965, 4, 25–30. [Google Scholar]
- Nguyen, D.T. A rotation method for binary document images using DDA algorithm. ACM Symp. Doc. Eng. 2008, 267–270. [Google Scholar] [CrossRef]
- Govil-Pai, S. Principles of Computer Graphics: Theory and Practice Using OpenGL and Maya, 1st ed.; Springer: Berlin/Heidelberg, Germany, 2010. [Google Scholar]
- Cieśliński, J.L.; Moroz, L.V.; Walczyk, C.J. Fast exact digital differential analyzer for circle generation. Appl. Math. Comput. 2015, 271, 68–79. [Google Scholar]
- Lau, W.-C.; Erramilli, A.; Wang, J.; Willinger, W. Self-similar traffic generation: The random midpoint displacement algorithm and its properties. In Proceedings of the IEEE International Conference on Communications, Seattle, WA, USA, 6 August 2002. [Google Scholar]
- Jilesen, J.; Kuo, J.; Lien, F.-S. Three-dimensional midpoint displacement algorithm for the generation of fractal porous media. Comput. Geosci. 2012, 46, 164–173. [Google Scholar]
- Garcia-Falset, J.; Marino, G.; Zaccone, R. An explicit midpoint algorithm in Banach spaces. J. Nonlinear Convex Anal. 2017, 18, 1933–1952. [Google Scholar]
- Au, C.; Woo, T. Three dimensional extension of Bresenham’s Algorithm with Voronoi diagram. Comput. Des. 2011, 43, 417–426. [Google Scholar]
- Stephenson, P.; Litow, B. Running the line: Line drawing using runs and runs of runs. Comput. Graph. 2001, 25, 681–690. [Google Scholar]
- Li, X.; Shao, X. Fast line drawing algorithm by circular subtraction based on Bresenham. In Proceedings of the SPIE—The International Society for Optical Engineering, Bellingham, WA, USA, 13 January 2012; Volume 8349, p. 20. [Google Scholar]
- Muresan, C.; Copot, C.; Birs, I.; De Keyser, R.; Vanlanduit, S.; Ionescu, C.M. Experimental Validation of a Novel Auto-Tuning Method for a Fractional Order PI Controller on an UR10 Robot. Algorithms 2018, 11, 95. [Google Scholar] [CrossRef] [Green Version]
- Pitteway, M.L.V.; Watkinson, D.J. Bresenham’s algorithm with Grey scale. Commun. ACM 1980, 23, 625–626. [Google Scholar] [CrossRef]
- Labatut, V. Continuous average straightness in spatial graphs. J. Complex Netw. 2017, 6, 269–296. [Google Scholar] [CrossRef] [Green Version]
- Zhang, Q.; Fan, K.-C.; Li, Z. Evaluation method for spatial straightness errors based on minimum zone condition. Precis. Eng. 1999, 23, 264–272. [Google Scholar] [CrossRef]
- Endrias, D.H.; Feng, H.-Y.; Ma, J.; Wang, L.; Abu Taher, M. A combinatorial optimization approach for evaluating minimum-zone spatial straightness errors. Measurement 2012, 45, 1170–1179. [Google Scholar] [CrossRef]
- Wen, X.; Song, A. An improved genetic algorithm for planar and spatial straightness error evaluation. Int. J. Mach. Tools Manuf. 2003, 43, 1157–1162. [Google Scholar] [CrossRef]
- Li, J.; Meng, D. Dynamic and Adjustable New Pattern Four-Vector SVPWM Algorithm for Application in a Five-Phase Induction Motor. Energies 2020, 13, 1856. [Google Scholar] [CrossRef]
- Dulf, E.-H.; Susca, M.; Kovács, L. Novel Optimum Magnitude Based Fractional Order Controller Design Method. IFAC-PapersOnLine 2018, 51, 912–917. [Google Scholar] [CrossRef]
- Muresan, C.I.; Folea, S.; Mois, G.; Dulf, E. Development and implementation of an FPGA based fractional order controller for a DC motor. Mechatronics 2013, 23, 798–804. [Google Scholar] [CrossRef]
- Hassan, T.-U.; Abbassi, R.; Jerbi, H.; Mehmood, K.; Tahir, M.F.; Cheema, K.M.; Elavarasan, R.M.; Ali, F.; Khan, I. A Novel Algorithm for MPPT of an Isolated PV System Using Push Pull Converter with Fuzzy Logic Controller. Energies 2020, 13, 4007. [Google Scholar] [CrossRef]
- Du, L.; Ma, Q.; Ben, J.; Wang, R.; Li, J. Duality and Dimensionality Reduction Discrete Line Generation Algorithm for a Triangular Grid. ISPRS Int. J. Geo-Inf. 2018, 7, 391. [Google Scholar] [CrossRef] [Green Version]
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 |
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 |
© 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/).
Share and Cite
Wang, J.; Xiao, S.; Song, T.; Yue, J.; Bian, P.; Li, Y. Spatial Straight-Line Drawing Algorithm Based on Method of Discriminate Regions—A Control Algorithm of Motors. Energies 2020, 13, 5002. https://doi.org/10.3390/en13195002
Wang J, Xiao S, Song T, Yue J, Bian P, Li Y. Spatial Straight-Line Drawing Algorithm Based on Method of Discriminate Regions—A Control Algorithm of Motors. Energies. 2020; 13(19):5002. https://doi.org/10.3390/en13195002
Chicago/Turabian StyleWang, Jianping, Shiguang Xiao, Tao Song, Junqi Yue, Pingyan Bian, and Yu Li. 2020. "Spatial Straight-Line Drawing Algorithm Based on Method of Discriminate Regions—A Control Algorithm of Motors" Energies 13, no. 19: 5002. https://doi.org/10.3390/en13195002
APA StyleWang, J., Xiao, S., Song, T., Yue, J., Bian, P., & Li, Y. (2020). Spatial Straight-Line Drawing Algorithm Based on Method of Discriminate Regions—A Control Algorithm of Motors. Energies, 13(19), 5002. https://doi.org/10.3390/en13195002