Two Dimensional Viewing

Similar documents
What and Why Transformations?

Today s class. Geometric objects and transformations. Informationsteknologi. Wednesday, November 7, 2007 Computer Graphics - Class 5 1

Chap 7, 2009 Spring Yeong Gil Shin

Image Warping : Computational Photography Alexei Efros, CMU, Fall Some slides from Steve Seitz

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

UNIT 2 2D TRANSFORMATIONS

4. Two Dimensional Transformations

Image Warping. Some slides from Steve Seitz

[ ] [ ] Orthogonal Transformation of Cartesian Coordinates in 2D & 3D. φ = cos 1 1/ φ = tan 1 [ 2 /1]

CS F-07 Objects in 2D 1

Unit 3 Transformations and Clipping

Modeling Transformations

3-Dimensional Viewing

Editing and Transformation

CS770/870 Spring 2017 Transformations

CS Computer Graphics: Transformations & The Synthetic Camera

GRAPHICS OUTPUT PRIMITIVES

Chap 7, 2008 Spring Yeong Gil Shin

1. We ll look at: Types of geometrical transformation. Vector and matrix representations

Interactive Computer Graphics. Warping and morphing. Warping and Morphing. Warping and Morphing. Lecture 14+15: Warping and Morphing. What is.

Computer Graphics. Modelling in 2D. 2D primitives. Lines and Polylines. OpenGL polygon primitives. Special polygons

Part 3: 2D Transformation

The 3-D Graphics Rendering Pipeline

Three-Dimensional Viewing Hearn & Baker Chapter 7

Modeling Transformations

Computer Graphics. Geometric Transformations

Computer Graphics. Geometric Transformations

OUTPUT PRIMITIVES. CEng 477 Introduction to Computer Graphics METU, 2007

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

Image Warping. Some slides from Steve Seitz

Computer Graphics Viewing Objective

3D Geometry and Camera Calibration

Scene Graphs & Modeling Transformations COS 426

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

3D graphics rendering pipeline (1) 3D graphics rendering pipeline (3) 3D graphics rendering pipeline (2) 8/29/11

Lines and Their Slopes

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

Glossary alternate interior angles absolute value function Example alternate exterior angles Example angle of rotation Example

Modeling Transformations Revisited

2D transformations and homogeneous coordinates

CS 450: COMPUTER GRAPHICS REVIEW: CLIPPING SPRING 2015 DR. MICHAEL J. REALE

Graphics Output Primitives

3D Coordinates & Transformations

Reteaching Golden Ratio

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

Double Integrals in Polar Coordinates

Name Class Date. subtract 3 from each side. w 5z z 5 2 w p - 9 = = 15 + k = 10m. 10. n =

EXPANDING THE CALCULUS HORIZON. Robotics

Homogeneous Coordinates

Graphs and Functions

Image Warping (Szeliski Sec 2.1.2)

UNIT 2. Translation/ Scaling/ Rotation. Unit-02/Lecture-01

Image Warping. Many slides from Alyosha Efros + Steve Seitz. Photo by Sean Carroll

is a plane curve and the equations are parametric equations for the curve, with parameter t.

Matrix Transformations. Affine Transformations

Computer Graphics 7: Viewing in 3-D

Must first specify the type of projection desired. When use parallel projections? For technical drawings, etc. Specify the viewing parameters

CS559: Computer Graphics

Clipping Points Consider a clip window which is rectangular in shape. P(x, y) is a point to be displayed.

Transformations II. Week 2, Wed Jan 17

Graphing Equations Case 1: The graph of x = a, where a is a constant, is a vertical line. Examples a) Graph: x = x

REMARKS. 8.2 Graphs of Quadratic Functions. A Graph of y = ax 2 + bx + c, where a > 0

Answers to practice questions for Midterm 1

Two-Dimensional Viewing. Chapter 6

Image Metamorphosis By Affine Transformations

Computer Graphics: Two Dimensional Viewing

Perspective Projection Transformation

Uses of Transformations. 2D transformations Homogeneous coordinates. Transformations. Transformations. Transformations. Transformations and matrices

2D and 3D Transformations AUI Course Denbigh Starkey

9 3 Rotations 9 4 Symmetry

