Download presentation
Presentation is loading. Please wait.
Published bySherilyn George Modified over 5 years ago
1
Type to enter a caption. Computer Graphics Week 2 Lecture 1
2
Circle Drawing ALGORITHM
3
Basics Cartesian Equation: x2+y2=r2 or f(x,y)= x2+y2-r2 = 0
In terms of trigonometric functions: x=r sin θ y=r cos θ for 00<=θ<3600
4
Basics F(x1,y1) = x12+y12-r2 = 0 → Point lies on the circle
F(x2,y2) = x22+y22-r2 > 0 → Point lies outside the circle F(x3,y3) = x32+y32-r2 < 0 → Point lies inside the circle
5
8 Way Symmetry In circle if we just draw points in one octant we can get points in rest of the octants by suitable reflections
6
8 Way Symmetry
7
Bresenham Algorithm We will calculate in just 2nd octant
Assume starting pixel P is on y-axis To find next pixel , see if M is inside or outside of circle if d <=0 choose E , else choose SE deltaE = 2xp + 3 deltaSE =2(xp-yp)+5
8
dstart In start xp=0 and yp=R (radius)
f(M) = f(xp+1, yp - 1/2) = f(0+1,R-1/2) = dstart dstart = 1-R
9
Pseudo Code
10
Filling Rectangles for (ymin to ymax) for (xmin to xmas)
WritePixel(x,y,value) ymax ymin xmin xmax
11
Pattern Filling
12
Line Styles Define the line style as a 16-bit , bit string
if(bitstring[i%16]) WritePixel(x,y,value);
13
Thickening Primitives
3 techniques are used: Replicating Pixels Moving Pen Filling area between 2 boundaries
14
Replicating Pixels
15
Moving Pen
16
Filling Area b/w Boundaries
17
The End
19
Slide 1
20
Text
21
TEXT [TEXT]
22
Text
23
Text –Johnny Appleseed
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.