Upload
mohamed-el-serngawy
View
9.283
Download
0
Embed Size (px)
DESCRIPTION
Explain Circle Clipping
Citation preview
Circle & Curve Clipping Algorithm
Presented By : Mohamed El-Serngawy
OutlineFast Circle Clipping AlgorithmClipping Circle By Accept/Reject
Test
Fast Circle Clipping Algorithm
Introduction:
Fast Circle Clipping Algorithm
Algorithm
Fast Circle Clipping Algorithm
Algorithm
Fast Circle Clipping Algorithm
Algorithm
Fast Circle Clipping AlgorithmAlgorithm
Fast Circle Clipping AlgorithmAlgorithm
Clipping Circle By Accept/Reject Test
1-Scan Conversion of Circles 2-Write Points(x,y)3-Clipping Circles
Midpoint Circle Algorithm),( pp yxP E
SE
M
Choose E as the next pixel if M lies inside the circle, and SE otherwise.
d =d<0: Select E
dnew = d + (2xp+3)
d>0: Select SEdnew = d + (2xp–2yp+5)
22
2
2
1)1(
2
1,1 RyxyxF
xp xp+1
Midpoint Circle Algorithm
Start with P (x = 0, y = r). Compute d for the first midpoint at (1, r - ½): d = F(1, r - ½) = 5/4 - r
While (x < y) {
If (d <= 0) // E is chosen d = d + 2 * x + 3
Else // SE is chosen y = y – 1 d = d + 2 * x – 2 * y + 5x = x+1; WritePixel (x, y)
}
Write Points(x,y)Writes pixels to the seven other
octants
Clipping Circles
Accept/Reject test
– Does bounding box of
the circle intersect with clipping box? If yes, condition pixel
write on clipping box inside/outside test
Also we can test Circle points by Point
Clipping .
-the point P=(x, y) is display in clipping
Boundry if xmin < x < xmax and ymin < y < ymax
Curve ClippingAreas with curved boundaries can be clipped with methods similar to those
discussed
in the previous .sections. Curve-clipping procedures will involve nonlinear
equations, however, and this requires more processing than for objects with
linear boundaries.
The bounding rectangle for a circle or other curved object can be used first
to test for overlap with a rectangular clip window. If the bounding rectangle for
the object is completely inside the window, we save the object. If the rectangle is
determined to be completely outside the window, we discard the object. In either
case, there is no further computation necessary. But if the bounding rectangle test
fails, we can look for other computation-saving approaches. For a circle, we can
use the coordinate extents of individual quadrants and then octants for preliminary
testing before calculating curve-window intersections. For an ellipse, we can
test the coordinate extents of individual quadrants. Figure blew illustrates circle
clipping against a rectangular window.
Curve ClippingSimilar procedures can be applied when clipping
a curved object against a general polygon clip region.
On the first pass, we can clip the bounding rectangle
of the object against the bounding rectangle of the clip
region.
If the two regions overlap, we will need to solve the
simultaneous line-curve equations to obtain
the clipping intersection points.