Clipping Lines Dr Scott Schaefer Why Clip n
- Slides: 94
Clipping Lines Dr. Scott Schaefer
Why Clip? n We do not want to waste time drawing objects that are outside of viewing window (or clipping window) 2/94
Clipping Points n Given a point (x, y) and clipping window (xmin, ymin), (xmax, ymax), determine if the point should be drawn (xmax, ymax) (x, y) (xmin, ymin) 3/94
Clipping Points n Given a point (x, y) and clipping window (xmin, ymin), (xmax, ymax), determine if the point should be drawn (xmax, ymax) (x, y) (xmin, ymin) xmin<=x<=xmax? ymin<=y<=ymax? 4/94
Clipping Points n Given a point (x, y) and clipping window (xmin, ymin), (xmax, ymax), determine if the point should be drawn (xmax, ymax) (x 1, y 1) (xmin, ymin) (x 2, y 2) xmin<=x<=xmax? ymin<=y<=ymax? 5/94
Clipping Points n Given a point (x, y) and clipping window (xmin, ymin), (xmax, ymax), determine if the point should be drawn (xmax, ymax) (x 1, y 1) (xmin, ymin) (x 2, y 2) xmin<=x 1<=xmax Yes ymin<=y 1<=ymax Yes 6/94
Clipping Points n Given a point (x, y) and clipping window (xmin, ymin), (xmax, ymax), determine if the point should be drawn (xmax, ymax) (x 1, y 1) (xmin, ymin) (x 2, y 2) xmin<=x 2<=xmax No ymin<=y 2<=ymax Yes 7/94
Clipping Lines 8/94
Clipping Lines 9/94
Clipping Lines n Given a line with end-points (x 0, y 0), (x 1, y 1) and clipping window (xmin, ymin), (xmax, ymax), determine if line should be drawn and clipped end-points of line to draw. (xmax, ymax) (x 1, y 1) (x 0, y 0) (xmin, ymin) 10/94
Clipping Lines 11/94
Clipping Lines – Simple Algorithm If both end-points inside rectangle, draw line n Otherwise, intersect line with all edges of rectangle clip that point and repeat test n 12/94
Clipping Lines – Simple Algorithm 13/94
Clipping Lines – Simple Algorithm 14/94
Clipping Lines – Simple Algorithm 15/94
Clipping Lines – Simple Algorithm 16/94
Clipping Lines – Simple Algorithm 17/94
Clipping Lines – Simple Algorithm 18/94
Clipping Lines – Simple Algorithm 19/94
Clipping Lines – Simple Algorithm 20/94
Clipping Lines – Simple Algorithm 21/94
Clipping Lines – Simple Algorithm 22/94
Clipping Lines – Simple Algorithm 23/94
Window Intersection (x 1, y 1), (x 2, y 2) intersect with vertical edge at xright t yintersect = y 1 + m(xright – x 1) where m=(y 2 -y 1)/(x 2 -x 1) (x 1, y 1), (x 2, y 2) intersect with horizontal edge at ybottom t xintersect = x 1 + (ybottom – y 1)/m where m=(y 2 -y 1)/(x 2 -x 1) 24/94
Clipping Lines – Simple Algorithm Lots of intersection tests makes algorithm expensive n Complicated tests to determine if intersecting rectangle n n Is there a better way? 25/94
Trivial Accepts Big Optimization: trivial accepts/rejects n How can we quickly decide whether line segment is entirely inside window n Answer: test both endpoints n 26/94
Trivial Accepts Big Optimization: trivial accepts/rejects n How can we quickly decide whether line segment is entirely inside window n Answer: test both endpoints n 27/94
Trivial Rejects How can we know a line is outside of the window n Answer: both endpoints on wrong side of same edge, can trivially reject the line n 28/94
Trivial Rejects How can we know a line is outside of the window n Answer: both endpoints on wrong side of same edge, can trivially reject the line n 29/94
Cohen-Sutherland Algorithm Classify p 0, p 1 using region codes c 0, c 1 n If , trivially reject n If , trivially accept n Otherwise reduce to trivial cases by splitting into two segments n 30/94
Cohen-Sutherland Algorithm Every end point is assigned to a four-digit binary value, i. e. Region code n Each bit position indicates whether the point is inside or outside of a specific window edge n bit 4 bit 3 bit 2 bit 1 top bottom right left 31/94
Cohen-Sutherland Algorithm 32/94
Cohen-Sutherland Algorithm Classify p 0, p 1 using region codes c 0, c 1 n If , trivially reject n If , trivially accept n Otherwise reduce to trivial cases by splitting into two segments n 33/94
Cohen-Sutherland Algorithm Classify p 0, p 1 using region codes c 0, c 1 n If , trivially reject n If , trivially accept n Otherwise reduce to trivial cases by splitting into two segments n 34/94
Cohen-Sutherland Algorithm Classify p 0, p 1 using region codes c 0, c 1 n If , trivially reject n If , trivially accept n Otherwise reduce to trivial cases by splitting into two segments n Line is outside the window! reject 35/94
Cohen-Sutherland Algorithm Classify p 0, p 1 using region codes c 0, c 1 n If , trivially reject n If , trivially accept n Otherwise reduce to trivial cases by splitting into two segments n Line is inside the window! draw 36/94
Cohen-Sutherland Algorithm Classify p 0, p 1 using region codes c 0, c 1 n If , trivially reject n If , trivially accept n Otherwise reduce to trivial cases by splitting into two segments n 37/94
Cohen-Sutherland Algorithm 38/94
Cohen-Sutherland Algorithm 39/94
Cohen-Sutherland Algorithm 40/94
Cohen-Sutherland Algorithm 41/94
Cohen-Sutherland Algorithm 42/94
Cohen-Sutherland Algorithm 43/94
Cohen-Sutherland Algorithm 44/94
Cohen-Sutherland Algorithm 45/94
Cohen-Sutherland Algorithm 46/94
Cohen-Sutherland Algorithm 47/94
Cohen-Sutherland Algorithm 48/94
Cohen-Sutherland Algorithm 49/94
Cohen-Sutherland Algorithm 50/94
Cohen-Sutherland Algorithm 51/94
Cohen-Sutherland Algorithm 52/94
Liang-Barsky Algorithm Uses parametric form of line for clipping n Lines are oriented Classify lines as moving inside to out or outside to in n Don’t find actual intersection points Find parameter values on line to draw n 53/94
Liang-Barsky Algorithm Initialize interval to [tmin, tmax]=[0, 1] n For each boundary u Find parametric intersection t with boundary u If moving in to out, tmax = min(tmax, t) u else tmin = max(tmin, t) u If tmin>tmax, reject line n 54/94
Intersecting Two Parametric Lines 55/94
Intersecting Two Parametric Lines 56/94
Intersecting Two Parametric Lines 57/94
Intersecting Two Parametric Lines 58/94
Intersecting Two Parametric Lines 59/94
Intersecting Two Parametric Lines Substitute t or s back into equation to find intersection 60/94
Liang-Barsky: Classifying Lines 61/94
Liang-Barsky: Classifying Lines 62/94
Liang-Barsky: Classifying Lines 63/94
Liang-Barsky: Classifying Lines 64/94
Liang-Barsky: Classifying Lines 65/94
Liang-Barsky: Classifying Lines 66/94
Liang-Barsky: Classifying Lines 67/94
Liang-Barsky: Classifying Lines 68/94
Liang-Barsky Algorithm 69/94
Liang-Barsky Algorithm 70/94
Liang-Barsky Algorithm 71/94
Liang-Barsky Algorithm 72/94
Liang-Barsky Algorithm 73/94
Liang-Barsky Algorithm 74/94
Liang-Barsky Algorithm 75/94
Liang-Barsky Algorithm 76/94
Liang-Barsky Algorithm 77/94
Liang-Barsky Algorithm 78/94
Liang-Barsky Algorithm 79/94
Liang-Barsky Algorithm 80/94
Liang-Barsky Algorithm 81/94
Liang-Barsky Algorithm 82/94
Liang-Barsky Algorithm 83/94
Liang-Barsky Algorithm 84/94
Liang-Barsky Algorithm 85/94
Liang-Barsky Algorithm 86/94
Liang-Barsky Algorithm 87/94
Liang-Barsky Algorithm 88/94
Liang-Barsky Algorithm 89/94
Liang-Barsky Algorithm 90/94
Liang-Barsky Algorithm 91/94
Liang-Barsky Algorithm 92/94
Comparison n Cohen-Sutherland Repeated clipping is expensive u Best used when trivial acceptance and rejection is possible for most lines u n Liang-Barsky Computation of t-intersections is cheap (only one division) u Computation of (x, y) clip points is only done once u Algorithm doesn’t consider trivial accepts/rejects u Best when many lines must be clipped u 93/94
Line Clipping – Considerations Just clipping end-points does not produce the correct results inside the window n Must also update sum in midpoint algorithm n n Clipping against non-rectangular polygons is also possible but seldom used 94/94
- Scott schaefer tamu
- Scott schaefer tamu
- Hey bye bye
- Moos and schaefer 1984 crisis theory
- Schaefer model
- Beistrichsetzung
- Ernst schaefer md
- Analyse
- Moo
- Piero della francesca
- Michael nagel rechtsanwalt
- Worksheet 1-1 points lines and planes
- Don't ask why why why
- In two dimensional viewing we have?
- Clipping algorithm
- Who is clipping
- Whats a bound morpheme
- Nicholl-lee-nicholl line clipping
- Back formation examples
- Computer graphics chapter 1 ppt
- Edge table in computer graphics
- Point clipping in computer graphics
- Algoritma cohen sutherland
- Cliping adalah
- Ywmin
- Recap intensity clipping
- Bezier clipping
- Westlaw video clipping
- Hidden surface removal
- Flood fill algorithm in computer graphics
- Blackout compounding or blending
- Viewport clipping in computer graphics
- Ear clipping algorithm
- 4 types of clipping
- Vertical edge
- Line clipping
- نردشير meaning in english
- Cohen sutherland line clipping algorithm solved example
- Text clipping in computer graphics
- Word formation process coinage
- English clipped words
- Steer clipping and fitting techniques
- Clipping
- Clipping and culling
- Curve clipping in computer graphics
- Disadvantages of suspension therapy in physiotherapy
- Ocular adjustment function
- Boston resolution clip
- Clip clop don't stop
- Atri clip
- Atrial clip procedure
- Mathswatch clip 150 answers
- A pistol with a clip fed mechanism
- Evaluation clip art
- Watch the video and answer the question.
- Date
- Reiteration method in theodolite surveying
- Old crime scene
- Weight of paperclip
- Luke 6 27 38
- Cara menyisipkan clip art
- Cinema clip art
- Premiere android
- Shrek vimeo
- Ioki clip
- What animal is at the top of the food chain
- Find the area of the shape below mathswatch
- Jessica ve muhammed
- On which playing card is the cardmaker's trademark
- Fipa clip
- Clip art microsoft word 2013
- Judicial branch clip art
- Introductions clip art
- Rt6939 datasheet
- Extinction clip art
- Chanson gobelet clip
- Vido clip
- Class 5 avalanche
- Rule the waves
- Rotc timeline
- Braylin
- Watch the video and answer the questions
- Thai singer clip
- The paperclip challenge
- Microsoft exchange onpremises mitigation
- Mark 3: 20-35
- Ionizing radiation
- Dini clip
- Gigaset quicksync mac download
- Credits clip art
- Renaldo and nasreen build an electromagnet
- Westward expansion clip art
- Lesson plan clip art
- Efmd clip
- Clip art word