Clipping - I N T R O D U C T I O N T O C O M P U T E R G R...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1st, 2009 2D Clipping 1/16 Clipping I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1st, 2009 2D Clipping 2/16 Clipping Chapter 13, Section 10 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1st, 2009 2D Clipping 3/16 Line Clipping • Clipping endpoints x min < x < x max and y min < y < y max point inside • Endpoint analysis for lines: – if both endpoints in , do “trivial acceptance” – if one endpoint inside, one outside, must clip – if both endpoints out, don’t know • Brute force clip: solve simultaneous equations using y = mx + b for line and four clip edges – slope-intercept formula handles infinite lines only – doesn’t handle vertical lines (X min , Y min ) (X max , Y max ) I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1st, 2009 2D Clipping 4/16 Parametric Line Formulation For Clipping • Parametric form for line segment X = x + t(x 1 – x ) 0 < t < 1 Y = y + t(y 1 – y ) P(t) = P + t(P 1 – P ) • “true,” i.e., interior intersection, if s edge and t line in [0,1] I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1st, 2009 2D Clipping 5/16 • Divide plane into 9 regions • Compute the sign bit of 4 comparisons between a vertex and an edge – y max – y; y – y min ; x max – x; x - x min – point lies inside only if all for sign bits are 0, otherwise exceeds edge • 4 bit outcode records results of four bounds tests: First bit : outside halfplane of top edge, above top edge Second bit : outside halfplane of bottom edge, below bottom edge Third bit : outside halfplane of right edge, to right of right edge Fourth bit : outside halfplane of left edge, to left of left edge • Lines with OC = 0 and OC 1 = 0 can be trivially accepted • Lines lying entirely in a half plane outside an edge can be trivially rejected : OC AND OC 1 ≠ 0 (i.e., they share an “outside” bit) Outcodes for Cohen-Sutherland Line Clipping in 2D Clip Rectangle I N T R O D U C T I O N T O C O M P U T E R G R A P H I C...
View Full Document

This note was uploaded on 10/23/2009 for the course PPT cs taught by Professor Nil during the Spring '09 term at Indian School of Business.

Page1 / 16

Clipping - I N T R O D U C T I O N T O C O M P U T E R G R...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online