CPSC 314, Midterm Exam 1. 9 Feb 2007

CPSC 314, Midterm Exam. 8 March 2010

CS 335 Graphics and Multimedia. Geometric Warping

Graphics and Interaction Transformation geometry and homogeneous coordinates

PARAMETRIC EQUATIONS AND POLAR COORDINATES

Beecher J.A, Penna J.A., Bittinger M.L. Algebra and Trigonometry (3ed, Addison Wesley, 2007) 58 Chapter 1 Graphs, Functions, and Models

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Modeling Transformations

Part IV. 2D Clipping

Examples. Clipping. The Rendering Pipeline. View Frustum. Normalization. How it is done. Types of operations. Removing what is not seen on the screen

To graph the point (r, θ), simply go out r units along the initial ray, then rotate through the angle θ. The point (1, 5π 6. ) is graphed below:

CSE328 Fundamentals of Computer Graphics: Theory, Algorithms, and Applications

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

8.6 Three-Dimensional Cartesian Coordinate System

CSE528 Computer Graphics: Theory, Algorithms, and Applications

(x, y) (ρ, θ) ρ θ. Polar Coordinates. Cartesian Coordinates

Transformations. Examples of transformations: shear. scaling

UNIT NUMBER 5.2. GEOMETRY 2 (The straight line) A.J.Hobson

Think About. Unit 5 Lesson 3. Investigation. This Situation. Name: a Where do you think the origin of a coordinate system was placed in creating this

CSE528 Computer Graphics: Theory, Algorithms, and Applications

= = The number system. Module. Glossary Math Tools... 33

Transformations using matrices

5.8.3 Oblique Projections

Trigonometry Review Day 1

angle The figure formed by two lines with a common endpoint called a vertex. angle bisector The line that divides an angle into two equal parts.

GEOMETRIC TRANSFORMATIONS AND VIEWING

CS 325 Computer Graphics

Last Time. Correct Transparent Shadow. Does Ray Tracing Simulate Physics? Does Ray Tracing Simulate Physics? Refraction and the Lifeguard Problem

Transcription:

Two Dimensional Viewing Dr. S.M. Malaek Assistant: M. Younesi

Two Dimensional Viewing Basic Interactive Programming

Basic Interactive Programming User controls contents, structure, and appearance of objects and their displaed images via rapid visual feedback.

Model Model: a pattern, plan, representation, or description designed to show the structure or working of an object, sstem, or concept.

Modeling Modeling is the process of creating, storing and manipulating a model of an object or a sstem.

Modeling In Modeling, we often use a geometric model i.e.. A description of an object that provides a numerical description of its shape, size and various other properties. Dimensions of the object are usuall given in units appropriate to the object: meters for a ship kilometres for a countr

Modeling The shape of the object is often described in terms of sub-parts, such as circles, lines, polgons, or cubes. Eample: Model of a house units are in meters 9 6 6

Instances of Objects Instances of this object ma then be placed in various positions in a scene, or world, scaled to different sizes, rotated, or deformed. Each house is created with instances of the same model, but with different parameters. 9 6

2D Viewing

2D Viewing Viewing is the process of drawing a view of a model on a 2-dimensional displa.

2D Viewing The geometric description of the object or scene provided b the model, is converted into a set of graphical primitives, which are displaed where desired on a 2D displa. The same abstract model ma be viewed in man different was: e.g. farawa, near, looking down, looking up

Real World Coordinates It is logical to use dimensions which are appropriate to the object e.g. meters for buildings nanometers or microns for molecules, cells, atoms light ears for astronom The objects are described with respect to their actual phsical size in the real world, and then mapped onto screen co-ordinates. It is therefore possible to view an object at various sizes b zooming in and out, without actuall having to change the model.

2D Viewing How much of the model should be drawn? Where should it appear on the displa? How do we convert Real-world coordinates into screen co-ordinates? We could have a model of a whole room, full of objects such as chairs, tablets and students. We ma want to view the whole room in one go, or zoom in on one single object in the room. We ma want to displa the object or scene on the full screen, or we ma onl want to displa it on a portion of the screen.

