0% found this document useful (0 votes)
137 views8 pages

Line Clipping

This document describes a fixed-point arithmetic line clipping algorithm that improves on previous algorithms. It combines techniques from previous works, such as implicit area codes, decision trees, avoiding redundant calculations, and symmetry. The algorithm uses 32-bit fixed-point arithmetic to support fractional coordinates while using only integer operations. It monitors clipping load dynamically and prioritizes trivial rejection or acceptance depending on the load to improve efficiency. The algorithm reuses calculations, such as only computing the line slope when needed, to further improve performance over previous algorithms.

Uploaded by

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

Line Clipping

This document describes a fixed-point arithmetic line clipping algorithm that improves on previous algorithms. It combines techniques from previous works, such as implicit area codes, decision trees, avoiding redundant calculations, and symmetry. The algorithm uses 32-bit fixed-point arithmetic to support fractional coordinates while using only integer operations. It monitors clipping load dynamically and prioritizes trivial rejection or acceptance depending on the load to improve efficiency. The algorithm reuses calculations, such as only computing the line slope when needed, to further improve performance over previous algorithms.

Uploaded by

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

Fixed-Point Arithmetic Line Clipping

R. Moll
Technical University of Valencia Camino de Vera, s/n Spain 46022, Valencia

P. Jorquera
Technical University of Valencia Camino de Vera, s/n Spain 46022, Valencia

R. Viv
Technical University of Valencia Camino de Vera, s/n Spain 46022, Valencia

[email protected]

[email protected] ABSTRACT

[email protected]

This algorithm supports line clipping against a rectangular window with edges parallel to the screen. The algorithm combines different partial solutions given in the bibliography such as implicit area codes, decision trees, line ends comparison, symmetry or avoiding redundant calculations, mixing them with fixed-point arithmetic, explicit calculation reusing and dynamic monitoring. It may work in the fractional object space while still using integer arithmetic (fixed-point). It is faster than traditional algorithms. It provides more precision without using floating point arithmetic.

Keywords
Line clipping, fixed-point arithmetic.

1. INTRODUCTION
Many portable devices such as videogames consoles, mobile phones, PDAs, wearable computers, etc., have introduced graphics capabilities as an added value. These devices use very slow processors since low power consumption is mandatory. Neither graphic processor nor dedicated hardware is used, so efficient and simple software algorithms are mandatory. This paper introduces a new straight line-clipping algorithm for 2D rectangular windows with edges parallel to the screen. This problem is a key one since many other clipping algorithms rely on it to be solved. High level curves primitives are finally converted to a sequence of line segments and all lines are clipped before being drawn. This algorithm may be used on low cost integer CPUs without floating point units although it supports object space fractional numbers.

Speed-up may be doubled if the clipping loop is changed by a specific clipping, [Bui98]. In general, all the algorithms can be accelerated if they operate in the image space (integer arithmetic) instead of the object space (floating-point) [Dor90]. This paper uses fixed-point arithmetic in order to support object space line clipping while still using integer numbers. All the algorithms analysed always operate in the screen space, not in the object space. This is a precision limitation. Using a convex window preprocess, the clipping cost may be almost constant [Ska93]. In practice, it can improve CB between 2.5 and 3 times. This algorithm may be improved getting down the computational cost from O(N) to O(lg N) [Ska94] [Bui99], where N is the amount of edges the clipping window has. If a good frame pre-process is performed, the clipping cost may get O(1) [Ska96]. Assuming that all lines are infinite, that is there are no segments, no line is trivially accepted and all of them intersect all window edges (except those parallels). In this case, the algorithm implementation is easier than in others [Ska99].

2. PREVIOUS WORKS
Many clipping algorithms are based on line parametric equations like Cyrus-Beck (CB) [Rog85] or the more efficient Liang-Barsky (LB) [Lia84]. Cohen-Sutherland (CS) [New79] approach uses another approach using explicit area codes to tipify lines. This algorithm is more efficient since line ends are compared initially to every window edge. This process is able to trivially reject or accept a line even before doing any clipping calculation. The trivial test may be accelerated [Duv93] and the codification process can be changed in order to employ 2.2 comparisons in average instead of 3.3 [Kai90].

