跳转到内容

用户:Maatflow/Midpoint circle algorithm

维基百科,自由的百科全书
以 Bresenham 中点圆算法栅格化一个半径为 23 的圆。只有绿色的八分之一圆真正的被计算了,但镜射后的结果产生了剩下的八分之七。
以 Bresenham 中点圆算法画出的一个半径为 23 的圆。

在电脑图形学中,中点圆算法是一个用来决定栅格化时所需点的算法。 这个算法可以推导出布雷森汉姆画圆算法。这个算法可以被推广到圆锥曲线[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.

外部链接

[编辑]

[[Category:带有C代码示例的条目]] [[Category:數位幾何學]]

  1. ^ Donald Hearn; M. Pauline Baker. Computer graphics. Prentice-Hall. 1994. ISBN 978-0-13-161530-4.