A Procedure to Clip Line Segment

Similar documents
Fast Algorithms for Line Segment and Line Clipping in E 2

Keywords Computer Graphics, Line Clipping, 2D geometry, 3D geometry.

A New Algorithm for Pyramidal Clipping of Line Segments in E 3

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

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

Clipping Lines. Dr. Scott Schaefer

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

From Vertices To Fragments-1

Graphics System. Processor. Output Display. Input Devices. Frame Buffer. Memory. Array of pixels. Resolution: # of pixels Depth: # of bits/pixel

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Realtime 3D Computer Graphics Virtual Reality

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17

Rendering. A simple X program to illustrate rendering

The statement implies that any three intersection points of two distinct planes lie on a line.

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Lecture 25: Bezier Subdivision. And he took unto him all these, and divided them in the midst, and laid each piece one against another: Genesis 15:10

Efficient Clipping of Arbitrary Polygons

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers

Part 3: 2D Transformation

Chapter 8: Implementation- Clipping and Rasterization

Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI)

Two-Dimensional Viewing. Chapter 6

From 3D World to 2D Screen. Hendrik Speleers

ALGORITHMS COMPLEXITY AND LINE CLIPPING PROBLEM SOLUTIONS

Illumination Models III: Ray Tracing (View Dependent Global Illumination)

Topics. From vertices to fragments

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

MODULE - 9. Subject: Computer Science. Module: Line Clipping. Module No: CS/CGV/9

AN EFFICIENT NEW ALGORITHM FOR 2-D LINE CLIPPING ITS DEVELOPMENT AND ANALYSIS

Scan Converting Lines

Clipping and Intersection

Part IV. 2D Clipping

Maintaining Mathematical Proficiency

1. Let n be a positive number. a. When we divide a decimal number, n, by 10, how are the numeral and the quotient related?

Fundamentals of Programming CS-110. Lecture 3

Clipping and Scan Conversion

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Clipping Algorithms; 8-5. Computer Graphics. Spring CS4815

On a Method in Algebra and Geometry

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

Rendering. A simple X program to illustrate rendering

Polygon Triangulation

Topic 0. Introduction: What Is Computer Graphics? CSC 418/2504: Computer Graphics EF432. Today s Topics. What is Computer Graphics?

3.1. 3x 4y = 12 3(0) 4y = 12. 3x 4y = 12 3x 4(0) = y = x 0 = 12. 4y = 12 y = 3. 3x = 12 x = 4. The Rectangular Coordinate System

UNIT -8 IMPLEMENTATION

Intermediate Mathematics League of Eastern Massachusetts

CS 325 Computer Graphics

CS770/870 Spring 2017 Curve Generation

Set the Viewport. Set the Viewport Clipping. Set the Viewport. Set the Viewport. Set the Viewport. Resizing the Viewport W = H

MET71 COMPUTER AIDED DESIGN

EF432. Introduction to spagetti and meatballs

Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

More on Coordinate Systems. Coordinate Systems (3) Coordinate Systems (2) Coordinate Systems (5) Coordinate Systems (4) 9/15/2011

SRI VENKATESWARA COLLEGE OF ENGINEERING. COURSE DELIVERY PLAN - THEORY Page 1 of 6

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

6th Bay Area Mathematical Olympiad

2 Solution of Homework

Contents. MATH 32B-2 (18W) (L) G. Liu / (TA) A. Zhou Calculus of Several Variables. 1 Homework 1 - Solutions 3. 2 Homework 2 - Solutions 13

ARINC 661 Based Graphics Engine for Aircraft Head up Display

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Z- Buffer Store the depth for each pixel on the screen and compare stored value with depth of new pixel being drawn.

Stereo Vision. MAN-522 Computer Vision

An Analysis of Interactive Deformable Solid Object Modeling

An Assertion-Guided Derivation of a Circle Drawing Algorithm

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks)

Repetition Through Recursion

3D Rendering Pipeline (for direct illumination)

Mapping Common Core State Standard Clusters and. Ohio Grade Level Indicator. Grade 5 Mathematics

LINEAR PROGRAMMING: A GEOMETRIC APPROACH. Copyright Cengage Learning. All rights reserved.