3. BACKGROUND Previous ideas


The FPC (Fixed Point Clipping) algorithm collects many good ideas made in the bibliography: It uses a decision tree to avoid typical clipping loop overheads [Nic87] [Sob87] [And91]. Code reusing so that the line slope is calculated only once [Duv93].

Early detection of trivial acceptation or rejection of segments [And91]. No explicit area code such as the CohenSutherland [New79] like algorithms. Thus, no codification process and no management are required. Successive comparisons take into account the ones just made before, avoiding calculation redundancy [Nic87] [And91] [Duv93]. Code reduction by employing problem symmetry using vertical and horizontal reflection functions. This fact makes easy to debug code without incrementing significantly the computational cost [Nic87] [And91]. Line ends are compared one each other before comparing them against the clipping window edges. This comparison accelerates rejection or acceptation, reducing calculation from three or four comparisons to only two or three [Duv93]. Precision increment is increased clipping always against original line ends instead of the intermediate clipped points [Dor90] [Duv93].

This calculation redundancy can be avoided if the following change is included to obtain an implicit solution if ((Aux = (X - Xmin)) < 0) Y0 += Aux*m; Tests made on superescalar1 CPUs show that typical statements are the fastest ones if the condition is false. But if the condition is true, then the typical statement is the slowest one. The implicit solution presents an intermediate performance. Computing the line slope only when is strictly necessary is another issue of calculation reuse. If the line is trivially rejected, its slope is never computed. On the other hand, if the line slope has to be calculated in order to perform a clipping, this data is reused when the line is drawn on the screen. So, the line drawing algorithm initialisation phase is reduced. All the other traditional clipping algorithms do not use this possibility. This is why two subtractions and one division when drawing a line always punish the rest of the algorithms.

3.1.2 Fixed-point arithmetic


For the implementation of this algorithm, we used 32 bits fixed-point arithmetic. 16 bits were used for the integer part and 16 bits for the decimal part. The precision of this implementation was 12 millionth of a pixel. It is enough for today portable game players, printers o common CRT resolutions.

New ideas
The algorithm also includes new ideas to improve efficiency [Mol01b]: Real time dynamic monitoring in order to detect the actual clipping load. Depending on the amount of trivial rejections or acceptations turning up, the algorithm prioresses trivial acceptation or rejection. No floating-point arithmetic is used. Only 32 bits fixed-point arithmetic is used, supporting a resolution up to 12 millionths of a pixel. This is enough to support actual printers or CRTs. Intermediate computations are made only when it is strictly necessary (line slope, line width or height). They are used during the clipping phase and by the line drawing algorithm if no rejection is made. Thus, the line drawing initialisation phase is reduced, speeding up the whole process. Implicit comparisons are explicitly carried out so that they are stored in intermediate variables in order to reuse them later if necessary.

3.1.3 Monitoring
Line clipping is a process difficult to typify. Clipping rate depends on several factors: the clipping window size, its aspect ratio, segments size and position, ... Given a scene to clip, each segment is projected against the clipping window. Each line end can rely on one of the nine areas in which the clipping window edges divide the screen [New79]. There are around 81 possible different cases. Let it be O the amount of segments to clip. Let it be Oi the amount of occurrences for every one of those 81 typified line positions on the screen. Suppose every clipping algorithm can solve every case with a given computational cost CCi. Therefore, the total computational cost T an algorithm employs may be calculated in the following way:

3.1.1 Calculation reuse


Many times, doing a clipping process, typical statements like the following one come out if (X<Xmin) Y0 += (X - Xmin)*m; This statement may be written as if ((X - Xmin) < 0) Y0 += (X - Xmin)*m;

T = CCi * Oi
i =1

81

O = Oi
i =1

81

Most of the clipping cases are trivial acceptations or rejections [Ake88]. Let it be Or the trivial rejection amount of occurrences and Oa for trivial acceptation. In many clipping cases, Oa + Or >> O - Oa - Or. So, minimizing the cost of trivial detections is mandatory.
1