2D Viewing Once a model has been constructed, the programmer can specif a view. A 2-Dimensional view consists of two rectangles: A Window, given in real-world co-ordinates, which defines the portion of the model that is to be drawn A Viewport given in screen co-ordinates, which defines the portion of the screen on which the contents of the window will be displaed

Basic Interactive Programming Window: What is to be viewed Viewport: Where is to be displaed Viewport Scene Image

Coordinate Representations

Coordinate Representations General graphics packages are designed to be used with Cartesian coordinate specifications. Several different Cartesian reference frame are used to construct and displa a scene.

Coordinate Representations Modeling coordinates: We can construct the shape of individual objects in a scene within separate coordinate reference frames called modeling (local) coordinates.

Coordinate Representations World coordinates: Once individual object shapes have been specified, we can place the objects into appropriate positions within the scene using reference frame called world coordinate.

Coordinate Representations Device Coordinates: Finall, the world coordinates description of the scene is transferred to one or more output-device reference frames for displa, called device (screen) coordinates.

Coordinate Representations Normalized Coordinates: A graphic sstem first converts world coordinate positions to normalized device coordinates, in the range to.this makes the sstem independent of the output-devices.

Coordinate Representations Modeling coordinates: We can construct the shape of individual objects in a scene within separate coordinate reference frames called modeling (local) coordinates. ( ma, ma )

Coordinate Representations An initial modeling coordinate position is transferred to a device coordinate position with the sequence: ( mc, mc) ( wc, wc ) ( nc, nc ) ( dc, dc ) The modeling and world coordinate positions in this transformation can be an floating values; normalized coordinates satisf the inequalities: nc nc The device coordinates are integers within the range (,) to for a particular output device. ( ma, ) ma

The Viewing Pipeline

The Viewing Pipeline A world coordinate area selected for displa is called window. An area on a displa device to which a window is mapped a viewport. Windows and viewports are rectangular in standard position.

The Viewing Pipeline The mapping of a part of a world coordinate scene to device coordinate is referred to as viewing transformation or window-toviewport transformation or windowing transformation. Viewport window-to-viewport transformation

The Viewing Pipeline. Construct the scene in world coordinate using the output primitives. 2. Obtain a particular orientation for the window b set up a two dimensional viewing coordinate sstem in the world coordinate, and define a window in the viewing coordinate sstem. Transform descriptions in world coordinates to viewing coordinates (clipping).

The Viewing Pipeline 3. Define a viewport in normalized coordinate, and map the viewing coordinate description of the scene to normalized coordinate 4. (All parts lie outside the viewport are clipped), and contents of the viewport are transferred to device coordinates. Viewing Coordinate Normalized Coordinate Device Coordinate

The Viewing Pipeline

The Viewing Pipeline B Changing the position of the viewport, we can view objects at different position on the displa area of an output device.

The Viewing Pipeline B varing the size of viewport, we can change the size of displaed objects (zooming).

2D Geometric Transformations

2D Geometric Transformations Operations that are applied to the geometric description of an object to change its position, orientation or size. Basic transformation: Translation Rotation Scaling

2D Translation 2D Translation: Move a point along a straight-line path to its new location. P P T t t + +, + t t T P P +

2D Tranlation Rigid-bod translation: moves objects without deformation (ever point of the object is translated b the same amount) t 2 t 3 Y 6 5 4 4 4 3 2 2 2 3 4 5 6 7 8 9 Note: House shifts position relative to origin X

