CN102819854A - Method and system for describing elliptic arc on raster display - Google Patents
Method and system for describing elliptic arc on raster display Download PDFInfo
- Publication number
- CN102819854A CN102819854A CN2011101624297A CN201110162429A CN102819854A CN 102819854 A CN102819854 A CN 102819854A CN 2011101624297 A CN2011101624297 A CN 2011101624297A CN 201110162429 A CN201110162429 A CN 201110162429A CN 102819854 A CN102819854 A CN 102819854A
- Authority
- CN
- China
- Prior art keywords
- pixel
- ellipse
- arc
- elliptical arc
- adjacent
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 230000008569 process Effects 0.000 claims abstract description 18
- 238000009877 rendering Methods 0.000 claims abstract description 18
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 239000013598 vector Substances 0.000 description 1
Images
Landscapes
- Image Generation (AREA)
Abstract
本发明公开了一种用于在光栅显示器上描画椭圆弧的方法和系统。该方法包括:利用连接当前像素与椭圆弧所在椭圆的中心的直线将当前像素的相邻像素划分到两个像素组中,其中当前像素是在描画椭圆弧的过程中刚刚完成渲染的像素;以及从处于椭圆弧的走向侧的一个像素组中选择下一个将要渲染的像素,并对所选择的像素进行渲染。本发明可以简单地实现对于各种形状的椭圆上的椭圆弧的描画。
The present invention discloses a method and system for drawing an elliptical arc on a raster display. The method includes: using a straight line connecting the current pixel and the center of the ellipse where the elliptical arc is located to divide the adjacent pixels of the current pixel into two pixel groups, wherein the current pixel is a pixel that has just finished rendering during the process of drawing the elliptical arc; and Select the next pixel to be rendered from a pixel group on the direction side of the ellipse arc, and render the selected pixel. The present invention can simply realize the drawing of ellipse arcs on ellipses of various shapes.
Description
技术领域 technical field
本发明涉及计算机图形学领域,更具体地涉及一种用于在光栅显示器上描画椭圆弧的方法和系统。The present invention relates to the field of computer graphics, and more particularly to a method and system for drawing an elliptical arc on a raster display.
背景技术 Background technique
简单地说,在光栅显示器上描画椭圆弧的过程就是在光栅显示器上选择最接近椭圆弧的像素并对这些像素进行渲染的过程。这个过程通常是通过沿着椭圆弧追踪像素来完成的。Simply put, the process of drawing an elliptical arc on a raster display is the process of selecting the pixels closest to the elliptical arc on the raster display and rendering these pixels. This process is usually done by tracing pixels along an elliptical arc.
目前存在两种比较流行的用于在光栅显示器上描画椭圆弧的方法:中点法和最小函数值法。它们都使用梯度向量和8个八分圆象限来判断下一个描画的像素是遵循正方形移动(Δx=±1或者Δy=±1)还是遵循对角线移动(Δx=±1并且Δy=±1)。其中,当椭圆弧是位于长轴远大于短轴的椭圆(简称为很细的椭圆)上的椭圆弧时,以上所述中点法失效。而最小函数值法使用椭圆弧与像素正方形边的相交来判断在当前已经描画的像素周围的8个相邻像素中应该选择哪个像素作为下一个将要描画的像素。在最小函数值法中,没有一个单独的定义来概括所有的相交情况,所以实现情况不简单。There are currently two popular methods for drawing elliptical arcs on raster displays: the midpoint method and the minimum function value method. They both use gradient vectors and 8 octant quadrants to determine whether the next drawn pixel follows a square movement (Δx=±1 or Δy=±1) or a diagonal movement (Δx=±1 and Δy=±1 ). Wherein, when the ellipse arc is an ellipse arc located on an ellipse whose major axis is much larger than its minor axis (abbreviated as a very thin ellipse), the above midpoint method fails. The minimum function value method uses the intersection of the ellipse arc and the pixel square side to determine which pixel should be selected as the next pixel to be drawn among the 8 adjacent pixels around the currently drawn pixel. In the minimum function value method, there is no single definition to cover all intersection cases, so the implementation situation is not simple.
发明内容 Contents of the invention
鉴于以上所述的问题,本发明提供了一种新颖的用于在光栅显示器上描画椭圆弧的方法和系统。In view of the problems described above, the present invention provides a novel method and system for drawing an elliptical arc on a raster display.
根据本发明实施例的用于在光栅显示器上描画椭圆弧的方法,包括:利用连接当前像素与椭圆弧所在椭圆的中心的直线将当前像素的相邻像素划分到两个像素组中,其中当前像素是在描画椭圆弧的过程中刚刚完成渲染的像素;以及从处于椭圆弧的走向侧的一个像素组中选择下一个将要渲染的像素,并对所选择的像素进行渲染。The method for drawing an elliptical arc on a raster display according to an embodiment of the present invention includes: dividing the adjacent pixels of the current pixel into two pixel groups by using a straight line connecting the current pixel and the center of the ellipse where the elliptical arc is located, wherein the current A pixel is a pixel that has just been rendered during the process of drawing the elliptical arc; and a pixel to be rendered next is selected from a group of pixels on the direction side of the elliptical arc, and the selected pixel is rendered.
根据本发明实施例的用于在光栅显示器上描画椭圆弧的系统,包括:像素分组单元,用于利用连接当前像素与椭圆弧所在椭圆的中心的直线将当前像素的相邻像素划分到两个像素组中,其中当前像素是在描画椭圆弧的过程中刚刚完成渲染的像素;像素渲染单元,用于从处于椭圆弧的走向侧的一个像素组中选择下一个将要渲染的像素,并对所选择的像素进行渲染。The system for drawing an elliptical arc on a raster display according to an embodiment of the present invention includes: a pixel grouping unit, which is used to divide the adjacent pixels of the current pixel into two groups by using a straight line connecting the current pixel and the center of the ellipse where the elliptical arc is located. In the pixel group, the current pixel is the pixel that has just finished rendering in the process of drawing the elliptical arc; the pixel rendering unit is used to select the next pixel to be rendered from a pixel group on the direction side of the elliptical arc, and Selected pixels to render.
通过本发明,可以不需要计算梯度值,不需要考虑各种相交情况,并且不需要在8分圆象限之间切换,而简单地实现对于各种形状的椭圆上的椭圆弧的描画。Through the present invention, there is no need to calculate the gradient value, no need to consider various intersection situations, and no need to switch between quadrants of an octagon, and simply realize the drawing of ellipse arcs on ellipses of various shapes.
附图说明 Description of drawings
从下面结合附图对本发明的具体实施方式的描述中可以更好地理解本发明,其中:The present invention can be better understood from the following description of specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:
图1示出了根据本发明实施例的用于在光栅显示器上描画椭圆弧的方法的流程图;FIG. 1 shows a flowchart of a method for drawing an elliptical arc on a raster display according to an embodiment of the present invention;
图2示出了根据本发明实施例的用于在光栅显示器上描画椭圆弧的系统的框图;2 shows a block diagram of a system for drawing elliptical arcs on a raster display according to an embodiment of the present invention;
图3示出了提供对椭圆弧的最佳近似的一组像素的示例;Figure 3 shows an example of a set of pixels providing the best approximation to an elliptical arc;
图4示出了椭圆弧上的当前像素、入像素、以及出像素的示例;Figure 4 shows an example of a current pixel, an incoming pixel, and an outgoing pixel on an elliptical arc;
图5示出了在描画椭圆弧的过程中选择下一个将要渲染的像素的处理示例。FIG. 5 shows an example of the process of selecting the next pixel to be rendered in the process of drawing an elliptical arc.
具体实施方式 Detailed ways
下面将详细描述本发明各个方面的特征和示例性实施例。下面的描述涵盖了许多具体细节,以便提供对本发明的全面理解。但是,对于本领域技术人员来说显而易见的是,本发明可以在不需要这些具体细节中的一些细节的情况下实施。下面对实施例的描述仅仅是为了通过示出本发明的示例来提供对本发明更清楚的理解。本发明绝不限于下面所提出的任何具体配置和算法,而是在不脱离本发明的精神的前提下覆盖了相关元素、部件和算法的任何修改、替换和改进。Features and exemplary embodiments of various aspects of the invention will be described in detail below. The following description covers numerous specific details in order to provide a thorough understanding of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced without some of these specific details. The following description of the embodiments is only to provide a clearer understanding of the present invention by showing examples of the present invention. The present invention is by no means limited to any specific configuration and algorithm presented below, but covers any modification, replacement and improvement of related elements, components and algorithms without departing from the spirit of the present invention.
本发明提供了一种新颖的用于在光栅显示器上描画椭圆弧的方法和系统。在根据本发明实施例的用于在光栅显示器上描画椭圆弧的方法和系统中,利用连接当前像素和椭圆弧所在椭圆的中心的直线将当前描画的像素周围的8个相邻像素划分到两个平面中(即,划分为两个像素组),然后从处于椭圆弧走向侧的一个平面中选择下一个将要描画的像素。根据本发明实施例的用于在光栅显示器上描画椭圆弧的方法和系统适用于任何形状的椭圆上的椭圆弧,且易于实现。The present invention provides a novel method and system for tracing elliptical arcs on raster displays. In the method and system for drawing an elliptical arc on a raster display according to an embodiment of the present invention, a straight line connecting the current pixel and the center of the ellipse where the elliptical arc is located is used to divide the 8 adjacent pixels around the currently drawn pixel into two plane (that is, divided into two pixel groups), and then select the next pixel to be drawn from a plane on the side of the elliptical arc. The method and system for drawing an elliptical arc on a raster display according to an embodiment of the present invention is applicable to an elliptical arc on any shape of an ellipse, and is easy to implement.
下面结合附图,详细说明根据本发明实施例的用于在光栅显示器上描画椭圆弧的方法和系统。图1示出了根据本发明实施例的用于在光栅显示器上描画椭圆弧的方法的流程图。图2示出了根据本发明实施例的用于在光栅显示器上描画椭圆弧的系统的框图。The method and system for drawing an elliptical arc on a raster display according to an embodiment of the present invention will be described in detail below with reference to the accompanying drawings. Fig. 1 shows a flowchart of a method for drawing an elliptical arc on a raster display according to an embodiment of the present invention. Figure 2 shows a block diagram of a system for drawing an elliptical arc on a raster display according to an embodiment of the present invention.
如图1所示,根据本发明实施例的用于在光栅显示器上描画椭圆弧的方法包括:S102,利用连接当前像素与椭圆弧所在椭圆的中心的直线将当前像素的相邻像素划分到两个像素组中,其中当前像素是在描画椭圆弧的过程中刚刚完成渲染的像素;以及S104,从处于椭圆弧的走向侧的一个像素组中选择下一个将要渲染的像素,并对所选择的像素进行渲染。As shown in FIG. 1, the method for drawing an elliptical arc on a raster display according to an embodiment of the present invention includes: S102, dividing the adjacent pixels of the current pixel into two parts by using a straight line connecting the center of the ellipse where the current pixel and the elliptical arc are located. pixel group, wherein the current pixel is the pixel that has just finished rendering during the process of drawing the elliptical arc; pixels to render.
如图2所示,根据本发明实施例的用于在光栅显示器上描画椭圆弧的系统包括像素分组单元202和像素渲染单元204。其中,像素分组单元202利用连接当前像素与椭圆弧所在椭圆的中心的直线将当前像素的相邻像素划分到两个像素组中(即,执行步骤S102),像素渲染单元204从处于椭圆弧的走向侧的一个像素组中选择下一个将要渲染的像素并对所选择的像素进行渲染(即,执行步骤S104)。As shown in FIG. 2 , the system for drawing an elliptical arc on a raster display according to an embodiment of the present invention includes a
下面结合示例,详细说明根据本发明实施例的用于在光栅显示器上描画椭圆弧的方法和系统是如何完成椭圆弧的描画的。The following describes in detail how the method and system for drawing an elliptical arc on a raster display according to an embodiment of the present invention complete the drawing of an elliptical arc with reference to an example.
这里,假设需要描画的椭圆弧所在的椭圆是以坐标点(0,0)为中心的椭圆,其隐函数为:Here, it is assumed that the ellipse where the elliptical arc to be drawn is located is an ellipse centered on the coordinate point (0, 0), and its implicit function is:
F(x,y)=Ax2+Bxy+Cy2-1=0F(x,y)=Ax 2 +Bxy+Cy 2 −1=0
其中,rh表示椭圆的水平半径,rv表示椭圆的垂直半径,表示椭圆的水平半径相对于x轴的逆时针夹角。假设椭圆弧的起始点为(x0,y0),终止点为(x1,y1)。Among them, rh represents the horizontal radius of the ellipse, rv represents the vertical radius of the ellipse, Indicates the counterclockwise angle of the horizontal radius of the ellipse relative to the x-axis. Suppose the starting point of the elliptic arc is (x 0 , y 0 ), and the ending point is (x 1 , y 1 ).
当光栅显示器上的一个像素处于需要描画的椭圆弧所在的椭圆之外时,该像素相对于椭圆的隐函数的函数值为正;反之,当光栅显示器上的一个像素处于需要描画的椭圆弧所在的椭圆之内时,该像素相对于椭圆的隐函数的函数值为负。When a pixel on the raster display is outside the ellipse where the ellipse arc to be drawn is located, the function value of the implicit function of the pixel relative to the ellipse is positive; otherwise, when a pixel on the raster display is located where the ellipse arc to be drawn is located When the pixel is within the ellipse, the function value of the implicit function of the pixel relative to the ellipse is negative.
在光栅显示器上描画没有厚度的弧线(即,宽度或者粗细程度为一个像素单位的弧线)的过程,即找出最接近该弧线的像素并对这些像素进行渲染的过程。一个像素与弧线的接近程度的直接估计是该像素与弧线之间的距离。然而,在实际中很难精确得出像素与弧线之间的距离,所以需要一种近似方法来粗略地得出像素与弧线之间的距离。The process of drawing an arc without thickness (that is, an arc whose width or thickness is one pixel unit) on the raster display is the process of finding the pixels closest to the arc and rendering these pixels. A direct estimate of how close a pixel is to the arc is the distance between that pixel and the arc. However, it is difficult to accurately obtain the distance between the pixel and the arc in practice, so an approximation method is needed to roughly obtain the distance between the pixel and the arc.
在描画一个像素单位宽度的椭圆弧的过程中,对椭圆弧的最佳近似是由这样的一组像素提供的:该组像素中不存在与同一个像素相邻的三个像素。图3示出了提供对椭圆弧的最佳近似的一组像素的示例。如图3所示,并不是与椭圆弧相交的所有像素(或者像素正方形)都应该被渲染。在这里为了方便说明,在光栅显示器上描画椭圆弧的过程中,以当前像素(即,当前刚刚完成描画的像素)为基准,将前一个已经描画的像素称为入像素,并且将下一个将要描画的像素称为出像素。In the process of drawing an elliptical arc with a width of one pixel unit, the best approximation to the elliptical arc is provided by a group of pixels in which there are no three adjacent pixels to the same pixel. Figure 3 shows an example of a set of pixels that provides the best approximation to an elliptical arc. As shown in Figure 3, not all pixels (or squares of pixels) that intersect the elliptical arc should be rendered. Here, for the convenience of explanation, in the process of drawing an elliptical arc on the raster display, the current pixel (that is, the pixel that has just been drawn) is used as the reference, the previously drawn pixel is called the input pixel, and the next pixel to be drawn is called the input pixel. The pixels drawn are called out pixels.
图4示出了椭圆弧上的当前像素、入像素、以及出像素的示例。如图4所示,位于当前像素左侧的像素是入像素,位于当前像素右上侧的像素是出像素。根据图3和图4所示的情形可以看出,相对于当前像素,只存在一个入像素,并且只存在一个出像素。在一些情况下,入像素和出像素可以是同一个像素。在一些情况下,入像素、当前像素、以及出像素可以是同一个像素。FIG. 4 shows an example of a current pixel, a pixel-in, and a pixel-out on an elliptical arc. As shown in FIG. 4 , the pixel located to the left of the current pixel is an input pixel, and the pixel located to the upper right of the current pixel is an output pixel. It can be seen from the situations shown in FIG. 3 and FIG. 4 that, relative to the current pixel, there is only one incoming pixel and only one outgoing pixel. In some cases, the in-pixel and out-pixel may be the same pixel. In some cases, the in pixel, current pixel, and out pixel may be the same pixel.
在图4所示的示例中,在当前像素的相邻像素中,存在两个在椭圆弧的走向侧(逆时针方向,即从点A到点B的方向)与椭圆弧相交的像素(即,存在两个将在当前像素之后被渲染的候选像素),一个位于当前像素的上侧,另一个位于当前像素的右上侧。根据以上参考图1描述的对椭圆弧的最佳近似规则可以知道,像素渲染单元204应该选择位于当前像素右上侧的像素作为下一个将要描画的像素,而不应该选择位于当前像素上侧的像素作为下一个将要描画的像素。In the example shown in Figure 4, among the adjacent pixels of the current pixel, there are two pixels intersecting the elliptical arc on the side of the elliptical arc (counterclockwise direction, that is, the direction from point A to point B) (ie , there are two candidate pixels to be rendered after the current pixel), one above and one above and to the right of the current pixel. According to the best approximation rule for the ellipse arc described above with reference to FIG. 1, it can be known that the pixel rendering unit 204 should select the pixel located on the upper right side of the current pixel as the next pixel to be drawn, and should not select the pixel located on the upper side of the current pixel. as the next pixel to be drawn.
由于椭圆弧所在椭圆的中心和当前像素都是已知的,所以很容易利用连接椭圆弧所在椭圆的中心和当前像素的直线将当前像素的8个相邻像素划分到两个像素组中。其中,一个像素组中的相邻像素相对于连接椭圆弧所在椭圆的中心和当前像素的直线的边方程值的符号不同于另一个像素组中的相邻像素相对于该直线的边方程值的符号。Since the center of the ellipse where the ellipse arc is located and the current pixel are both known, it is easy to divide the 8 adjacent pixels of the current pixel into two pixel groups by using the straight line connecting the center of the ellipse where the ellipse arc is located and the current pixel. Among them, the sign of the edge equation value of the adjacent pixels in one pixel group relative to the line connecting the center of the ellipse where the ellipse arc is located and the current pixel is different from the sign of the edge equation value of the adjacent pixels in the other pixel group relative to the line symbol.
在本发明的实施例中,对于当前像素的任意一个相邻像素P,像素分组单元202根据相邻像素P相对于连接当前像素与椭圆弧所在椭圆的中心的直线的边方程的边方程值来判断相邻像素P是否属于处于椭圆弧的走向侧的一个像素组。具体地,如果相邻像素P相对于连接当前像素与椭圆弧所在椭圆的中心的直线的边方程的边方程值大于0(即,边方程值的符号为正),则像素分组单元202认为相邻像素P属于处于椭圆弧的走向侧的一个像素组;反之,则像素分组单元202认为相邻像素P属于处于椭圆弧的与走向侧相反方向的一个像素组。In an embodiment of the present invention, for any adjacent pixel P of the current pixel, the
图5示出了在描画椭圆弧的过程中选择下一个将要渲染的像素的处理示例。如图5中所示,椭圆弧所在椭圆的走向(即,椭圆弧的走向)为逆时针方向,在像素分组单元202利用连接当前像素和椭圆弧所在椭圆的中心的直线划分出的每个像素组中,最多存在4个相邻像素。这时,像素渲染单元204选择像素分组单元202划分出的处于椭圆弧的走向侧的一个像素组中的最接近椭圆弧的一个相邻像素作为下一个将要渲染的像素。例如,在图5中,椭圆弧的走向是逆时针的,所以像素渲染单元204选择当前像素的相邻像素中的相对于连接当前像素和椭圆弧所在椭圆的中心的直线的边方程值的符号为正的像素之一作为下一个将要描画的像素。如果椭圆弧的走向为顺时针,则像素渲染单元204选择当前像素的相邻像素中的相对于连接当前像素和椭圆弧所在椭圆的中心的直线的边方程值的符号为负的像素之一作为下一个将要描画的像素。具体地,像素渲染单元204将处于椭圆弧的走向侧的一个像素组中的相邻像素相对于椭圆弧所在椭圆的隐函数的函数值作为该相邻像素与椭圆弧之间的距离,并且选择与椭圆弧之间的距离最小的一个相邻像素作为下一个将要渲染的像素进行渲染。FIG. 5 shows an example of the process of selecting the next pixel to be rendered in the process of drawing an elliptical arc. As shown in Figure 5, the trend of the ellipse where the elliptical arc is located (that is, the trend of the elliptical arc) is counterclockwise, and in the
这里假设,椭圆弧所在椭圆的中心的坐标为(cx,cy),并且当前像素的坐标为(xd,yd),则连接椭圆弧所在椭圆的中心和当前像素的直线的边方程为f(x,y)=ax+by+c,其中a=cy-yd、b=xd-cx、c=cx·yd-xd·cy。由于只需要判断当前像素的相邻像素相对于连接当前像素和椭圆弧所在椭圆的中心的直线的边方程的边方程值,所以有x=xd+dx、y=yd+dy,dx和dy为±1或0。将a=cy-yd、b=xd-cx、c=cx·yd-xd·cy、x=xd+dx、y=yd+dy代入f(x,y)=ax+by+c,则通过以下的推导过程可以得出fd=a·dx+b·dy。It is assumed here that the coordinates of the center of the ellipse where the ellipse arc is located are (cx, cy), and the coordinates of the current pixel are (x d , y d ), then the edge equation of the line connecting the center of the ellipse where the ellipse arc is located and the current pixel is f (x, y)=ax+by+c, where a=cy- yd , b= xd -cx, c=cx· yd - xd ·cy. Since only the adjacent pixels of the current pixel need to be judged relative to the side equation value of the side equation of the straight line connecting the current pixel and the center of the ellipse where the ellipse arc is located, there are x=x d +dx, y=y d +dy, dx and dy is ±1 or 0. Substitute a=cy-y d , b=x d -cx, c=cx y d -x d cy, x=x d +dx, y=y d +dy into f(x,y)=ax+ by+c, f d =a·dx+b·dy can be obtained through the following derivation process.
fd=f(xd+dx,yd+dy)f d = f(x d + dx, y d + dy)
=a(xd+dx)+b(yd+dy)+c=a(x d +dx)+b(y d +dy)+c
=(cy-yd)(xd+dx)+(xd-cx)(yd+dy)+cx·yd-xd·cy=(cy-y d )(x d +dx)+(x d -cx)(y d +dy)+cx y d -x d cy
=cy·xd+cy·dx-ydxd-yddx+xdyd+xddy-ydcx-cx·dy+cx·yd-xd·cy=cy x d +cy dx-y d x d -y d dx+x d y d + x d dy-y d cx-cx dy+cx y d -x d cy
=xdcy-xdcy+ydcx-ydcx+xdyd-xdyd+(cy·dx-yddx)+(xddy-cx·dy)=x d cy-x d cy+y d cx-y d cx+x d y d -x d y d +(cy dx-y d dx)+(x d dy-cx dy)
=(cy-yd)dx+(xd-cx)dy=(cy-y d )dx+(x d -cx)dy
=a·dx+b·dy= a·dx+b·dy
当前像素的八个相邻像素相对于连接椭圆弧所在椭圆的中心和当前像素的直线的边方程的边方程值分别为:The side equation values of the eight adjacent pixels of the current pixel relative to the side equations of the straight line connecting the center of the ellipse where the ellipse arc is located and the current pixel are:
fd0=-a-b,(dx=-1,dy=-1);f d0 = -ab, (dx = -1, dy = -1);
fd1=-b,(dx=0,dy=-1);f d1 = -b, (dx = 0, dy = -1);
fd2=a-b,(dx=1,dy=-1);f d2 = ab, (dx = 1, dy = -1);
fd3=a,(dx=1,dy=0);f d3 = a, (dx = 1, dy = 0);
fd4=a+b,(dx=1,dy=1);f d4 = a+b, (dx=1, dy=1);
fd5=b,(dx=0,dy=1);f d5 = b, (dx = 0, dy = 1);
fd6=-a+b,(dx=-1,dy=1);f d6 =-a+b, (dx=-1, dy=1);
fd7=-a,(dx=-1,dy=0);f d7 = -a, (dx = -1, dy = 0);
在当前像素移动到下一个将要渲染的像素时,将有xd=xd+dx、yd=yd+dy,其中dx和dy为±1。只需要更新a和b即可得出每一个当前像素的相邻像素相对于连接当前像素和椭圆中心的直线的边方程值。When the current pixel moves to the next pixel to be rendered, there will be x d =x d +dx, y d =y d +dy, where dx and dy are ±1. Only by updating a and b can the edge equation value of each adjacent pixel of the current pixel relative to the straight line connecting the current pixel and the center of the ellipse be obtained.
为了计算当前像素的相邻像素相对于椭圆弧所在椭圆的隐函数的函数值,在本发明的一个实施例中可以使用前向差分法。例如,对于以(0,0)为中心的椭圆,其隐函数为F(x,y)=Ax2+Bxy+Cy2-1=0。In order to calculate the function value of the implicit function of the adjacent pixels of the current pixel relative to the ellipse where the ellipse arc is located, the forward difference method can be used in one embodiment of the present invention. For example, for an ellipse centered at (0,0), its implicit function is F(x,y)=Ax 2 +Bxy+Cy 2 −1=0.
椭圆弧所在椭圆的隐函数的一阶差分为:The first-order difference of the implicit function of the ellipse where the elliptic arc is located is:
椭圆弧所在椭圆的隐函数的二阶差分为:The second-order difference of the implicit function of the ellipse where the elliptic arc is located is:
Δ2Fx=ΔFx(x±1,y)-ΔFx(x,y)=±2A,Δ 2 F x =ΔF x (x±1,y)-ΔF x (x,y)=±2A,
Δ2Fy=ΔFy(x,y±1)-ΔFy(x,y)=±2C,Δ 2 F y = Δ F y (x, y ± 1) - Δ F y (x, y) = ± 2C,
Δ2Fxy=ΔFxy(x±1,y±1)-ΔFxy(x,y)=±2(A+B+C)Δ 2 F xy = ΔF xy (x±1, y±1)-ΔF xy (x, y)=±2(A+B+C)
这里假设最接近椭圆弧的起始点的像素的坐标为(xs,ys),该像素相对于椭圆弧所在椭圆的隐函数的函数值为F(xs,ys),并且该像素处的一阶差分值为ΔFx(xs,ys)、ΔFy(xs,ys)、ΔFxy(xs,ys)。如果选择坐标为(xs+1,ys)的像素作为将要判断的下一个像素,则该像素相对于椭圆弧所在椭圆的隐函数的函数值可以通过将F(xs,ys)与ΔFx(xs,ys)相加得出。依次类推,只需根据有关(xs,ys)的初始值,即可通过相加计算得出所有需要判断的像素相对于椭圆弧所在椭圆的隐函数的函数值。Here it is assumed that the coordinates of the pixel closest to the starting point of the elliptical arc are (x s , y s ), the function value of this pixel relative to the implicit function of the ellipse where the elliptical arc is located is F(x s , y s ), and the pixel is at The first-order difference values of are ΔF x (x s , y s ), ΔF y (x s , y s ), ΔF xy (x s , y s ). If the pixel whose coordinates are (x s +1, y s ) is selected as the next pixel to be judged, then the function value of the implicit function of this pixel relative to the ellipse where the ellipse arc is located can be obtained by combining F(x s , y s ) with ΔF x (x s , y s ) is added together. By analogy, only based on the initial value of (x s , y s ), the function value of the implicit function of all the pixels to be judged relative to the ellipse where the ellipse arc is located can be obtained through addition calculation.
由以上的描述可知,通过本发明可以不需要计算梯度值,不需要考虑各种相交情况,并且不需要在8分圆象限之间切换,而简单地实现对于各种形状的椭圆上的椭圆弧的描画。As can be seen from the above description, the present invention does not need to calculate the gradient value, does not need to consider various intersection situations, and does not need to switch between quadrants of the 8-point circle, but simply realizes the ellipse arc on the ellipse of various shapes of the drawing.
以上已经参考本发明的具体实施例来描述了本发明,但是本领域技术人员均了解,可以对这些具体实施例进行各种修改、组合和变更,而不会脱离由所附权利要求或其等同物限定的本发明的精神和范围。The present invention has been described above with reference to the specific embodiments of the present invention, but those skilled in the art will understand that various modifications, combinations and changes can be made to these specific embodiments without departing from the requirements set by the appended claims or their equivalents. The spirit and scope of the present invention defined by the material.
根据需要可以用硬件或软件来执行步骤。注意,在不脱离本发明范围的前提下,可向本说明书中给出的流程图添加步骤、从中去除步骤或修改其中的步骤。一般来说,流程图只是用来指示用于实现功能的基本操作的一种可能的序列。The steps can be performed by hardware or software as desired. Note that steps may be added to, removed from, or modified in the flowcharts presented in this specification without departing from the scope of the present invention. In general, a flowchart is only used to indicate one possible sequence of basic operations for implementing a function.
本发明的实施例可利用编程的通用数字计算机、利用专用集成电路、可编程逻辑器件、现场可编程门阵列、光的、化学的、生物的、量子的或纳米工程的系统、组件和机构来实现。一般来说,本发明的功能可由本领域已知的任何手段来实现。可以使用分布式或联网系统、组件和电路。数据的通信或传送可以是有线的、无线的或者通过任何其他手段。Embodiments of the present invention may utilize programmed general purpose digital computers, utilize application specific integrated circuits, programmable logic devices, field programmable gate arrays, optical, chemical, biological, quantum or nanoengineered systems, components and mechanisms accomplish. Generally speaking, the functions of the present invention can be realized by any means known in the art. Distributed or networked systems, components and circuits can be used. Communication or transfer of data may be wired, wireless or by any other means.
还将意识到,根据特定应用的需要,附图中示出的要素中的一个或多个可以按更分离或更集成的方式来实现,或者甚至在某些情况下被去除或被停用。实现可存储在机器可读介质中的程序或代码以允许计算机执行上述任何方法,也在本发明的精神和范围之内。It will also be appreciated that one or more of the elements shown in the figures may be implemented in a more separate or integrated manner, or even removed or disabled in some cases, depending on the needs of a particular application. It is also within the spirit and scope of the present invention to implement a program or code storable in a machine-readable medium to allow a computer to perform any of the methods described above.
此外,附图中的任何信号箭头应当被认为仅是示例性的,而不是限制性的,除非另有具体指示。当术语被预见为使分离或组合的能力不清楚时,组件或者步骤的组合也将被认为是已经记载了。Furthermore, any signal arrows in the figures should be considered as illustrative only, and not restrictive, unless specifically indicated otherwise. Combinations of components or steps are also considered to have been recited when terms are foreseen to obscure the ability to separate or combine.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110162429.7A CN102819854B (en) | 2011-06-10 | 2011-06-10 | Method and system for describing elliptic arc on raster display |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110162429.7A CN102819854B (en) | 2011-06-10 | 2011-06-10 | Method and system for describing elliptic arc on raster display |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102819854A true CN102819854A (en) | 2012-12-12 |
CN102819854B CN102819854B (en) | 2014-11-12 |
Family
ID=47303957
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110162429.7A Expired - Fee Related CN102819854B (en) | 2011-06-10 | 2011-06-10 | Method and system for describing elliptic arc on raster display |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102819854B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106501367A (en) * | 2016-10-10 | 2017-03-15 | 清华大学 | Phased array supersonic echo-wave imaging method based on elliptic arc scan transformation |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101901488A (en) * | 2009-05-25 | 2010-12-01 | 富士通株式会社 | Method and device for curve approximation and graphic display control method and device |
CN102646281A (en) * | 2011-02-16 | 2012-08-22 | 富士通株式会社 | Method and system for rasterizing elliptical arcs |
-
2011
- 2011-06-10 CN CN201110162429.7A patent/CN102819854B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101901488A (en) * | 2009-05-25 | 2010-12-01 | 富士通株式会社 | Method and device for curve approximation and graphic display control method and device |
CN102646281A (en) * | 2011-02-16 | 2012-08-22 | 富士通株式会社 | Method and system for rasterizing elliptical arcs |
Non-Patent Citations (3)
Title |
---|
A. AGATHOS ET AL: "EFFICIENT INTEGER ALGORITHMS FOR THE GENERATION OF CONIC SECTIONS", 《COMPUT. & GRAPHICS》, vol. 22, no. 5, 31 December 1998 (1998-12-31) * |
DIETER W. FELLNER ET AL: "Robust Rendering of General Ellipses and Elliptical Arcs", 《ACM TRANSACTIONS ON GRAPHICS》, vol. 12, no. 3, 31 July 1993 (1993-07-31), XP 058246091, DOI: doi:10.1145/169711.169704 * |
M. DOUGLAS MCILROY: "Getting Raster Ellipses Right", 《ACMTRANSACTIONS ON GRAPHICS》, vol. 11, no. 3, 31 July 1992 (1992-07-31), XP 000306276, DOI: doi:10.1145/130881.130892 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106501367A (en) * | 2016-10-10 | 2017-03-15 | 清华大学 | Phased array supersonic echo-wave imaging method based on elliptic arc scan transformation |
CN106501367B (en) * | 2016-10-10 | 2019-02-22 | 清华大学 | Implementation method of phased array ultrasound imaging based on elliptical arc scan conversion |
Also Published As
Publication number | Publication date |
---|---|
CN102819854B (en) | 2014-11-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5742275B2 (en) | System, method, computer program, and storage medium for performing geometric transformation | |
CN103745439B (en) | Image magnification method and device | |
CN102469254B (en) | Image correcting device, correction image generation method and correction table generation device | |
JP5640459B2 (en) | Curve approximation method and system, and graphic display control method and apparatus | |
EP2876667A1 (en) | Electron beam writing device, electron beam writing method, and recording medium | |
CN101493942B (en) | Level set image segmentation method based on spacing moment | |
CN105335748A (en) | Image feature extraction method and system | |
CN104331868B (en) | A kind of optimization method of image border | |
KR20180105210A (en) | Image processing method and apparatus | |
US20130342444A1 (en) | Method and Apparatus for Hand Gesture Trajectory Recognition | |
JP2012053601A (en) | Image correction device, corrected image generation method, correction table generation device, correction table generation method, correction table generation program and corrected image generation program | |
CN102819854B (en) | Method and system for describing elliptic arc on raster display | |
KR20160135681A (en) | Rendering borders of elements of a graphical user interface | |
CN110827301B (en) | Method and apparatus for processing image | |
CN104318516A (en) | Image zooming method based on kerf alignment and deformation correction | |
JP2017529617A (en) | Long-distance identification image generation apparatus and operation method thereof | |
JP6396022B2 (en) | Device for generating output images | |
CN102819853B (en) | Curve rendering intent and system | |
JP2011210160A (en) | Image processing method, image processor, program and program storage medium | |
TWI622022B (en) | Depth calculating method and device | |
CN102646281B (en) | Method and system for rasterizing elliptic arc | |
US20140348416A1 (en) | Stereo image rectification apparatus and method | |
CN103425627B (en) | Method for generating strokes and method for generating fonts | |
CN115100029A (en) | Image processing method, device, electronic device and storage medium | |
CN112598774A (en) | Material replacement method, system and non-transitory computer readable recording medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20141112 Termination date: 20180610 |
|
CF01 | Termination of patent right due to non-payment of annual fee |