Mainly intel Pentium II / III and AMD K6 and K7

Many clipping algorithms use a decision tree, thus, some cases are detected before others. Consequently, an implicit computational handicap appears for those cases detected at the end of the tree. There are a great number of different and suitable decision trees. Depending on the tree selected, some cases are rewarded or punished. Depending on the application clipping load, it is better to use a given tree or another. When using sequential algorithms, the cost of clipping against a window edge is added to the cost of clipping previously against other edges. In practice, depending on the order in which the clippings are made, the whole algorithm cost may vary significantly for a given line. When analysing all the decision trees, many branches are always the same, so that their position change depending on the decision tree selected. For this reason, the main clipping challenge is to decide what is like the main tree trunk to use in order to minimise the clipping cost. Let it be Cij the computational cost to solve a segment clipping respect to the i-th edge after solving the previously j-1 edges. So, Cij = Ci + Ckj-1 where Ckj-1 is the computational cost for clipping the segment respect to the k edge in the stage before. That is to say, CCi depends on the order in the sequence of clippings evaluated before. An algorithm that always prioresses trivial rejections instead of acceptations, or vice versa, is not a good solution on average. A way to improve speed is to cut down CCi reducing Ci as much as possible for every i. Another way is to reduce Cij depending on the actual load the clipping algorithm is managing in a given moment. For instance, there are algorithms like CS where the computational cost to perform a trivial rejection Cr is equal to an aceptation Ca. Formally CaCS = CrCS. This behaviour is not always the same. For instance, the NLN algorithm shows CrNLN<CaNLN< CaCS = CrCS. Let it be cl, cr, cu, cd the clipping edge on the left, right, up and down respectively. We can verify that CclNLN < CcrNLN < CcuNLN < CcdNLN <CaNLN<CaCS=CrCS. When working in one dimension, the clipping algorithm has four inputs: Wmin and Wmax (minimum and maximum window edge) and P0 and P1 (segment end positions). These points combined produce 6 typical cases: C1 = (P0P1WM) or (P1P0WM) C2 = (P0WM>P1>Wm) or (P1WM>P0>Wm) C3 = (WM>P0P1>Wm) or (WM>P1P0>Wm) C4 = (WM>P0>WmP1) or (WM>P1>WmP0)

C5 = (WmP0P1) or (WmP1P0) C6 = (P0WM>WmP1) or (P1WM>WmP0) Trivial acceptation cases belong to C3, while trivial rejection ones are C1 and C5. There are up to 60 different trees 4 levels deep to solve trivially the clipping problem using these comparisons. Depending on the decision tree selected, if rejections have more priority, a rejection may be obtained in no more than 2 or 3 comparisons and an acceptation in 4. On the other hand when rejections have not priority, these may be detected using 4 comparisons and acceptations using only 3 comparisons for every dimension. Different decision trees detect earlier rejections in one dimension or another. Inside a given dimension, different trees can firstly reject a side or another. Let it be Cr the cost of rejecting a segment in any dimensin. If the i-th dimension is tested after the i-1 previous one, then the cost of rejecting the i-th dimension Cri is given by Cri = Cr + Cri-1 = Cr + (i-1)Cr = iCr Let it be Ori the amount of segment rejections in the ith dimension. If all Ori are ordered descendently so that Ori >= Orj j>i, then the minimum rejection cost Cmr is given by

Cmr = Cri * Ori = i * Cr * Ori = Cr * i * Ori


i =1 i =1 i =1

A segment is accepted iff it is accepted for all dimensions. That is to say, the total cost of accepting a segment (Ca) is always

Ca = C ai
i =1

Where D is the amount of the clipping space dimensions, Cai is the computational cost of accepting a segment in the i-th dimension. So, Ca does not depend on the order in which dimensions are cheked and it is always constant. On the other hand, trivial rejection can really be improved if the proper clipping decision tree is selected in order to match this order Ori >= Orj j>i. A problem related to traditional algorithms is that they use rigid decision trees. These trees cannot be altered during the execution phase and the algorithms follow them without change. They do not need monitoring mechanisms since it is not possible to perform any change in the algorithm behaviour. So, when the problem load changes, the algorithm performance may slow down since the amount of punished cases can be increased. That is, Cmr increases without the algorithm can notice it and without it can take any measure consequently.

