System and method for rendering bézier splines

Abstract: A high speed and memory efficient method and system for determining with a computer when a curve defined by a set of Bézier control points is sufficiently approximated by a line segment so that the reduction of the Bézier curve into smaller curves can stop. The method is readily implemented on a computer using vectors formed using vector addition and subtraction and is applicable to Bézier curves of any order.

Description: The present invention relates to a computer graphics system and method for rendering Bézier splines. More specifically, the present invention relates to a system and method for simulating a curve on a computer graphics system by approximating a Bézier spline with a finite sequence of straight line segments. Computer systems are highly useful for compiling and assimilating large amounts of data. Computer systems frequently include graphic displays capable of displaying curves. Figure 1 illustrates a curve 2 that may be displayed on a typical graphics display system. Graphics display systems generally include a memory for storing a digital representation of the curve to be displayed. In a primitive system this might include an extremely large memory that stores a digital value which represents the curve to be displayed. A high-resolution display system using this method would require an extremely large memory. Such a primitive system would be too slow when initially generating the digital values which represent the curve, and would also be slow when manipulating the curve, such as when the curve is rotated or relocated on the display. Because of these problems, many computer display systems utilize the Bézier spline method of modeling curves. A Bézier spline, often referred to as a Bézier curve, is a mathematical construct for curves and curved surfaces. The most frequently used Bézier curve for two-dimensional graphic systems is the cubic Bézier curve. A cubic Bézier curve requires four control points which define the curve. Once the four points are specified, the curve is defined. However, as is well known to those skilled in the art, higher order Bézier curves may be used to create highly complex curves in two, three or higher dimensions. To use cubic Bézier curves to construct an arbitrary curve such as curve 2 of Figure 1, the curve may be partitioned into a number of individual arcs. This is illustrated in Figure 1 wherein the curve 2 is divided into three arcs. Between points 4 and 6 curve 2 is divided into an arc 8, between points 6 and 10 curve 2 is divided into an arc 12, and between points 10 and 14 curve 2 is divided into an arc 16. To construct the arc 8 using a cubic Bézier curve, the arc end points 4 and 6 plus two additional points, control points 18 and 20, are selected. By properly selecting the control points 18 and 20 and the end points 4 and 6, the arc 8 can be generated using a well known reiterative process. This process is repeated for arcs 12 and 16 and their selected control points. Thus, the curve 2 can be defined by ten Bézier control points. In a similar manner, almost any desired curve can be generated from a set of selected control points using the Bézier curve technique. While Bézier curves permit a curve to be described by a small set of data points, when the Bézier curve itself is to be displayed on a display screen the data values for the sequence of points on the display screen, called pixels, that trace out the curve must be specified. Since determining each and every data point on an arc of a curve is a slow, computationally inefficient process, it has been found highly beneficial to approximate the Bézier curve. An advantage of doing this is that the Bézier curve can be approximated very closely by a finite set of line segments. The number of line segments required depends upon several factors including the rate of curvature of the desired curve and the resolution of the display screen. Approximating an arc by a finite set of straight lines segments is particularly advantageous because determining the set of points comprising a line segment can be done very efficiently. The reduction of a Bézier curve into a set of straight line segments that approximates the curve, or at least an arc of the curve, is called "rendering" the curve. Note that the above discussion is equally applicable to printers as well as display screens. The pixel size on a typical laser printer is different from the pixel size on a typical video display screen. However, the same problems encountered in rendering a Bézier curve on a display screen are present when rendering a curve on a laser printer or any other type of graphics printer. A typical prior art method of rendering the Bézier curve is illustrated in Figure 2 wherein an arc 22 is to be closely approximated by a set of line segments. Two control points referred to as end points 24 and 26 of the arc 22 together with control points 28 and 30 define the arc 22 via a cubic Bézier curve. These four control points are determined in a well known manner. The initial step in rendering the curve is to determine whether the line segment 38 extending between points 24 and 26 is a "close enough" approximation to the arc 22 that the line segment can be displayed as an approximation of the arc 22. If the line segments are within the resolution of the display screen ( i.e ., within a pixel of where the actual arc should be located on the screen), then further computations will yield no improvement in the display. The actual resolution depends on the display device. For example, on a typical video display terminal, there are 72 pixels per inch, while a laser printer has 300 or even 600 pixels per inch. Thus, the degree of accuracy of calculations depends on the display device. A typical prior art method of determining the amount of error is to form a line segment 38 extending between points 24 and 26. Then the magnitude of a line segment 40, perpendicular to line segment 38 and extending through control point 28, and the magnitude of a line segment 42, also perpendicular to line segment 38 but extending through point 30, are determined. The magnitudes of the line segments 40 and 42 are then checked as to whether they are both smaller than a predetermined test magnitude, such as the dimension of one pixel. If line segments 40 and 42 are both smaller than the test magnitude, the line segment 38 is deemed to be a close enough approximation of the arc 22 that it can be displayed as the arc. However, if the magnitude of either of the line segments 40 or 42 is greater than the test magnitude, the line segment 38 is not a sufficiently accurate representation of the arc 22 and is an unsuitable approximation of the arc for display purposes. In that event, the arc 22 is subdivided into two parts, each defined by four control points. The four control points for each part are determined as follows. First, the midpoint of each of line segments 32, 34, and 36 is determined, specifically points 44, 46, and 48, respectively. Next the midpoints of line segments extending between points 44 and 46 and between points 46 and 48 are determined, specifically points 50 and 52, respectively. Finally, the midpoint of a line segment 54 drawn between the points 50 and 52 is determined, that point being point 56. The arc 22 passes through point 56. At point 56, the arc 22 is tangent to the line segment 54 connecting points 50 and 52. The two portions of the arc 22 can now be defined. The first portion 22a of arc 22 is defined using points 24, 44, 50, and 56 as Bézier control points and the second portion 22b of arc 22 is defined by using points 56, 52, 48, and 26 as Bézier control points. After the two portions 22a and 22b of arc 22 are found, the line segments between the Bézier end points 24 and 56 for curve portion 22a and 56 and 26 for curve portion 22b, respectively are then tested using the procedure described above to determine whether they are a sufficiently accurate approximation of their respective arc portions 22a and 22b that they can be used to display that portion of the arc 22. If one or more of the arc portions are not defined closely enough by a line segment drawn through the respective control points, the Bézier curve for that arc portion is subdivided using the above procedure. The procedure is reiterated until each portion of the arc 22 is deemed to be closely enough approximated for display purposes by a resulting set of line segments. By continuing the above process it is possible to approximate the arc 22 to any desired degree of accuracy. It is very important to stop the rendering of the Bézier curve when a given set of line segments approximate the arc with sufficient accuracy that a more accurate set of line segments is not required. This is because of the very large number of mathematical operations required to render a highly accurate curve, because most computer graphics systems, whether display screens or printers, are typically low resolution devices, because the amount of memory required to store the resulting set of line segments grows quickly as the accuracy of the approximation increases, and because of the finite speed of computer graphic systems. The above prior art technique of determining when a set of line segments closely approximates a Bézier curve is computationally inefficient. The prior art technique requires the determination of the lengths of the line segments 40 and 42. It requires in each reiteration finding of the shortest distance between two Bézier control points and a line segment, such as control points 28 and 30 and the line segment 38. To do this, the location of points 57 and 58 must be determined so that the magnitudes of the line segments 40 and 42 can be calculated. Calculating the location of points 57 and 58 is computationally inefficient; this inefficiency becomes highly pronounced when performed the large number of times required by some computer graphic displays when rendering the curve. Another prior art method of rendering a Bézier curve is to repeatedly subdivide a curve, without performing a closeness test, until the individual line segments between control points are only one pixel long. This method results in a curve that is as accurate as the resolution of the display device and does not require a calculation and comparison of the line segment lengths described above. However, this technique often results in many more iterations of subdivision being performed than are truly necessary to satisfactorily approximate the curve. Thus, this technique also has the disadvantage of being slow. Therefore, it would be useful to have a computationally efficient method of determining the accuracy with which a set of line segments approximate a Bézier curve. M. Okamoto el al., "A Cubic Curve Generation LSI," Fujitsu Science Technology Journal , 26, 2, pp. 115 - 122 describes an error calculation method for cubic Bézier curves or cubic B-spline curves. The error is calculated from the co-ordinates of four control points by evaluating the difference between the midpoint of the outer control points and the midpoint of the inner control points. The calculation is executed by add, subtract and bit shift operations. EP 0 376 317 A2 describes a Bézier curve generator using the same error calculation. Moreover, the x and y co-ordinates of the four control points are evaluated separately. It is the object of the invention to provide a computationally efficient computer graphics system and operating method for generating an approximation to a Bézier curve having any number of sequential Bézier control points. This object is solved by the subject matters of independent claims 1 and 8. Preferred embodiment are defined by the dependent claims. The inventive method determines when a set of sequential line segments between Bézier curve end points sufficiently approximates a curve defined by the Bézier control points so that the error between the approximation and the actual curve is smaller than a specified test magnitude and the process of dividing the Bézier curve into smaller Bézier curves can stop. The method includes the steps of forming construction vectors between the Bézier control points, starting at one end of the curve. The first construction vector has a magnitude and direction defined by the magnitude and direction from the first to the second Bézier control points. Subsequent construction vectors have a magnitude and a direction defined by the magnitude and direction from the second to the third Bézier control points, and so on. A number of error vectors are formed, depending on the order of the Bézier curve. The first error vector has a magnitude and direction defined by subtracting the first construction vector from the second construction vector. Subsequent error vectors are defined by subtracting the second construction vector from the third construction vector, and so on. Finally, whether the line segment connecting the first Bézier control point with the last Bézier control point sufficiently approximates the curve defined by the Bézier control points is determined by comparing the magnitudes of the error vectors or functions of the error vectors with the test magnitude. If the magnitudes of each of the error vectors or error functions is smaller than the test magnitude, it is known that the set of sequential line segments sufficiently approximates the curve defined by the Bézier control points that further rendering of the curve is not necessary. If the magnitude of any of the error vectors or functions exceeds the test magnitude, the inventive method subdivides the Bézier curve according to techniques well known in the art, and applies the inventive method to each portion of the subdivided curve independently of other portions until all portions of the curve are rendered with sufficient accuracy. The inventive method may be easily implemented on a computer. Computers are very efficient in addition and subtraction. The system of the present invention uses vector addition and subtraction to create error vectors. The system compares the magnitude of the error vectors to a preselected test magnitude and indicates whether the magnitude of any of the error vectors exceeds the test magnitude. If the magnitude of any of the error vectors exceeds the test magnitude, the system will subdivide the curve according to principles well known in the art and the system will create a new set of error vectors for each subdivided portion of the curve. The system analyzes error vector magnitudes independently for each portion of the curve until the magnitudes of all error vectors for that portion of the curve are each less than the test magnitude. At that point the system draws straight line segments between the Bézier control points that define that particular portion of the curve. Other features and advantages of the present invention will become apparent from the following more detailed description, taken in conjunction with the accompanying drawings. Figure 1 is an illustration of how an arbitrary curve can be divided into a subset of smaller arcs. Figure 2 illustrates an arc of the curve of Figure 1 defined by a cubic Bézier curve, how that arc can be approximated by a single line segment connecting the first and last Bézier control points, and how a prior art method checks the approximation for accuracy. Figure 3 is a block diagram of the preferred apparatus for practicing embodiments of the present invention. Figure 4 illustrates the curve of Figure 2 defined by four Bézier control points. Figure 5 illustrates the use of vectors in rendering the Bézier curve of Figure 2. Figure 6 illustrates the Bézier curve of Figure 2 and the inventive method for determining the accuracy of the rendered curve. Figure 7a illustrates two typical vectors added together to produce a third vector. Figures 7b and 7c illustrate the X and Y rectangular components of the two vectors of Figure 7a which are added together to produce the third vector. Figure 7d shows the graphical solution of adding the X and Y components of the two vectors shown in Figures 7b and 7c. Figure 8 illustrates the technique used to subdivide the Bézier curve of Figure 6 if the rendered curve is not sufficiently accurate. Figure 9 illustrates a second order Bézier curve and the inventive method for determining the accuracy of the rendered curve. Figure 10 illustrates the process of subdividing the second order Bézier curve of Figure 9 if the rendered curve is not sufficiently accurate. Figure 11 illustrates the inventive method for determining the accuracy of a fourth order Bézier curve. Detailed Description of the Invention The present invention relates to the determination of when a set of line segments connecting Bézier curve end points is a sufficiently accurate approximation of a curve defined by the Bézier curve control points so that the process of dividing the Bézier curve into smaller curves can stop. The inventive method of determining whether a Bézier curve is sufficiently approximated by a line segment is performed in a computationally efficient manner. As with related prior art methods, the present invention requires that an accuracy value, hereinafter called the test magnitude, be predetermined. The test magnitude determines the degree of accuracy with which the line segments approximate the Bézier curve. The actual value of the test magnitude is usually selected in relation to the resolution of the graphics display screen or printer being used, although any test magnitude value can be used. If the line segments fall within a pixel of the actual curve, then the system can end the calculations because additional calculations will not yield a more accurate approximation. As previously discussed, the degree of resolution depends on the display device with a pixel on a video display having a different physical size than a pixel on a typical laser printer. The present invention works equally well with display devices of any resolution. The present invention relates to methods and systems for converting a curve defined by Bézier control points into a sequence of line segments. Thus, the present invention is embodied in the computer graphics system 100, shown in Figure 3. A typical initial set of inputs to the Bézier curve renderer 116 is shown in Figure 4, specifically, the four Bézier control points 200, 202, 204, and 206, which define a cubic Bézier curve 208. To assist in understanding the differences between the inventive methods and the prior art, the four control points, and curve 208 defined by those control points, are the same as the points 24, 26, 28, and 30, and the arc 22 of Figure 2. A problem with using prior art methods to determine if line segment 38 of Figure 2 is a sufficiently accurate approximation of the arc 22 is the computational inefficiency of determining the magnitudes of the line segments 40 and 42. At least part of this problem is related to the necessity of determining the location of points 57 and 58. The inventive methods avoids the necessity of finding comparable points and reduces all calculations to the determination of vector magnitudes, as will be described in detail below. The curve 208 in Figure 4 is approximated by the line segment 205 drawn between Bézier end points 200 and 206. The system and method of the present invention relate to a technique for determining the accuracy of the approximation. According to a preferred embodiment of the invention, the four Bézier control points, 200, 202, 204, and 206 which define Bézier curve 208 are used to define three vectors as shown in Figure 5. A first construction vector 210 is defined using the magnitude and direction from control point 200 to control point 202. A second construction vector 212 is defined using the magnitude and direction from control point 202 to control point 204. A third construction vector 214 is defined using the magnitude and direction from control point 204 to control point 206. As will be described below, in addition to these vectors, four other vectors 218, 220, 222, and 224 are shown in Figure 6, and have magnitudes and directions defined relative to a selected origin 216 of the display screen being used and control points 200, 202, 204, and 206. For ease of understanding, the operation of the invention will be described using a graphical solution, although in actuality the invention is practised by the computer graphics system 100 (shown in Figure 3) using vector mathematics. With these vectors defined, the first construction vector 210 is relocated so that its tall coincides with control point 202, thus creating vector 210'. The tip of vector 210' terminates at a point 226. The second construction vector 212 is relocated with its tall coincident with control point 204, thus creating a vector 212'. The tip of vector 212' terminates at a point 228. An error vector 230 is then defined with a magnitude and direction extending from the point 226 to the control point 204 by vector subtraction of the vector 210' from the vector 212. In addition to the error vector 230, another error vector 232 is defined with a magnitude and direction extending from the point 228 to the control point 206 by vector subtraction of the vector 212' from the vector 214. The error vectors 230 and 232 can also be easily calculated as sums and differences of the other previously defined vectors relative to the origin 216 of the display screen. Error vectors 230 and 232 can also be expressed in terms of vectors 218, 220, 222 and 224, as follows: Error Vector 230 = Vector 212 - Vector 210' = (Vector 222-Vector 220) - (Vector 220-Vector 218) = Vector 222 - 2(Vector 220) + Vector 218 Error Vector 232 = Vector 214 - Vector 212' = (Vector 224-Vector 222) - (Vector 222-Vector 220) = Vector 224 - 2(Vector 222) + Vector 220 In such fashion, the error vectors 230 and 232 are easily calculated even when making reference to an origin 216 which does not coincide with control point 200. With either approach the same results are achieved. The above explanation depicts the present invention using a graphical solution in order to more clearly define the nature of the invention. In simple mathematical terms, the error vector 230 is simply the difference between the first and second construction vectors 210 and 212, and is defined mathematically by subtracting the first construction vector 210 from the second construction vector 212. In the same manner, the error vector 232 is defined mathematically by subtracting the second construction vector 212 from the third construction vector 214. Of course, while the repositioned equivalent vectors 210' and 212' were used to facilitate a graphical solution, the mathematical results are the same whether using the repositioned vectors or the corresponding original construction vectors 210 and 212 discussed above. It should be noted that the principles of the present invention may be applied to a Bézier curve with the same results starting at either end of the curve. According to a preferred embodiment of the present invention, the line segment 205 extending between the control points 200 and 206 will approximate the arc 208 sufficiently close when the magnitudes of both of the error vectors 230 and 232 are both less than the test magnitude. By using the magnitudes of the error vectors 230 and 232, it is no longer necessary to locate the points 57 and 58 and determine the magnitudes of the line segments 40 and 42 in Figure 2 when determining whether the Bézier curve rendered is sufficiently accurate to be satisfactory for display. It is clear to those of ordinary skill in the art that one could use as an error criterion, any function of the error vectors that becomes small if and only if both error vectors become small. For example, instead of the magnitude of the error vectors 230 and 232, one could look at the magnitude of any two linearly independent combinations of the two error vectors. It is well known in mathematics that vectors may be resolved into their respective X and Y rectangular components and that the X and Y components of two vectors can be independently added or subtracted to arrive at the sum or difference of the vectors. In Figure 7a, for example, vector 302 is shown added to vector 304 to produce vector 306. As shown in Figure 7b, vector 302 may be resolved into an X component 302X, and a Y component 302Y. Similarly, as shown in Figure 7c, vector 304 can be resolved into two components, 304X and 304Y. A graphical solution is illustrated in Figure 7d, with vector 306 having an X component which is the sum of the X components 302X and 304X, and a Y component which is independently calculated and is the sum of the Y components 302Y and 304Y. Mathematically, this is represented by the following formulas: Vector 306 = Vector 302 + Vector 304 Vector 306X = Vector 302X + Vector 304X Vector 306Y = Vector 302Y + Vector 304Y In a like manner, one vector may be subtracted from another vector by independently subtracting the X and Y components. It follows from the above description and Figures 7a-7d that the error vectors 230 and 232 can be determined using only addition and subtraction, functions which are very efficiently performed by computers. It is noted that the actual magnitudes of the error vectors 230 and 232 is mathematically calculated by taking the square root of the sum of the squares of the X and Y components. This is a time and memory consuming calculation for a computer compared to simple addition and subtraction. In the preferred embodiment this calculation is not used to determine the actual magnitude of the error vectors 230 and 232 for comparison with the test magnitude, but rather the comparison is made using the larger of the X or Y component of each error vector. Thus, the magnitude (or scalar component) of the largest X or Y component of each of the error vectors 230 and 232 is compared to the test magnitude when determining whether the line segments are a close enough approximation to the Bézier curve that the line segments can be satisfactorily used to graphically represent the curve on the screen display or printer. If either the magnitude of the X or Y component of the error vector 230 or the error vector 232 exceeds the test magnitude, further subdivision of the Bézier curve is required. However, when both the X and Y components of both of the error vectors 230 and 232 are less than the test magnitude, the line segment 205 between control points 200 and 206 is a sufficiently close approximate to the Bézier curve 208 that it can be used for display purposes. This, of course, requires that the test magnitude be selected with the understanding that it will be compared with the magnitude of the largest X or Y component of the error vectors 230 and 232, rather than to the magnitude of these error vectors. If the line segment 205 between the Bézier control points 200 and 206 does not adequately approximate the Bézier curve 208, the Bézier curve is subdivided, as shown in Figure 8, and the process is repeated as many times as necessary until the curve is sufficiently approximated by a set of line segments. In Figure 8, if the rendered Bézier curve is not sufficiently accurate, the curve 208 is subdivided according to the known principles of the prior art. The midpoints of the three line segments drawn between the four control points 200, 202, 204 and 206 are determined, those points being points 234, 236 and 238, respectively. Next, the midpoints of the line segments drawn between points 234 and 236 and between points 236 and 238 are determined, these being points 240 and 242, respectively. Finally, the midpoint of a line segment 244 drawn between the points 240 and 242 is determined, that point being point 246. The arc 208 passes through point 246. At point 246, the arc 208 is tangent to the line segment 244 connecting points 240 and 242. Thus, curve 208 has been divided into two arcuate portions, arc 208a and arc 208b, each of which is defined by four Bézier control points. Arc 208a is defined by control points 200, 234, 240 and 246, while arc 208b is defined by control points 246, 242, 238 and 206. A line segment 207 drawn between Bézier end points 200 and 246 is tested by the same technique described above to determine if the line segment 207 is a sufficiently accurate approximation of arc 208a Similarly, line segment 209 is tested as an approximation of arc 208b. The Bézier curve is rendered using principles of the present invention independently for each of the arcs 208a and 208b until the rendered Bézier curve is a satisfactory approximation for display purposes using the test magnitude selected. The system and method of the present invention utilize the prior art technique of subdividing a Bézier curve to render the curve. However, the present invention uses a dramatically different approach in analyzing the amount of error in the rendered curve. The vector approach of the present invention to accomplish error analysis greatly increases the speed at which the graphic system 100 can render a Bézier curve. Furthermore, the system and method of the present invention will only subdivide a Bézier curve as often as required to render the curve to within the accuracy of the particular display device being used. It should also be noted that the same vector error analysis may be utilized with Bézier curves of any order. For example, the most simple Bézier curve is a second order Bézier curve, shown in Figure 9, which is defined by only three control points. Control points 300, 302 and 304 define the Bézier curve 306 and define the endpoints for the line segment 312 extending between the Bézier end points 300 and 304 that is used to approximate the curve 306. In a second order Bézier curve, the present invention uses only a single error vector to determine the accuracy of the rendered curve. In a manner similar to the technique for a cubic Bézier curve, a first construction vector 308 is defined using the magnitude and direction from control point 300 to control point 302. A second construction vector 310 is defined using the magnitude and direction from control point 302 to control point 304. The first construction vector 308 is relocated with its tall at control point 302, thus creating vector 308' with its tip terminating at a point 311. An error vector 313 is defined with a magnitude and direction extending from the point 311 to the control point 304. The error vector 313 is defined mathematically by vector subtraction of the vector 308' (or in reality, the first construction vector 308) from the second construction vector 310. As before, error vector 313 can be defined in terms of vectors extending from an origin of the display screen that does not coincide with the control point 300. According to the principles of the present invention, it is not necessary to actually calculate the magnitude of the error vector 313. As described above, the larger of the X or Y rectangular component of error vector 313 is compared to the test magnitude to determine the accuracy of the rendered curve. If the larger of the X or Y component of error vector 313 exceeds the test magnitude, the Bézier curve 306 is subdivided according to the prior art procedure described above as shown in Figure 10. First, the midpoints on the two line segments drawn between control points 300, 302 and 304 are determined, those points being points 314 and 316, respectively. Next, a line segment 318 is drawn between points 314 and 316. Finally, the midpoint of the line segment 318 is determined, that point being point 320. The arc 306 passes through point 320. At point 320, the arc 306 is tangent to the line segment 318 connecting points 314 and 316. Thus, the curve 306 has been subdivided into two arcuate portions, arc 306a and arc 306b, each of which is defined by three Bézier control points. Arc 306a is defined by control points 300, 314 and 320, while arc 306b is defined by control points 320, 316 and 304. Line segments 320 and 322 are seprately tested to determine if they are sufficiently accurate to be used as approximations of arcs 306a and 306b, respectively. The Bézier curve is rendered using principles of the present invention independently for each of the arcs 306a and 306b until the rendered spline for the curve 306 is a satisfactory approximation for display purposes using the test magnitude selected. As previously discussed, it is clear that one could use as an error criterion, any function of the error vectors that becomes small if and only if all N-1 error vectors in an Nth order Bézier curve become small. For example, instead of the magnitude of the error vectors, one could look at the magnitude of any N-1 linearly independent combinations of the N-1 error vectors. Similarly, the present invention will work with higher order Bézier curves, with the only difference being the number of error vectors that must be compared to the test magnitude. Figure 11 shows a fourth order Bézier curve 410, which is defined by five control points 400, 402, 404, 406 and 408, respectively. A fourth order Bézier curve, rendered according to the principles of the present invention, will have three error vectors. According to the principles of the present invention, construction vectors 412, 414, 416 and 418 are formed between the five control points. Assuming that control point 400 is chosen as the origin for the screen display, three additional vectors 420, 422 and 424 are shown with their tails located at the origin 400 and their tips located at Bézier control points 404, 406 and 408, respectively. As previously discussed, the error vectors can be determined using either set of vectors. In the same manner described before, using a graphical solution for purposes of illustration, vector 412 is relocated with its tail coincident with control point 402, thus creating a vector 412'. The tip of vector 412' terminates at a point 426. A first error vector 432 is defined with a magnitude and direction extending from point 426 to the control point 404. Similarly, vectors 414 and 416 are relocated with their tails coincident with control points 404 and 406, respectively, thus creating vectors 414' and 416'. The tips of these vectors 414' and 416' terminate at the points 428 and 430, respectively. A second error vector 434 is defined with a magnitude and direction extending from between point 428 to the control point 406. Likewise, a third error vector 436 is defined with a magnitude and direction extending from point 430 to the control point 408. Again, it should be noted that the first error vector 432 is defined mathematically by subtracting the first construction vector 412 from the second construction vector 414; the second error vector 434 is defined mathematically by subtracting the second construction vector 414 from the third construction vector 416; and the third error vector 436 is defined mathematically by subtracting the third construction vector 416 from the fourth construction vector 418. The same general process is used for any order of Bézier curve. As before, each of the error vectors 432, 434 and 436 can be defined in terms of vectors drawn between an origin, shown in Figure 11 as control point 400, or any other point. While different orders of Bézier curve have different number of error vectors (a cubic Bézier curve has two error vectors, a fourth order Bézier curve has three error vectors), the process of error vector calculation and subdivision of the Bézier curve is continued until the magnitude of each error vector is less than the test magnitude. As previously discussed, the present invention does not require a determination of the actual magnitude of error vectors 432, 434 and 426. It is only necessary to determine that the larger of the X or Y component for each error vector is less than the test magnitude. If all three values for the error vectors are less than the test magnitude, then the rendered curve is deemed to be a sufficient approximation for display purposes. If any of the X or Y components of the error vectors exceed the value of the test magnitude, the Bézier curve is subdivided according to the well known technique of the prior art so as to provide an even closer fit to the Bézier curve 410. The first subdivision of the curve 410 will be divided into two arcs, each of which is defined by five control points. The error vector calculation is then performed independently for each of the two arcs. The process of subdivision and error vector calculation is repeated as many times as necessary until the magnitude for each of the error vectors for a given arc is less than the test magnitude. The present invention can operate on Bézier curves of any order, the only difference being the number of error vectors generated in the process. It should be noted that the inventive process may be used on any order of Bézier curve starting at either end of the Bézier curve. The preferred apparatus for implementing the invention is Illustrated in Figure 3, which shows a simplified block diagram of the computer graphics system 100. The graphics system 100 includes a central processing unit (CPU) 102, and a memory 104 which stores digital values representing the control points of a Bézier curve that is to be displayed as well as the value of the selected test magnitude 106. As directed by the CPU 102, which is connected to other elements of the system via a bus 108, the data within the memory is transferred, via bus 108, to a Bézier curve renderer 116. The Bézier curve renderer converts the Bézier end points into a set of line segments, each defined by two points, that approximates the curve defined by the Bézier control points to a degree controlled by the test magnitude 106. The vector generator 110 defines the construction vectors and vectors from an origin to the Bézier control points. An error function calculator 112 calculates the error vectors by subtracting construction vectors or vectors from the origin to the Bézier control points as previously discussed. Alternatively, the error function calculator 112 may calculate functions of the error vectors as an indicia of accuracy instead of the error vectors themselves. The comparator 114 determines whether the magnitude of an error function, an error vector, or an error vector component, is less than the test magnitude. If all error magnitudes are less than the test magnitude, the line segment drawn between the Bézier end points may be used to approximate the Bézier curve. In that event, the Bézier curve renderer 116 applies the two points which define the line segment to a line segment generator 118, which converts the two points into a plurality of data values corresponding to the line segment. The data values are processed by the display driver 120 and applied to a graphic display 122, such as a CRT, a laser printer, or the like, which displays a graphic image 124, which is a visual representation of the curve defined by the Bézier control points in the memory 104. If the comparator 114 indicates that any one of the error magnitudes exceeds the test magnitudes 106, the curve is subdivided into two portions according to principles well known in the art. The system then operates independently on the two portions of the curve by the process described above. The Bézier control points stored in the memory 104 may be obtained from a wide variety of sources such as a conventional application software package, a digitizing unit, or the like. All of these sources are generically represented by input block 126. The present invention may be used on Bézier curves of two or more dimensions. A three dimensional Bézier surface is defined by two independent orthogonal Bézier curves. By applying the principles of the present invention independently to each Bézier curve, a three dimensional Bézier surface may be easily rendered.

