0% found this document useful (0 votes)
53 views3 pages

Liang-Barsky Clipping Algorithm Guide

The document describes the Liang-Barsky line clipping algorithm. It uses the parametric equation of a line and inequalities of the clipping window boundaries to determine intersections and clip lines. It then provides an example of applying the algorithm to clip a line with endpoints P1(-1, -2) and P2(2,4) within a viewport window of boundaries XL=0, XR=1, YB=0, YT=1.

Uploaded by

hashimgulled
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views3 pages

Liang-Barsky Clipping Algorithm Guide

The document describes the Liang-Barsky line clipping algorithm. It uses the parametric equation of a line and inequalities of the clipping window boundaries to determine intersections and clip lines. It then provides an example of applying the algorithm to clip a line with endpoints P1(-1, -2) and P2(2,4) within a viewport window of boundaries XL=0, XR=1, YB=0, YT=1.

Uploaded by

hashimgulled
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

BAC

UNIT: Computer Graphics Design (BAC 3206)

LEC: MR. DAVID OPONDO ORIEDI

Assignment 1(group work)

Group members

1.20/03829-Ondima Yobes

2.21/05311 Hashim Jibril

3.20/02882 Ryan Mugo

4.20/03734 Moses Thuo

5.20/03697 Joy Wanjiku

1. Describe Liang Barsky clipping algorithm


The Liang-Barsky clipping algorithm is an efficient line clipping algorithm used in computer

graphics. It utilizes the parametric equation of a line and inequalities that describe the range

of the clipping window to determine the intersections between the line and the clip window.

Here’s a high-level description of the algorithm:

1. Parametric Line Equation: The algorithm starts with the parametric form of

a line segment between two points ( P_1(x1, y1) ) and ( P2(x2, y2) ): [ X = x1

+ t(x2 - x1) ] [ Y = y1 + t(y2 - y1) ] where ( t ) is a parameter that ranges from

0 to 1.

2. Defining Boundaries: The clipping window is defined by its boundaries

( xwmin, xwmax, ywmin, ywmax ). The algorithm checks the line against

these boundaries to find the intersections.

3. Calculating Intersections: For each boundary, the algorithm calculates two

values, ( pk ) and ( qk ), which are derived from the line’s direction and the

clipping window’s boundaries. These values are used to find the parameter ( t )

at which the line intersects the clipping boundary.


4. Determining Visibility: The algorithm determines the values of ( t ) for which

the line segment is inside the clipping window. If ( t1 ) and ( t2 ) are the

entering and exiting values of ( t ), the line is visible when ( t1 < t2 ).

5. Clipping the Line: If the line is found to be partially or completely within the

clipping window, the algorithm calculates the new endpoints of the clipped

line segment using the visible ( t ) values.

6. Drawing the Line: Finally, the clipped line segment is drawn within the

clipping window.

2. Let P1(-1, -2) and P2(2,4) be end points of a line to be clipped using Liang

Barsky technique. Let the boundaries of viewport window be as follows:

Left boundary (XL) = 0, Right boundary (XR) = 1, Bottom boundary

(YB) = 0 and Top boundary (YT) = 1. Clip the line. Show computations.

You might also like