In this paper, we propose a scheme where a dynamic monitor checks Ori and apply the corresponding decisin tree that best matches the actual graphic load (minimum Cmr). This algorithm is selected by a planning procedure called at a frequency much lower than the sampling frequency. Monitoring adds an aditional load on the algorithm. This load depends on the way the monitor performs the Ori accounting, how often this accounting is made and the algorithm that selects the best suitable decision tree (computational cost and goodness of the algorithm selected). According to process control theory, the monitoring algorithms have to take into account three aspects: the significant parameters, how to sample them and when (sample frequency).

th image will be quite similar to the i-th-1 and to the i-th+1 (temporal locality). This effect is emphasized the faster the graphic processor is. On the other hand, there are several possibilities to determine when to call the planning algorithm or sample: Drawing primitive. The highest one. It allows to change the clipping politic as fast as possible. On the other hand, spatial locality is lost since it is not possible to know if a primitive belongs to the same object or even to the same image. Object. If an object is not visible, it is normally discarded in a previous phase. If an object has to be clipped, it is because it may be visible total or partially. So its primitives. If the graphic application pushes the objects to the graphic pipeline ordered by its spatial proximity, it appears groups of objects with similar clipping characteristics. Whole image. If the planning algorithm is called only once every whole screen or group of screens, the planning overhead is really small. So, the planning algorithm can be more sophisticated.

3.1.3.1 Significant parameters


In order to avoid very complex accounting, the FPC algorithm reduces monitoring to 3 possible cases: Trivial rejection taking into account the dimension in which the rejection is performed. Trivial acceptation. Equal for all dimensions. Clipping. The rest of the cases. It does not matter the dimension.

3.1.3.2 Sampling methods


Monitor overload has to be as light as possible in order to avoid monitoring affects the real load. Typically it is a reject/accept/clip accounting (variable unitary increment) that is reset every time the planning algorithm is called. In this study four monitoring variables have been created: RejectX, RejectY, Accept and Clipping. Consequently, we have reduced the algorithm implementations to four possibilities: RxRyA, RyRxA, ARxRy and finally ARyRx; where, for instance, RxRyA priorizes trivial rejection on X dimension, secondly trivial rejection on Y dimension and finally acceptation. We have not implemented, for simplicity, RxARy and RyARx.

In this paper implementation, the sampling frequency is the drawing primitive. This sampling can be set permanently for all the screens or variable, depending on the application behaviour. The planning algorithm is called after a whole image accounting is made.

4. COMPUTATIONAL ANALYSIS
We have compared the FPC algorithm to traditional algorithms such as Cohen-Sutherland [New79], Liang-Barsky [Lia84], Cyrus-Beck [Rog85] or Nycholl-Lee-Nycholl [Nic87].

Computational Cost
4.1.1 Results
It is not easy to compare clipping algorithms since the clipping load depends on the window size, ratio, relative position or the segments to clip (clipping load). These features are closely related to the application type and user behaviour. In order to compare different algorithms, we took two approximations: 1. 2. Perform a case analysis considering all clipping possibilities. Plan a laboratory test so that, under the same conditions, we could analyse real timing for all the algorithms.

3.1.3.3 Sampling
The difference between a fixed clipping tree and the best suitable algorithm selected by the monitor sets the amount of computer power to be used by monitoring. If monitoring cost is higher than this difference, monitoring cannot be used permanently. In many applications, it is not necessary to monitor constantly. So the sample frequency can be slowed down. Real time interactive graphic applications such as videogames, VR, CAD, etc., produce spatial and temporally coherent graphics. So, if a segment has been clipped in a given way, the segments close to it will be probably clipped in the same way (spatial locality). Similarly, the clipping distribution of the i-