Claims: A method for operating a computer graphics system to generate an approximation to a Bézier curve (208, 306, 410) being defined by a variable number, N, of sequential Bézier control points (200 - 206, 300 - 304, 400 - 408), the method comprising the steps of: calculating a set of N-2 error values, each based on an error vector (230, 232, 313, 432 - 436), each said error vector having a magnitude and direction based on a difference between a construction vector in a sequence of N-1 construction vectors (210 - 214, 308, 310, 412 - 418) and the next construction vector in the sequence, each of said construction vectors being defined by a sequential pair of the Bézier control points, each said construction vector having a magnitude defined by the distance between the Bézier control points in the sequential pair and a direction from one of the Bézier control points of the pair to the other; comparing each of said N-2 error values with a test magnitude indicative of a desired degree of accuracy in approximating the Bézier curve; and using the Bézier control points to draw a sequence of line segments between the Bézier control points to approximate the Bézier curve if said N-2 error values are each less than said test magnitude. The method according to claim 1, further comprising the steps of subdividing the Bézier curve to generate a second set of N sequential Bézier control points representative of a portion of the curve if any of the N-2 error values is larger than said test magnitude, and repeating the steps of calculating and comparing using said second set of Bézier control points. The method according to claim 1 or 2, wherein the steps of comparing said error values with said test magnitude and using the Bézier control points include the steps of: resolving vector components of each of said N-2 error vectors; determining the magnitudes of the resolved vector components; and using all of said magnitudes of said resolved vector components as error values. The method according to claim 1 or 2, wherein the steps of comparing said error values with said test magnitude and using the Bézier control points include the steps of: determining the vector components of each of said N-2 error vectors; selecting for each of said error vectors the largest vector component; and using the selected vector components of each of said error vectors as error values. The method according to one of claims 1 to 4, wherein the value of N is 4. The method according to one of claims 1 to 5 wherein each of said error vectors has a magnitude and direction defined by subtracting a construction vector in a sequence of N-1 construction vectors from the next construction vector in the sequence. The method according to one of claims 1 to 5 wherein each of said error vectors has a magnitude and direction defined by subtracting vectors (218-224) between a predetermined point (216) and end points (200-206) of a construction vector in a sequence of N-1 construction vectors from vectors (218-224) between said predetermined point and the next construction vector in the sequence. A computer graphics system for generating an approximation to a Bézier curve (208, 306, 410) being defined by a variable number, N, of sequential Bézier control points (200 - 206, 300 - 304, 400 - 408), the system comprising: means (112) for calculating a set of N-2 error values, each based on an error vector (230, 232, 313, 432 - 436), each said error vector having a magnitude and direction based on a difference between a construction vector in a sequence of N-1 construction vectors (210 - 214, 308, 310, 412 - 418) and the next construction vector in the sequence, each of said construction vectors being defined by a sequential pair of the Bézier control points, each said construction vector having a magnitude defined by the distance between the Bézier control points in the sequential pair and a direction from one of the Bézier control points of the pair to the other; means (114) for comparing each of said N-2 error values with a test magnitude indicative of a desired degree of accuracy in approximating the Bézier curve; and means (116, 118) for drawing a sequence of line segments between the Bézier control points to approximate the Bézier curve if said N-2 error values are each less than said test magnitude. The system according to claim 8, further comprising means for subdividing the Bézier curve to generate a second set of N sequential Bézier control points representative of a portion of the curve if any of the N-2 error values is larger than said test magnitude, and wherein said means for calculating and comparing are arranged to use said second set of Bézier control points. The system according to claim 8 or 9, wherein said means (114) for comparing said error values with said test magnitude comprises means for resolving vector components of each of said N-2 error vectors and for determining the magnitudes of the resolved vector components; and wherein all of said resolved vector components are used as error values. The system according to claim 8 or 9, wherein said means (114) for comparing said error values with said test magnitude comprises means for determining and selecting for each of said N-2 error vectors the largest vector component; and wherein said selected components are used as error values. The system according to one of claims 8 to 11, wherein the value of N is 4. The system according to one of claims 8 to 12, further comprising input means (126) for inputting the Bézier control points. The system according to one of claims 8 to 13, further comprising display means (120, 122) for displaying the drawn sequence of line segments. The system according to claim 14, wherein said display means comprises a CRT. The system according to claim 14 or 15, wherein said display means comprises a printer. The system according to one of claims 8 to 15 wherein each of said error vectors has a magnitude and direction defined by subtracting a construction vector in a sequence of N-1 construction vectors from the next construction vector in the sequence. The system according to one of claims 8 to 15 wherein each of said error vectors has a magnitude and direction defined by subtracting vectors (218-224) between a predetermined point (216) and end points (200-206) of a construction vector in a sequence of N-1 construction vectors from vectors (218-224) between said predetermined point and the next construction vector in the sequence.

Inventors: OLYNYK KIRK O, OLYNYK,KIRK O.
Applicants: MICROSOFT CORP, MICROSOFT CORPORATION
Application year: 1993
Main classification: G06T11
IPC codes: G06F17, G06T11