用户:Maatflow/Midpoint circle algorithm
外观
![](http://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/Midpoint_circle_algorithm_animation_%28radius_23%29.gif/295px-Midpoint_circle_algorithm_animation_%28radius_23%29.gif)
![](http://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Midpoint_circle_algorithm%2C_radius_23.png/220px-Midpoint_circle_algorithm%2C_radius_23.png)
在电脑图形学中,中点圆算法是一个用来决定栅格化时所需点的算法。 这个算法可以推导出布雷森汉姆画圆算法。这个算法可以被推广到圆锥曲线。[1]
这个算法被视为与 Pitteway 和 Van Aken 的贡献有关。
总览
[编辑]这个算法同时画出一个圆的八个部分,从四个基本方位开始(0°, 90°, 180°, 270°) 各往两边延展四十五度。 在所画方位达到四十五度时,我们可以发现相对圆心于的(x, y)中 x与y绝对值相同而停下。从上图中可以看出使用这些角度的原因: 在x座标增加时,所画的跳过任何一个 x 值, The reason for using these angles is shown in the above picture: As x increases, it does not skip nor repeat any x value until reaching 45°. So during the while loop, x increments by 1 each iteration, and y decrements by 1 on occasion, never exceeding 1 in one iteration. This changes at 45° because that is the point where the tangent is rise=run. Whereas rise>run before and rise<run after.
外部链接
[编辑]- Drawing circles - An article on drawing circles, that derives from a simple scheme to an efficient one
- Midpoint Circle Algorithm in several programming languages
[[Category:带有C代码示例的条目]] [[Category:數位幾何學]]
- ^ Donald Hearn; M. Pauline Baker. Computer graphics. Prentice-Hall. 1994. ISBN 978-0-13-161530-4.