Curve clipping
-
Upload
mohamed-el-serngawy -
Category
Education
-
view
8.086 -
download
4
Transcript of Curve clipping
![Page 1: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/1.jpg)
Curve clipping
![Page 2: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/2.jpg)
• The bounding rectangle for a curved object can be used first to test for overlap with a rectangular clip window (we can use polygon clipping) XMAX , Y MAXXMIN , Y MAX
XMAX , Y MIN
XMIN , Y MIN
Object
![Page 3: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/3.jpg)
Case 1• If the bounding rectangle for the object is completely
inside the window, we save the object.
Clipping window
Bounding rectangle
![Page 4: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/4.jpg)
Case 2• If the rectangle is determined to be completely
outside the window, we discard the object
Object
![Page 5: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/5.jpg)
Case 3
• If the two regions overlap, we will need to solve the simultaneous line-curve equations to obtain the clipping intersection points.
![Page 6: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/6.jpg)
• finding intersection points by solving the curve and boundary equations simultaneously sometimes takes a long time.
•We have to consider special curves as circles and ellipses before solving the equations simultaneously.
![Page 7: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/7.jpg)
Circle clipping
Xc+RX LEFT
-If XC + R < XLEFT Then the circle is discarded .-No need for bounding triangle
xc
Clipping window
![Page 8: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/8.jpg)
Circle clipping cont..
If XC - R > Xright Then the circle is discarded
X right Xc -R XC
R
![Page 9: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/9.jpg)
Circle clipping cont..
Y top
Yc -R If YC - R >Ytop Then the circle is discarded
Clipping window
![Page 10: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/10.jpg)
Circle clipping cont..
Y bottom
Yc + R
If YC +R <Ybottom Then the circle is discarded
![Page 11: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/11.jpg)
Circle clippingcont..
If all the four previous conditions are false then the circle is saved
![Page 12: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/12.jpg)
Circle clipping cont..
Intersection conditions: With right edge:Xc+R>Xright
With left edge:Xc-R<Xleft
With top edge :Yc+R>Ytop
With bottom edge:Yc-R<Ybottom
![Page 13: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/13.jpg)
Circle clipping cont..
Getting intersection points :Example : The intersection with the right edge
α Start (angle=0)
First intersection angle=α
Second intersection
α
X rightXc
1- Simply Cos α = Xright-Xc /R2- Get α
3- y=R sin α
4- the segment from angle 0 to angle α is discarded
5- the segment from angle α to angle 360-α is considered
6- the segment from angle 360-α to angle 360 is considered
![Page 14: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/14.jpg)
Other techniques
• Clip individual point : for point plotted curves , may consume time if
number of points is great.• Curves approximated to poly lines: clip individual line segments , if segment is not small
enough no accurate result , if it is small more than enough , it will be time consuming for linear segments
![Page 15: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/15.jpg)
A Spline Curve : Any Composite curve formed with polynomial sections satisfying specified continuity conditions at the boundary of the pieces.
Spline curve : definition
![Page 16: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/16.jpg)
Specifying Splines
![Page 17: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/17.jpg)
Example : Third order spline
• In order to assure C1 continuity at two extremities, our functions must be of at least degree 3
![Page 18: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/18.jpg)
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005
18
Convex Hull Property
• Bezier curves lie in the convex hull of their control points
• Hence, even though we do not interpolate all the data, we cannot be too far away
p0
p1 p2
p3
convex hull
Bezier curve
![Page 19: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/19.jpg)
Bézier Clipping
00t
( )p t
0 0Find the root of polynomial ( ) within [ , ]p t
0
![Page 20: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/20.jpg)
Bézier Clipping
00t
( )p t
Polynomial ( ) in Bezier formp t
0
![Page 21: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/21.jpg)
Bézier Clipping
0 00t
( )p t
Convex hull reconstruction
![Page 22: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/22.jpg)
Bézier Clipping
0 00t
( )p t
Intersect convex hull with -axist
![Page 23: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/23.jpg)
Bézier Clipping
110
t
( )p t
1 1The new interval [ , ]
![Page 24: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/24.jpg)
The Approximated Roots
• A sequence of intervals that bound the root of p
• If the width of interval is smaller than the given tolerance, return the root (interval).
0 0 1 1[ , ] [ , ] [ , ]n n
![Page 25: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/25.jpg)
Convergence Rates
• A sequence of intervals that converge to the root:
• How fast does the sequence converge?
0 0 1 1[ , ] [ , ] [ , ]n n
( )i i ih
1 ~ ?i ih h
1i ih C h
![Page 26: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/26.jpg)
2. Quadratic Clipping
![Page 27: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/27.jpg)
Quadratic Clipping
• Idea– Use quadratic bounds
• Motivation– To improve the convergence rate
![Page 28: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/28.jpg)
Quadratic Bounds
Upper bound
Lower bound
![Page 29: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/29.jpg)
Quadratic Bounds
• But, how to compute the quadratic bounds efficiently?
![Page 30: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/30.jpg)
Quadratic Bounds
• Approximated quadratic bounds
Upper bound
Lower bound
Best quadratic approximant
![Page 31: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/31.jpg)
Quadratic Clipping
0 00t
( )p t
0 0Find the root of polynomial ( ) within [ , ]p t
![Page 32: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/32.jpg)
Quadratic Clipping
00t
( )p t
Polynomial ( ) in Bezier formp t
0
![Page 33: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/33.jpg)
Quadratic Clipping
00t
( )p t
The best quadratic approximant of q p
0q
0
![Page 34: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/34.jpg)
Quadratic Clipping
00t
( )p t
0 0Bounding quadratic functions and M m
0
0q
0m
0M
![Page 35: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/35.jpg)
Quadratic Clipping
00t
( )p t
0 0Intersect and with -axisM m t
0
0q
0m
0M
![Page 36: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/36.jpg)
Quadratic Clipping
0t
2nd iteration
( )p t
1q
11
![Page 37: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/37.jpg)
Quadratic Clipping
0t
2nd iteration
( )p t
1q
11
1M
1m
![Page 38: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/38.jpg)
Quadratic Clipping
0t
3rd iteration
( )p t
22
![Page 39: Curve clipping](https://reader033.fdocuments.in/reader033/viewer/2022061503/55509755b4c9058b208b46ce/html5/thumbnails/39.jpg)
The Approximated Root
• A sequence of intervals that bound the root of p
• If the width of interval is smaller than the given tolerance, return the root (interval).
0 0 1 1[ , ] [ , ] [ , ]n n