Graphics Reference
In-Depth Information
This table shows that the sign of |E D |-|E R | always agrees with the sign of the auxili-
ary variable
GE DR
=+.
Furthermore, G can also be computed incrementally. Let G R and G D denote the values
of G after an R-move or D-move, respectively. If G cur is the current G value, then
GG
=
-
46
x
(2.4)
R
cur
and
GG
=
-
4
xy
+
4
-
10.
(2.5)
D
cur
It is easy to derive formulas (2.4) and (2.5). We prove formula (2.4) for G R in case we
move right. Recall that
(
)
EE
=
-
21
2121
2
x
+
,
R
cur
(
) +-
(
)
E
=
E
-
x
+
y
,
and
D
cur
(
) +-
(
)
GEEE
=+=
-+
4
x
2
2
y
1
.
cur
D
R
cur
On an R-move,
(
)
EE x
newE
=
-
21
211
21121
+
,
new
cur
[
(
) +
]
=
E
-
x
+
,
R
new
[
(
) +
] +-
(
)
newE
=
E
-
x
+
y
,
and
D
new
G
=
newE
+
newE
R
D
R
(
) -+
(
)
=
2
E
-
4
x
+
2
2
2
y
-
1
new
(
) -+
(
) -+
(
)
=
2
E
-
2 2
x
+
1
4
x
2
2
2
y
-
1
cur
=
G
-
4
x - 6.
cur
The other cases are proved in a similar fashion.
Finally, going one step further, the increments to G R and G D themselves can be
computed incrementally, producing an improved Algorithm 2.9.2.2. It can be shown
that the algorithm produces a best-fit curve for the circle when either the radius r or
its square is an integer, but that may not be the case if one tries the same approach
when r 2 is not an integer.
See [Blin87] for a more complete overview of circle drawing algorithms. For a
version of the midpoint line-drawing algorithm that works for circles see [VanN85].
2.9.3
Drawing Ellipses and Other Conics
The equation for the standard ellipse centered at the origin is
2
2
x
a
y
b
+=,
1
(2.6)
2
2
Search WWH ::




Custom Search