In the first approximation, only the basic cases are analysed, the other ones are reduced to them by symmetry.

CS 9 0 0 0 0

LB 6 0 2.5 0 1.5

NLN 2.5 0 0 0 0

FPC 2 0 0 0 0

CS 9.5 0 0 0 0

LB 10.5 0 4 0 2.5

NLN 3.75 0 0 0 0

FPC 6 0 0 0 0

CS 9.5 0 0 0 0

LB 10.5 0 4 0 2.5

NLN 3.75 0 0 0 0

FPC 6 0 0 0 0

CS 25.5 1.5 4.5 1.5 1.5

LB 20 2 6 2 4

NLN 8 1 4 2 1

FPC 11 1 0 0 1

CS 25.5 1.5 4.5 1.5 1.5

LB 14.75 0 5.5 0 1.5

NLN 8 0 5 3 0

FPC 11 2 0 1 1

CS 36.5 2.5 7.5 2.5 2.5

LB 20 4 6 4 4

NLN 9 2 5 3 2

FPC 11 1 0 0 1 CS 41 3 9 3 3 LB 20 4 6 4 4

CS 36.5 2.5 7.5 2.5 2.5 NLN 10 2 6 4 2

LB 20 4 6 4 4 FPC 12 2 0 1 1

NLN 8 2 5 3 2

FPC 11 1 0 0 1

CS 25 1.5 4.5 1.5 1.5

LB 14.5 0 5.5 0 3.5

NLN 3 0 5 3 0

FPC 9 2 0 1 1

Figure 1. Computational costs comparison when a line end relies on a corner


CS LB NLN 20.5 14.75 7.5 1 0 0 3 5.5 4 1 0 2 FPC 9 2 0 1

CS 9.5 0 0 0 0

LB 10.5 0 4 0 2.5

NLN 3.5 0 0 0 0

FPC 2 0 0 0 0

CS 21 1 3 1 1

LB 14.75 0 5.5 0 3.5

NLN 7.5 0 4 2 0

FPC 9 2 0 1 1 CS 32 2 6 2 2 LB 20 4 6 4 4 NLN 8.5 2 4 2 2 FPC 10 3 0 1 2 CS 36.5 2.4 7.5 2.5

LB 20 4 6 4

NLN 9.5 2 5 3

FPC 11 4 0 2

CS 9.5 0 0 0 0

LB 10.5 0 4 0 2.5

NLN 3.5 0 0 0 0

FPC 2 0 0 0 0

CS 21 1 3 1 1

LB 20 2 6 2 4

NLN 8 1 3 1 1

FPC 11 2 0 1 1

CS 32 2 6 2 2

LB 20 4 6 4 4

NLN 8 2 4 2 2

FPC 12 3 0 2 1

Figure 2. Computational costs comparison when a line end relies on the left side In the illustrations we show the computational costs of three traditional clipping algorithms compared to the FPC when a line end is set on a corner (Figure 1), on the left out of the clipping window (Figure 2) or inside the clipping window (Figure 3). All the other cases can be reduced to these three by symmetry. In these figures, the accounting tables present 5 rows. They show, up-down, the computational cost corresponding to comparison, addition, subtraction, multiplication and division. Each column shows the cost performed by an algorithm when clipping that case.

CS 25.5 1.5 4.5 1.5 1.5

LB 20 2 6 2 4

NLN 8 1 4 2 1

FPC 11 1 0 0 1

CS 21 1 3 1 1

LB 20 2 6 2 4

NLN 7.5 1 3 1 1

FPC 11 2 0 1 1

CS 10 0 0 0 0

LB 20 0 6 0 4

NLN 8 0 0 0 0

FPC 6/12 0 0 0 0

Figure 3. Computational costs comparison when a line end relies inside the clipping window The compared algorithms, from left to right are the following: Cohen-Sutherland (CS), Liang Barsky (LB), Nycholl - Lee Nycholl (NLN) and FixedPoint Clipper (FPC). o o o Continuous monitoring at the highest possible sampling frequency. (FPC Continuous) Constant sampling frequency but lower than the highest one. (FPC Constant) Adaptive sampling frequency depending on the change of sampled parameters. (FPC Adaptive)