Computer Graphics. - Clipping - Philipp Slusallek & Stefan Lemme

Computer Engineering and Intelligent Systems ISSN (Paper) ISSN (Online) Vol.5, No.4, 2014

Basics of Computational Geometry

Introduction. Linear because it requires linear functions. Programming as synonymous of planning.

Replica Technique for Geometric Modelling

CSE328 Fundamentals of Computer Graphics

Approximation of Multiplication of Trapezoidal Epsilon-delta Fuzzy Numbers

CS452/552; EE465/505. Clipping & Scan Conversion

Diocese of Boise Math Curriculum 5 th grade

Computers & Graphics, Pergamon Press, Vol.21, No.2, pp , 1997

EF432. Introduction to spagetti and meatballs

GCSE-AS Mathematics Bridging Course. Chellaston School. Dr P. Leary (KS5 Coordinator) Monday Objectives. The Equation of a Line.

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

Math Analysis Chapter 1 Notes: Functions and Graphs

In math, the rate of change is called the slope and is often described by the ratio rise

HP-35s Calculator Program Curves 2A

Subject : Mathematics Level B1 Class VII Lesson: 1 (Integers)

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Computer Graphics (CS 543) Lecture 10 (Part 1): 3D Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Rational Expressions Sections

Building Concepts: Moving from Proportional Relationships to Linear Equations

Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

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

Core Mathematics 1 Graphs of Functions

An introduction to interpolation and splines

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

Math Analysis Chapter 1 Notes: Functions and Graphs

Page 1 of 32. Website: Mobile:

Transcription:

Vol.5, No.1 (2014), pp.9-20 http://dx.doi.org/10.14257/ijcg.2014.5.1.02 A Procedure to Clip Line Segment Bimal Kumar Ray School of Information Technology & Engineering VIT University, Vellore 632014, India bimalkumarray@vit.ac.in, raybk_2000@yahoo.com Abstract This paper proposes a procedure to clip a line segment in 2D that does not compute false intersection point and is easy to implement. The procedure is compared with the classical algorithms viz. Cohen-Sutherland, Liang-Barsky and Nicholl-Lee-Nicholl. It is found that the number of comparisons required by the procedure is significantly less than that required by the Cohen-Sutherland and Liang-Barsky algorithm and this observation is supported by actual execution time. It is also found that the implementation of the procedure is easier than that of the Nicholl-Lee-Nicholl algorithm. The procedure requires two calls to a single routine. Since the second call does not need the results of the first call, hence the two calls can be made in parallel improving the performance by two-fold. Keywords: clipping, line segment, output-driven, comparison, execution time 1. Introduction Clipping a line segment against a rectangular window is a common operation, useful in many algorithms and graphics applications. There are three classical algorithms for line segment clipping viz. Cohen-Sutherland [1], Liang-Barsky [2] and Nicholl-Lee-Nicholl [3]. The Cohen-Sutherland (CS) algorithm detects line segments that are completely inside the window and removes those that are completely outside the window. The other line segments are repeatedly tested and point of intersection of the line segment with the window boundaries is found until the inside test is satisfied. The source of inefficiency of the algorithm is the repeated computation of out code and this is why the CS algorithm requires a large number of comparisons. It also computes false intersection points - up to a maximum of four. The Liang- Barsky (LB) algorithm can clip a line as well as a line segment using a parametric representation of its equation. It computes point of intersection of a line with each of the boundaries of a clipping window. A trivial rejection test is used to reject lines that do not intersect the window. Except the trivial rejection test, the LB algorithm always finds the point of intersection of a line segment (line) with all the clipping boundaries irrespective of its actual intersection and computes up to a maximum of four false intersection points and but unlike the CS algorithm, it does not compute out code. The Nicholl-Lee-Nicholl (NLN) algorithm considers position of one of the end points of a line segment with respect to a clipping boundary and computes point of intersection after confirming that the line segment actually intersects the clipping window. Since it follows test & intersect approach instead of intersect & test, hence it does not compute false intersection points and thereby requires ISSN: 2093-9663 IJCG Copyright c 2014 SERSC

