CG-Part2 PPSX
CG-Part2 PPSX
CG-Part2 PPSX
P0 = 2 y - x …….. ( 3.14 )
Pk = ∆X (d1 – d2)
= ∆X (2 m(Xk + 1) - 2 Yk +2b – 1 )
= ∆X (2mXk + 2m - 2 Yk +2b – 1 )
= ∆X (2(mX0 + b - Y0 ) +2m – 1 )
= ∆X (2 ∆Y / ∆X – 1)
P0 = 2 ∆y - ∆X [decision parameter]
Bresenham's Line Algorithm :
Bresenham's Line Algorithm :
Circle-Generating Algorithms:
Circle-Generating Algorithms:
Circle-Generating Algorithms:
But this is not the best method for generating a circle. One
problem with this approach is that it involves considerable
computation at each step. Moreover, the spacing between
plotted pixel positions is not uniform, as demonstrated in
Fig. 3-13. We could adjust the spacing by interchanging x and y
(stepping through y values and calculating x values) whenever
the absolute value of the slope of the circle is greater than 1.
But this simply increases the computation and processing
required by the algorithm.
Another way to eliminate the unequal spacing shown in
Fig. 3-13 is to calculate points along the circular boundary
using polar coordinates r and (Fig.3-12). Expressing the circle
equation in parametric polar form yields the pair of equations
Circle-Generating Algorithms:
Now,
Pk +1 – Pk = [(Xk +2)2 + (Yk+1 – ½)2 – r2 ] – [(Xk+1)2 + (Yk – ½)2 – r2]
= Pk + 2(Xk +1) + 1
Pk +1 = Pk + 2Xk + 3
Now if Pk ≥ 0 then mid point is on the circle boundary or outside the circle boundary. So select
lower pixel. i.e.Yk-1
Pk +1 = Pk + 2(Xk – Yk ) + 5
The initial decision parameter is obtained by evaluating the
circle function at the start position ( x0,y0) = (0,r).
First decision parameter coordinate at (0,r)
P0 = fcircle( 1, r – ½ )
P0 = (0 + 1)2 + (r – ½ )2 –r2
P0 = 5/4 – r
P0 = 1 – r …(6)
Midpoint Circle Algorithm:
Midpoint Circle Algorithm:
Midpoint Circle Algorithm:
Midpoint Circle Algorithm:
Midpoint Circle Algorithm:
Character Generation:
Typefaces (or fonts) can be divided into two broad groups: serif
and sans serif. Serif type has small lines or accents at the ends
of the main character strokes, while sans-serif type does not
have accents. For example, the text in this book is set in a serif
font (Palatino). But this sentence is printed in a sans-serif font
(Optima).
Serif type is generally more readable; that is, it is easier to read
in longer blocks of text. On the other hand, the individual
characters in sans-serif type are easier to recognize. For this
reason, sans-serif type is said to be more legible. Since sans-
serif characters can be quickly recognized, this typeface is
good for labeling and short headings.
Character Generation:
Here, we consider only those attributes that control the basic display
properties of primitives, without regard for special situations. For
example, lines can be dotted or dashed, fat or thin, and blue or
orange. Areas might be filled with one color or with a multicolor
pattern. Text can appear reading from left to right, slanted diagonally
across the screen, or in vertical columns. Individual characters can be
displayed in different fonts, colors, and sizes. And we can apply
intensity variations at the edges of objects to smooth out the raster
stairstep effect.
Attributes of Output Primitives