4.1.2 Analysis
The Liang-Barsky algorithm uses lower comparisons than Cohen-Sutherland, but in general it performs more additions, products and divisions. In practice, LB is the slowest algorithm. The Cohen-Sutherland algorithm is a bit faster. Nycholl-Lee-Nycholl is the fastest one since it performs the lowest amount of instructions among all the traditional algorithms analysed. The FPC algorithm does more comparisons than the NLN, but it uses lower additions or subtractions. On the other hand, FPC always uses a lower or equal amount of products or divisions than NLN does. For this reason, in practice, the FPC algorithm is faster.

The constant sampling frequency was fixed around every 5 screens and the adaptive frequency could change between 1 and 32 screens. It doubled if a change appeared. It changed to a half if no changes were observed during two consecutive plannings.

4.1.4 General results


The Table 1 shows the time spent by each algorithm. Results are in seconds. The known algorithms confirm the awaited results. So, the Cyrus-Beck algorithm is the worst one closely followed by LiangBarsky. The best is Cohen-Sutherland. It doubles Liang-Barsky speed. The FPC average value reduces the best traditional computational cost down to 40%. That is, 250% speed up.

4.1.3 Comparisons
The theoretical computational cost showed that the FPC algorithm was the fastest but, it was not clear how the different monitoring possibilities could influence the clipping efficiency. On the other hand, it was important to verify empirically the theoretical studies. So, we tested all the algorithms in the laboratory using a synthetic load. It simulated a real clipping situation, equal for all of them. The tested algorithms were Cohen-Sutherland [New79], CyrusBeck [Rog85] and Liang-Barsky [Lia84]. The FPC algorithm was tested under the following monitoring conditions: o o Never monitoring and always giving priority to rejection. (FPC Never RA) Never monitoring and always giving priority to acceptation. (FPC Never AR)

4.1.5 General comparison between different monitoring policies


Monitoring overload was a unitary increment after every line drawing. The planning algorithm was called after a whole screen drawing. In this sense, it can be said that the planning overhead computational cost is not worthwhile compared to the monitoring overhead. So, the different clipping algorithms analysis is finally reduced to determine which the best suitable monitoring frequency is. The test worked with clipping windows never higher than 50% the total projection surface. For this reason, many of the lines were projected on average outside

the clipping window. The tests were based on very homogeneous line distributions. Algorithm CS CB LB FPC Never RA FPC Never AR FPC Continuous FPC Constant FPC Adaptive Average FPC Minimum Maximum Average 4.53 14.46 8.83 0.98 1.175 1.32 1.23 1.2 1.18 7.3 18.83 18.17 5.82 4.28 5.21 4.83 4.78 4.98 5.47 16.05 12.32 2.37 2.48 2.65 2.59 2.57 2.53

Dynamic monitoring has proven to be a good idea that can be exported to any other kind of algorithms in order to improve efficiency. This algorithm can be upgraded to use SIMD instructions in parallel, increasing its speed even more.

6. ACKNOWLEDGMENTS
Our thanks to TIC-1999-0510-C02-01 project from Spanish Ministry of Science and Technology and PPI-UPV program for allowing us to develop this material.