exactly as many divisions as the number of actual intersection points. It is found that the procedure requires the least number of arithmetic operations as compared to the CS and the LB algorithm and is known to be theoretically optimal. But, it requires a large number of routines to develop, test and validate making its implementation harder than that of the CS and LB algorithm. The procedure proposed, in this paper, clips a line segment against a rectangular window. It does not compute out code, does not compute false intersection points and requires at the most two calls to a single routine that computes point of intersection of a line segment with one of the boundaries of the clipping window after testing if it actually intersects the window. Each call to the routine considers one of the end points of the line segment and tests the same against window boundaries. Since it tests one of the end points of a line segment with one call to the routine, hence the second call requires the end points of the line segment to be swapped before the routine is called. The two calls may also be executed in parallel, because one call does not need the results of the other for its execution. The paper is organized as follows. In the next section, the concept and implementation of the proposed procedure is presented, in Section 3, the procedure is analyzed and compared with the classical algorithms and finally, in Section 4, the conclusion is drawn. 2. Proposed procedure Concept & implementation Consider a rectangular clipping window with its left boundary defined by x = x L, right boundary by x = x R, bottom boundary by y = y B and top boundary by y = y T. Let a line segment to be clipped be defined by its end points A(x 1, y 1 ) and B(x 2, y 2 ) and let CD with the end points C(x L, y B ) and D(x L, y T ) be the left boundary segment of the clipping window (Figure 1). Let us assume that the left end point A of the line segment AB lies to the left of the left boundary segment (CD) and the other end point B lies to the right of the left boundary segment. It may be observed from this figure that both the end points C and D of the left boundary segment CD are below the line segment AB and this is why AB cannot intersect CD. In other words, the line segment AB cannot intersect CD if the point C is below the segment AB. Similarly, the segment AB cannot intersect (Figure 2) CD, if D lies above AB. In case AB is neither above nor below both the corner points C and D (Figure 3), the point of intersection of AB with CD is computed. Figure 1. The corner point C is below the segment AB and so AB is rejected 10 Copyright c 2014 SERSC

Figure 2. A corner point D is above the line segment AB and so it is rejected Figure 3. A line segment AB intersects CD and so it cannot be rejected Figure 4. A line segment with end point A to the right of the right boundary segment and the other end point is to its left If the end point A of the line segment is situated to the right of the right boundary segment (EF in figure 4) and the end point B is situated to the left of the right boundary segment and if both the upper right corner and lower right corner of the clipping window fall either below or above the segment AB then the segment AB is rejected, otherwise it is necessary to find the point of intersection of the line segment AB with the right boundary segment EF. Similar approach is followed if one of the end points of the line segment AB is either below the bottom boundary or above the top boundary segment. A line segment that lies completely either to the left of the left boundary or to the right of the right boundary or below the bottom boundary or above the top boundary, is rejected by a Copyright c 2014 SERSC 11