2D Rotation 2D Rotation: Rotate the points a specified rotation angle about the rotation ais. Ais is perpendicular to plane; specif onl rotation point (pivot point r, )) ( r r θ r

2D Rotation r, r Simplif: rotate around origin: r cos( φ + θ ) r cos φ cos θ r sin φ sin r sin( φ + θ ) r cos φ sin θ + r sin φ cos r cosφ, r sin φ cos θ sin θ sin θ + cos θ θ θ r θ ( ', ') r (, ) R cosθ sinθ P R sin θ cosθ P φ

2D Rotation Rotation of a point about an arbitrar pivot position: r + ( r )cosθ ( r )sinθ + ( )sinθ + ( )cosθ r r The matri epression could be modified to include pivot coordinates b matri addition of a column vector whose elements contain the additive (translational) term. r

2D Rotation Rigid-bod translation: Rotates objects without deformation (ever point of the object is rotated through the same angle. Y 6 5 4 3 2 π θ 6 θ 2 3 4 5 6 7 8 9 X

2D Scaling 2D Scaling: Alters the size of an object. This operation can be carried out for polgons b multipling the coordinate values (, ) of each verte b scaling factors s and s to produce the transformed coordinates s s 2

2D Scaling 2 s s s s, s s P S P

2D Scaling An positive numeric values can be assigned to the scaling factors. Values less than reduce the size of objects, and greater than produce an enlargement. Uniform Scaling: Differential Scaling: applications. s s s s, used in modeling s s s s original Uniform scaling Differential scaling

2D Scaling Scale an object moving its origin (upper right)

2D Scaling We can control the location of a scaled object b choosing a position, called fies point Fies point can be chosen as one of the vertices, the object centroid, or an other position ), ( f f f f s + ) ( ' f f s + ) ( ' ) ( ' f s s + ) ( ' f s s +

2D Scaling The matri epression could be modified to include fied coordinates. Note: House shifts position relative to origin Y X 2 2 3 4 5 6 7 8 9 3 4 5 6 2 3 2 6 2 9 2 3 s s ) ( ' f s s + ) ( ' f s s +

Matri Representations And Homogeneous Coordinates

Matri Representations In Modeling, we perform sequences of geometric transformation: translation, rotation, and scaling to model components into their proper positions. How the matri representations can be reformulated so that transformation sequences can be efficientl processed?

Matri Representations We have seen: ) ( ' f s s + ) ( ' f s s + )cosθ ( )sinθ ( )sinθ ( )cosθ ( r r r r r r + + + The basic transformations can be epressed in the general matri form: M 2 P M P + Rotation: Scaling:

Matri Representations P M P + M 2 M is a 2 2 arra containing multiplicative factors. M 2 is a two element column matri containing translation terms. Translation: M is the identit matri. Rotation: M 2 contains the translation terms associated with the pivot point. Scaling: M 2 contains the translation terms associated with the fied point.

Matri Representations P M P + M 2 To produce a sequence of transformations, we must calculate the transformed coordinates one step at a time. We need to eliminate the matri addition associated with the translation terms in M 2.

Matri Representations We can combine the multiplicative and translation terms for 2D transformation into a single matri representation b epanding 2 2 matri to 3 3 matri.

Matri Representations and Homogeneous Coordinate Homogeneous Coordinate: To epress an 2D transformation as a matri multiplication, we represent each Cartesian coordinate position (,) with the homogeneous Coordinate triple ( h, h,h): h, h Simpl: h h h

h Matri Representations and Homogeneous Coordinate (X,Y,h)

Matri Representations and Homogeneous Coordinate Epressing position in homogeneous Coordinates, (,,) allows us to represent all geometric transformation as matri multiplication

Matri Representations and Homogeneous Coordinate Basic 2D transformations as 33 matrices: t t s s cos sin sin cos θ θ θ θ Translation Translation Rotation Rotation Scaling Scaling

Composite Transformation

Composite Transformation Combined transformations B matri multiplication Efficienc with pre-multiplication ))) ( ( ( p S R T p p S R T p ) ( w s s θ θ θ θ - t t w cos sin sin cos p ) ( t, t T ) (θ R ) ( s, s S p

General Pivot Point Rotation

General Pivot Point Rotation θ θ θ θ θ + θ θ θ θ θ θ θ sin ) cos ( cos sin sin ) cos ( sin cos cos sin sin cos r r r r r r r r ( ) ( ) ( ) ( ) θ θ,,,, r r r r r r R T R T Translation Rotation Translation ( r, r ) ( r, r ) ( r, r ) ( r, r )

General Fied Point Scaling

General Fied Point Scaling ) ( ) ( r r r r r r s s s s s s ( ) ( ) ( ) ( ) r r r r r r s s s s,,,,,, S T S T Translation Scaling Translation ( r, r ) ( r, r ) ( r, r ) ( r, r )

General Scaling Direction

General Scaling Direction + + θ cos θ sin )cosθsinθ ( )cosθsinθ ( θ sin θ cos (θ) ), ( (θ) 2 2 2 2 2 2 2 2 2 s s s s s s s s s S s R R

Reflection

Reflection Reflection: Produces a mirror image of an object. X Ais Y Ais Origin 2 2 3 3 2 3 3 2 3 3 2 2 X Ais Y Ais Origin

Reflection Reflection with respect to a line We can drive this matri b : Clockwise rotation of 45º Reflection about the ais Counterclockwise rotation of 45º 2 3 2 3

Reflection Reflection with respect to a line - - Reflection with respect to a line m+b:. Translate the line so that it passes through the origin. 2. Rotate the onto one of the coordinate aes 3. Reflect about that ais 4. Inverse rotation 5. Inverse translation

Shear

Shear Shear: A transformation that distorts the shape of an object such that transformed shape appears as if the object were composed of internal laers that had been caused to slide over each other is called a shear.

Shear -direction: ' + h, ' h (,) (,) h 2 (,) (,) (2,) (,) (,) (3,) -direction: ', ' + h h (,) (,) (,) (,) h 2 (,) (,) (,3) (,2)

Shear -direction shears relative to a reference line ( ), ' + h ' ref h h ref (,) (,) h.5 ref - (,) (2,) (,) (,) (.5,) (.5,) ref ref ref -direction shears relative to a reference line ', ' h + h h ( ) ref ref (,) (,) (,) (,) ref h.5 ref - (,.5) (,.5) ref ref (,2) (,)

Transformations Between Coordinates Sstems

Transformations Between Coordinates Sstems It is often requires the transformation of object description from one coordinate sstem to another. How do we transform between two Cartesian coordinate sstems?

Transformations Between Coordinates Sstems Rule: Transform one coordinate frames towards the other in the opposite direction of the representation change.

Transformations Between Coordinates Two Steps: Sstems. Translate so that the origin (, ) of the sstem is moved to the origin of the sstem. 2. Rotate the ais onto the ais.

Transformations Between Coordinates Sstems ), ( T cosθ sinθ sinθ cosθ θ) R( ), ( θ) ( T R M

Transformations Between Coordinates Sstems Alternative Method: Assume (u,,u ) and (v,v ) in the (,) coordinate sstems: v v u u M P MP T R M

Transformations Between Coordinates Eample: Sstems If V(-,) then the ais is in the positive direction and the rotation transformation matri is: R

Transformations Between Coordinates Sstems In an interactive application, it ma be more convenient to choose the direction for V relative to position P than it is to specif it relative to the coordinate origin. v P P P - P

Viewing Coordinate Reference Frame

Viewing Coordinate Reference Frame This coordinate sstem provides the reference frame for specifing the world coordinate window.

Viewing Coordinate Reference Frame Set up the viewing coordinate:. Origin is selected at some world position: (, ) 2. Established the orientation. Specif a world vector V that defines the viewing direction. 3. Obtain the matri for converting world to viewing coordinates (Translate and rotate) M WC,VC R T P

Window to Viewport Coordinate Transformation

Window to Viewport Coordinate Transformation Select the viewport in normalized coordinate, and then object description transferred to normalized device coordinate. To maintain the same relative placement in the viewport as in the window: v v vma v v v v v ma min min min min w w w ma w ma w w min w min min w min

Window to Viewport Coordinate v v vma v v v v v ma min min min min v v Transformation w w w ma w v ma v w w min min min w min min w min + ( w + ( w w w. Perform a scaling transformation that scales the window area to the size of the viewport. 2. Translate the scaled window area to the position of the vieport. s s min min ) s v w ) s v w ma ma ma ma v w v w min min min min

Clipping

Clipping

Clipping Clipping Algorithm or Clipping: An procedure that identifies those portion of a picture that are either inside or outside of a specified region of space. The region against which an object is to clipped is called a clip window.

Point Clipping

w2 Point Clipping w w min min w w ma ma (, ) w w w2

Line Clipping

Line Clipping Possible relationship between line position and a standard clipping region. Before Clipping After Clipping

Line Clipping A line clipping procedure involves several parts:. Determine whether line lies completel inside the clipping window. 2. Determine whether line lies completel outside the clipping window. 3. Perform intersection calculation with one or more clipping boundaries.

Line Clipping A line with both endpoints inside all clipping boundaries is saved ( ) P 3 P 4 Before Clipping After Clipping

Line Clipping A line with both endpoints outside all clipping boundaries is reject ( & PP ) 9 PP 2 Before Clipping After Clipping

If one or both endpoints outside the clipping rectangular, the parametric representation could be used to determine values of parameter u for intersection with the clipping boundar coordinates. Before Clipping After Clipping + + ) ( ) ( 2 2 u u u

Line Clipping. If the value of u is outside the range to : The line dose not enter the interior of the window at that boundar. 2. If the value of u is within the range to, the line segment does cross into the clipping area. Clipping line segments with these parametric tests requires a good deal of computation, and faster approaches to clipper are possible.

Cohen Sutherland Line Clipping

Cohen Sutherland Line Clipping The method speeds up the processing of line segments b performing initial tests that reduce the number of intersections that must be calculated.

Cohen Sutherland Line Clipping Ever line endpoint is assigned a four digit binar code, called region code region code, that identifies the location of the point relative to the boundaries of the clipping rectangle.

Each bit position in the region code is used to indicate one of the four relative coordinate positions of the point with respect to the clip window. Bit : Left Bit 2: Right Bit 3: Below Bit 4: Above

Bit values in the region code are determined b comparing endpoint coordinates values (,) to the clip boundaries. Bit is set to if < w min Bit : sign( w ) min Bit 2: Bit 3: Bit 4: sign( w ) ma sign( wmin ) sign ( wma )

Once we have established region codes for all line endpoints, we can quickl determine lines are completel outside or inside the clip window.

Once we have established region codes for all line endpoints, we can quickl determine lines are completel outside or inside the clip window.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Lines that cannot be identified as completel inside or outside a clip window are checked for intersection with boundaries.

Cohen Sutherland Line Clipping Intersection points with a clipping boundar can be calculated using the slope-intercept form of the line equation. m ( ) ( 2 2 + m( ) + m ) w w w w min ma min ma

Liang barsk Clipping

LiangbarskClipping:Faster line clippers, that are based on analsis of the parametric of a line segment: Liang barsk Clipping + + u u u 2 2

Liang barsk Clipping When we traverse along the etended line with u increasing from to, we first move from the outside to the inside of the clipping window s two boundar lines (bottom and left) Then move from the inside to the outside of the other two boundar lines (top and right)

u 2 Liang barsk Clipping u Ma, u, u ) u u Min(, u t, u ) ( b 2 r u l : intersection the window s left u b : intersection the window s bottom u l : intersection the window s right u r : intersection the window s top

Liang barsk Clipping Point (,) inside the clipping window w w min min + u + u w w ma ma Rewrite the four inequalities as: up k q k, k,2,3,4 p p p p 2 3 4,,,, q q q q 2 3 4 w w ma ma min min ( left) ( right) ( bottom) ( top)

If, the line is parallel to the boundar: if q k < the line is completel outside (can be eliminated) if the line is completel inside (need further consideration) q k p p p p p k 2 3 4, q, q, q, q 2 3 4 w w ma ma ( left ) ( right ) ( bottom ) ( top ) If p k < the etended line proceeds from the outside to the inside. If p k > the etended line proceeds from the inside to the outside. When, u corresponding to the intersection point is q k p k p k min min

A four step process for finding the visible portion of the line:. If pk and q k < for an k, eliminate the line and stop, Otherwise proceed to the net step. 2. For all k such that p k <, calculate. Let be k k k the maimum of the set containing and the calculated r values. Liang barsk Clipping p p p p 2 3 4,,,, q q q q 2 3 4 r q p u w w ma ma min min ( left) ( right) ( bottom) ( top)

A four step process 3. For all k such that pk >, calculate r k qk p. Let u k 2 be the minimum of the set containing and the calculated r values. u > Liang barsk Clipping 4. If u 2, eliminate the line since it is completel outside the clipping window, Otherwise, use and to calculate the endpoints of the clipped line. p, q min ( left) p2, q2 wma ( right) p3, q3 min ( bottom) p, q w ( top) 4 4 ma u u2