7. REFERENCES
[Ake88] K. Akeley and T. Jermoluk. "High Performance Polygon Rendering". Computer Graphics (ACM SIGGRAPH) Vol. 22 No. 4, Pg. 239-246, 1988 [And91] Andreev, R. D., Sofianska, E. New algorithm for two-dimensional line clipping, Computer & Graphics 15, No. 4, pp. 519-526, 1991 [Bui98] Bui, D. H. and Skala, V. Fast Algorithms for Clipping lines and Line Segments in E2, The Visual Computer 14, No. 1. pp. 31-38. 1998 [Bui99] Bui, D. H. and Skala, V. New Fast Line Clipping Algorithm in E2 With O(lgN) Complexity, International Conference SCCG'99, Budmerice, Slovakia, pp. 221-228, 1999 [Dor90] Drr, M. A new approach to parametric line clipping, Computer & Graphics 14, No. 3/4 pp. 449-464, 1990 [Duv93] Duvanenko, V. J., Gyurcsik, R. S., Robbins, W. E. Simple and efficient 2D and 3D span clipping algorithms, Computer & Graphics 17, No. 1, pp. 39-54, 1993 [Kai90] Kaijian, S., Edwards, J. A., and Cooper, D.C. An efficient line clipping algorithm, Computer & Graphics 4, No. 2, pp. 297-301, 1990 [Lia84] Liang , Y-D. and Barsky , B. A. A new concept and method for line clipping, ACM Transactions Graphics 3, No. 1. pp. 1-22, 1984 [Mol01] Moll, R. and Viv, R. The stair algorithm, Journal Graphics Tools 6, No. 2. pp.17-25, 2001 [Mol01b] Moll, R. Applications of the fixed-point arithmetic to the representation of low level graphical primitives, ISBN: 0-493-43368-6, 2001. Ph D. free full text in pdf format in wwwlib.umi.com/dissertations/fullcit/3030618 [New79] Newman, W. M. and Sproull, R. F. Principles of Interactive Computer Graphics, McGraw-Hill International Editions. 2nd Edition. ISBN 0-07-046338-7, 1979 [Nic87] Nicholl, Tina M., Lee, D.T. and Nicholl, R. A. An efficient new algorithm for 2-D line

Table 1. Clipping timing given by different FPC implementation and traditional algorithms Those algorithm implementations that improve rejection instead of acceptation have a better result. If no monitoring is made, the result is even better. Thus, the algorithm FPC Never AR offers worse performance than FPC Never RA. The more frequent the monitoring is, the slower the algorithm performs. For this reason, the continuous monitoring offers worse timing than the constant one. Constant monitoring is worse than adaptive and this one is worse than those algorithm that never use monitoring. That is, TNRA < TNAR < TAdap < TCte < TCont Using monitoring does not change the algorithm cost significantly. Differences are around 8% on average. The FPC algorithm is based on a change of the clipping priority taking into account only the previous result. For this reason, sometimes, erroneous decisions may be taken, punishing performance.

5. CONCLUSIONS
Tests confirm conclusions seen in the bibliography respect to the algorithms CS, CB, LB and NLN. Theoretical analysis shows that the FPC is computationally more efficient than the other solutions. Empirical tests verify these results. The FPC algorithm can clip lines with decimal ends apart from integer values. Fixed-point clipping is more precise than the integer one since no decimal part is lost during the floating to integer conversion (Clipping in object space vs. image space). The FPC algorithm reuses calculations so that fixedpoint arithmetic intermediate values can be used subsequently by line drawing algorithms like the stair algorithm [Mol01]. 32 bits fixed-point arithmetic has shown enough precision (12E-6 pixels) to manage properly the line projected onto the screen.

clipping: its development and analysis, Computer Graphics 21, No. 4,, pp. 253-262, 1987 [Rog85] Rogers, D. F. Procedural elements for computer graphics, McGraw-Hill, New York, 1985 [Ska93] Skala, V. An efficient algorithm for line clipping by convex polygon, Computer & Graphics 17, No. 4. pp. 417-421. 1993 [Ska94] Skala, Vclav, O(lgN) Line Clipping Algorithm in E2, Computer & Graphics 18, No. 4. pp. 517-524. 1994

[Ska96] Skala, V. Line Clipping in E2 With O(1) Processing Complexity, Computer & Graphics 20, No. 4. pp. 523-530. 1996 [Ska99] Skala, V. and Bui, Duc Hui, Two New Algorithms for Line Clipping in E2 and Their Comparison, Technical Report TR No. 108/99 University of West Bohemia, Plzen, Czech Republic [Sob87] Sobkow , M. S., Pospisil , P. y Yang, YeeHong. A fast two dimensional line clipping algorithm via line encoding Computer & Graphics 11, No. 4, pp. 459-467. 1987

You might also like