trivial test. A line segment with both its end points lying inside the clipping window survives rejection tests and is eventually accepted. The procedure is output directed it computes exactly as many intersection points as required for the output line segment and thereby it avoids computing false intersection points. The CS algorithm, on the other hand, computes a maximum of four false intersections and so also the LB algorithm. Though the NLN algorithm does not compute false intersection points, but it requires too many routines to develop, test and validate making its implementation hard to achieve. The mathematical predicates to be used to determine whether a line segment intersects window boundary segment are derived now. The equation of a line segment AB with the end points A(x 1, y 1 ) and B(x 2, y 2 ), in the implicit form, is defined by (x x 1 )(y 2 y 1 ) (y y 1 )(x 2 x 1 ) = 0, (x, y) being the coordinates of any point on the line segment. To test if a point C (figure 1), with coordinates (x L, y T ), is below the line segment AB, the predicate to be used is P 1 : (x L x 1 )(y 2 y 1 ) > (y T y 1 )(x 2 x 1 ). Similarly, referring to figure 2, the predicate to be used to test whether the point D, with coordinates (x L, y B ), is above the line segment is P 2 : (x L x 1 )(y 2 y 1 ) < (y B y 1 )(x 2 x 1 ). If one of the predicates P 1 or P 2 evaluate to true then the line segment AB is rejected, otherwise it intersects the boundary segment CD (figure 3) and in this case the x-coordinate of the point of intersection is x L and the y-coordinate is given by y = y 1 + (y 2 y 1 )(x L x 1 )/(x 2 x 1 ). In the last expression, though x 2 x 1 is in the denominator but division by zero is not encountered because the line segment that intersects the left boundary cannot be parallel to the same (x 1 x 2 ). It may be noted that point of intersection is computed after confirming that it actually exists and thereby computation of false intersection points is avoided. If one of the end points of a line segment to be clipped is situated to the right of the right boundary and the other end point is situated to the left of the right boundary (figure 4) then a similar test is performed to test whether the line segment can be rejected. Similar tests are performed against the bottom and top boundary too. In case it is found that an end point of the line segment is neither to the left of the left boundary, nor to the right of the right boundary nor below the bottom boundary nor above the top boundary then it is returned as one of the end points of the output line segment. The procedure is implemented as a function in C programming language, is called cliponeend and is displayed below. int cliponeend(double& x1, double& y1, double x2, double y2, int& display) { if (x1 < xl) { double dx = x2 x1, dy = y2 y1, temp = (xl x1)*dy; if ( (yt y1)*dx < temp ) else if ( (yb y1)*dx > temp ) 12 Copyright c 2014 SERSC

else { y1 = y1 + temp/dx; x1 = xl; display = 1; else if (x1 > xr) { double dx = x2 x1, dy = y2 y1, temp = (xr x1)*dy; if ( (yt y1)*dx > temp ) else if ( (yb y1)*dx < temp) else { y1 = y1 + temp/dx; x1 = xr; display = 1; else display = 1; if( y1 < yb ) { double dx = x2 x1, dy = y2 y1, temp = (yb y1)*dx; if ( temp < (xl x1)*dy ) else if ( temp > (xr x1)*dy ) else { x1 = x1 + temp/dy; y1 = yb; display = 1; else if ( y1 > yt ) { double dx = x2 x1, dy = y2 y1, temp = (yt y1)*dx; if ( temp > (xl x1)*dy ) else if ( temp < (xr x1)*dy ) else { x1 = x1 + temp/dy; y1 = yt; display = 1; else display = 1; return display; The procedure is used to test one of the end points of a line segment against a clipping boundary segment. It accepts the coordinates (x 1, y 1 ) and (x 2, y 2 ) of the end points of the line Copyright c 2014 SERSC 13

segment to be clipped as input parameters and treats one of the end points (x 1, y 1 ) (say) as output parameters as well. The identifier display, used in the procedure, stores the value 1 if either the point of intersection of the line segment with the clipping boundary segment is found or the point (x 1, y 1 ) lies inside the clipping window, otherwise it stores the value zero. A higher level routine called cliplinesegment, displayed below, initially performs a trivial rejection test. If the test succeeds then the procedure returns nothing without performing any computation. On the other hand, if the trivial rejection test fails then the routine cliponeend is called at the most twice. If the first call returns zero then the second call is not made. The second call, if performed, is made after swapping the role of the end points, because the routine tests one end point at a time. The procedure accepts the coordinates of end points of the line segment as its arguments and the same act as output parameters as well. void cliplinesegment(double x1, double y1, double x2, double y2, int& display) { // A trivial rejection test if (x1 < xl) if (x2 < xl) return; if (x1 > xr) if (x2 > xr) return; if (y1 < yb) if (y2 < yb) return; if (y1 > yt) if (y2 > yt) return; // Trivial rejection test ends if(!(cliponeend(x1, y1, x2, y2, display)) return; if (cliponeend(x2, y2, x1, y1, display) ) line (x1, y1, x2, y2); //draw line segment with (x1, y1) and (x2. y2) as its end points return; 3. Analysis & comparison An architecture-independent analysis of the proposed procedure is made and compared with the CS, LB and NLN algorithm. For this, test line segments at all possible positions are considered and the number of comparisons (<), addition (+), subtraction ( ), multiplication ( ) and division ( ) required to clip a line segment are computed (it is possible to consider line segments at all possible positions because of the symmetry of the problem.). The CS, LB and the NLN algorithm also are applied on these line segments. The CS and LB algorithms are coded from [1] and the NLN is from [3]. The operations performed on different line segments by the three algorithms are shown in the Table 1 which also shows the coordinates of the end points of the test line segments. From these results it is observed that the maximum number of false intersection points computed by the CS and LB algorithm is four but the proposed procedure, like the NLN, does not compute false intersection points. This is why the number of divisions performed by the proposed procedure is exactly the same as the number of intersection points of the clipped line segment. It is also observed that the average number of comparisons required by the CS and the LB algorithm are respectively 169% and 137% of the proposed procedure and so it is concluded that the average number of comparisons required by the proposed procedure is less than that required by the CS and LB algorithm. 14 Copyright c 2014 SERSC

Table 1. Comparison among proposed, CS, LB and NLN algorithm with respect to operation counts The CS and LB algorithms are not output directed. These algorithms compute false intersection points up to a maximum of four. On the other hand, the proposed procedure is output directed. It does not compute false intersection points. The proposed procedure is easier to implement than the NLN algorithm. As it is well known [4], implementation of the NLN algorithm requires multiple routines to be developed: one each for (x 1, y 1 ) in each of the corners and edges of the clipping region and also for the other point (x 2, y 2 ) exterior or interior of the clipping region. Obviously, there are a large number of routines and the resulting algorithms are quite complex. Consequently, development, testing, and validation are of considerable concern. The proposed procedure does not require two many cases to develop, test and validate. Only one routine can process line segments at all possible positions with Copyright c 2014 SERSC 15

two calls to the routine. A higher level routine, called cliplinesegment, is used to deal with the trivial rejection test which, in turn, calls the lower level routine, cliponeend. Lastly, the average execution time of five million random line segments is computed fifty times on a PC with Intel Core i3 CPU M370 @2.40 GHz processor using the proposed as well as conventional algorithms. The results of these experiments are shown in table II. A metric E = (Time to clip by other algorithm) / (Time to clip by the proposed algorithm), called coefficient of efficiency [5], is used to compare the performance of the proposed algorithm with the CS, LB and NLN algorithm and its values are shown in the same table. It is found that the performance of the proposed algorithm is better than the CS and the LB algorithm with respect to execution time. Table 2. Average execution time of five million random line segments & its ratio Proposed CS LB NLN CS/Proposed LB/Proposed NLN/Proposed 2.75E- 1.11E+00 1.39E+00 1.05E+00 1.43E+00 1.43E+00 1.36E+00 1.76E- 2.64E- 2.64E- 1.50E+00 1.50E+00 1.31E+00 3.08E- 1.65E+00 1.18E+00 1.18E+00 1.76E- 1.31E+00 1.12E+00 1.19E+00 2.75E- 1.47E+00 9.99E-01 1.12E+00 1.40E+00 1.20E+00 9.99E-01 1.05E+00 9.99E-01 1.21E+00 2.97E- 9.44E-01 1.50E+00 9.44E-01 2.42E- 1.47E+00 1.40E+00 1.33E+00 2.42E- 2.64E- 1.16E+00 1.26E+00 7.89E-01 1.43E- 1.31E+00 1.31E+00 1.08E+00 2.64E- 9.44E-01 1.33E+00 8.33E-01 1.13E+00 1.20E+00 9.99E-01 1.43E- 2.75E- 2.75E- 1.92E+00 1.61E+00 1.92E+00 1.36E+00 1.43E+00 9.99E-01 16 Copyright c 2014 SERSC

1.43E- 2.42E- 2.42E- 2.42E- 1.43E- 2.64E- 1.76E- 1.76E- 1.76E- 2.86E- 2.64E- 1.76E- 2.75E- 2.42E- 2.42E- 2.97E- 2.86E- 2.42E- 2.75E- 2.86E- 2.75E- 2.42E- 2.86E- 2.86E- 2.64E- 2.97E- 3.19E- 1.77E+00 1.54E+00 1.15E+00 1.33E+00 1.40E+00 9.32E-01 1.37E+00 1.31E+00 7.89E-01 1.00E+00 1.05E+00 7.77E-01 1.20E+00 1.20E+00 1.20E+00 9.55E-01 8.17E-01 1.04E+00 8.64E-01 8.17E-01 6.81E-01 1.64E+00 1.28E+00 1.28E+00 1.09E+00 1.18E+00 7.72E-01 1.14E+00 1.50E+00 1.50E+00 1.19E+00 1.19E+00 6.66E-01 1.69E+00 1.69E+00 1.15E+00 1.50E+00 1.86E+00 9.99E-01 1.13E+00 1.40E+00 9.99E-01 1.29E+00 1.35E+00 9.99E-01 1.93E+00 1.43E+00 1.21E+00 1.11E+00 9.44E-01 9.44E-01 1.08E+00 8.74E-01 7.91E-01 1.53E+00 1.73E+00 9.99E-01 1.43E+00 1.28E+00 1.E+00 1.29E+00 1.18E+00 8.81E-01 1.44E+00 1.50E+00 8.74E-01 1.31E+00 1.69E+00 9.37E-01 1.25E+00 1.81E+00 9.37E-01 Copyright c 2014 SERSC 17

1.76E- 1.76E- 2.42E- 2.97E- 2.97E- 1.76E- 3.08E- 1.43E+00 1.21E+00 1.21E+00 2.64E- 1.00E+00 1.26E+00 1.05E+00 1.18E+00 1.06E+00 9.99E-01 1.50E+00 9.99E-01 1.28E+00 2.64E- 1.25E+00 1.50E+00 9.37E-01 2.97E- 1.31E+00 1.69E+00 9.37E-01 1.23E+00 9.54E-01 6.36E-01 1.14E+00 1.28E+00 1.E+00 1.05E+00 9.46E-01 9.46E-01 2.00E+00 1.28E+00 9.99E-01 Average 1.32E+00 1.30E+00 1.04E+00 Maximum 2.00E+00 1.86E+00 1.92E+00 Minimum 8.64E-01 8.17E-01 6.36E-01 It is observed that the higher level routine cliplinesegment calls the lower level routine cliponeend twice, the second call being made after interchanging the role of the end points of the line segment. The second call does not require the results of the first call as (a part of) its input and so the two calls to the routine cliponeend can be made in parallel and thereby improving the performance of the algorithm two-fold. 4. Conclusion A procedure to clip a line segment against a rectangular window is proposed and tested with line segments at all possible positions and compared with the classical line segment clipping algorithms. The procedure is also tested and compared with the conventional algorithms using actual execution time on random lines. The following features are observed of the proposed procedure. It, as with the NLN algorithm, does not compute false intersection point and so it is output driven. It shows improvement over the CS and LB algorithm with respect to number of comparisons and number of divisions. It is much simpler that the NLN algorithm in that it does not require too many routines to develop, test and validate. The performance of the proposed procedure is found to be better than the CS and the LB algorithm with respect to actual execution time. 18 Copyright c 2014 SERSC

It is possible to improve its performance two-fold by executing the two calls to the routine cliponeend in parallel. References [1] J. D. Foley, A. van Dam, S. K. Feiner and J. F. Hughes, Computer Graphics: Principles and Practice, Addison-Wesley (2 nd edition in C), (1996). [2] Y. D. Liang and B. A. Barsky, A New Conceptand Method for Line Clipping, ACM Transactions on Graphics, vol. 3, no. 1, (1984), pp. 1 22. [3] T. M. Nicholl, D. T. Lee and R. A. Nicholl, An Efficient New Algorithm for 2-D Line Clipping, Computers & Graphics, vol. 21, no. 4, (1987), pp. 253 262. [4] D. F. Rogers, Procedural Elements for Computer Graphics, 2 nd edition Tata McGraw-Hill, (2005). [5] D. H. Bui and V. Skala, Fast algorithms for clipping lines and line segments in E2, The Visual Computer vol. 14, (1998), pp. 31 37. Author Bimal Kumar Ray received his Ph.D. degree in Computer Science from Indian Statistical Institute, Kolkata, India. He received his Master degree in Applied Mathematics from Calcutta University and his Bachelor degree in Mathematics from St. Xavier's College, Kolkata. His research interests are in computer graphics, vision and image processing. Email: bimalkumarray@vit.ac.in Copyright c 2014 SERSC 19

20 Copyright c 2014 SERSC