KR100653514B1 - A figure drawing method - Google Patents
A figure drawing method Download PDFInfo
- Publication number
- KR100653514B1 KR100653514B1 KR1020050134241A KR20050134241A KR100653514B1 KR 100653514 B1 KR100653514 B1 KR 100653514B1 KR 1020050134241 A KR1020050134241 A KR 1020050134241A KR 20050134241 A KR20050134241 A KR 20050134241A KR 100653514 B1 KR100653514 B1 KR 100653514B1
- Authority
- KR
- South Korea
- Prior art keywords
- pixels
- pixel
- inequality
- selected pixel
- linear
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
- G06T11/203—Drawing of straight lines or curves
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/20—Processor architectures; Processor configuration, e.g. pipelining
Abstract
Description
도 1은 본 발명에 따른 직선 드로잉 방법을 설명하기 위한 흐름도.1 is a flowchart for explaining a straight line drawing method according to the present invention;
도 2는 본 발명에 따른 원 드로잉 방법을 설명하기 위한 흐름도.2 is a flowchart illustrating a circle drawing method according to the present invention.
본 발명은 직선 원과 같은 도형 드로잉 방법 및 이를 기록한 컴퓨터 기록매체에 관한 것으로, 더욱 자세하게는 한정된 픽셀을 갖는 디스플레이 장치에서 직선 원과 같은 도형을 표시함에 있어서, 부동 소수점의 계산 없이 부등식의 만족 여부에 따라 용이하게 도형을 표시할 수 있는 도형 드로잉 방법 및 이를 기록한 기록매체에 관한 것이다.The present invention relates to a figure drawing method such as a straight circle and a computer recording medium on which the same is drawn. More particularly, the present invention relates to a method for drawing a figure such as a straight line in a display device having a limited number of pixels, To a figure drawing method capable of easily displaying a figure and a recording medium on which the figure is drawn.
최근 컴퓨터 그래픽 분야의 발전에 따라 그래픽 처리의 속도를 좌우하는 그래픽 가속장치의 중요성은 날로 커지고 있다. 그 중에서도 제한된 시간 동안에 얼마나 빨리 라인 드로잉을 하는가를 결정하는 라인 드로잉 엔진은 그래픽 가속장치의 성능을 평가하는데 있어서 중요한 역할을 하고 있다.BACKGROUND ART [0002] With the recent development of the computer graphics field, the importance of graphic accelerators, which determine the speed of the graphics processing, is increasing. Among them, the line drawing engine, which determines how fast a line drawing is performed within a limited time, plays an important role in evaluating the performance of a graphics accelerator.
선을 기본으로 하여 도형 등을 그리는데 사용되는 라인 드로잉 엔진을 구현하기 위한 대표적인 기술로 브레젠함(Bresenham) 알고리즘이 있다.The Bresenham algorithm is a representative technique for implementing a line drawing engine used to draw shapes based on lines.
종래 브레젠함 알고리즘은 시작 픽셀 위치로부터 끝나는 픽셀 위치가 주어지면 직선을 구성하는 픽셀을 알고리즘에 따라 계산한 후, 직선 구성 픽셀의 위치를 모두 메모리에 저장했다가 디스플레이한다. 예를 들어, 종래 브레젠함 알고리즘으로 원을 그리는 경우, 중심 픽셀의 위치인 (a, b)에서 반지름 r만큼 떨어진 픽셀들을 찾기 위해 식에서 x, y 값을 계산한 후 반올림 등을 통해서 적절한 픽셀 위치를 정한 후, 모두 메모리에 저장했다가 디스플레이한다.In the conventional Bregenz algorithm, given a pixel position ending at the starting pixel position, the pixels constituting the straight line are calculated according to an algorithm, and then all the positions of the linearly arranged pixels are stored in the memory and displayed. For example, when a circle is drawn by the conventional Bregenz algorithm, the pixels located at the center pixel position (a, b) by a radius r are searched After calculating the x and y values in the equation, the appropriate pixel positions are determined through rounding or the like, and then all of them are stored in the memory and displayed.
그러므로, 종래 브레젠함 알고리즘은 그리고자 하는 도형이 현재 얼마나 그려졌는지 계속해서 정보를 메모리에 저장하고 있어야 하고, 부동 소수점을 계산해야 하기 때문에 처리 속도가 떨어지는 문제점이 있었다.Therefore, the conventional Bregenz algorithm has a problem in that the processing speed is lowered because the information must be stored in the memory continuously and the floating point must be computed continuously until the figure to be drawn is drawn at present.
따라서, 본 발명은 상기와 같은 종래 기술의 문제점을 해결하기 위한 것으로, 본 발명의 목적은 한정된 픽셀을 갖는 디스플레이 장치에서 직선, 원과 같은 도형을 표시함에 있어서, 임의의 픽셀들이 부등식의 조건을 만족하는지를 판단하여, 상기 부등식을 만족하는 픽셀들을 디스플레이 상에 표시함으로써, 용이하게 도형을 그릴 수 있는 도형 드로잉 방법 및 이를 기록한 기록매체를 제공하는 데 있다.SUMMARY OF THE INVENTION It is an object of the present invention to provide a display device having a limited number of pixels to display a graphic object such as a straight line or a circle, And displaying the pixels satisfying the inequality on the display, thereby providing a graphic drawing method and a recording medium on which the graphic drawing can be recorded.
본 발명의 다른 목적 및 장점들은 하기의 설명에 의해서 이해될 수 있으며, 본 발명의 실시예에 의해 보다 분명하게 알게 될 것이다. 또한, 본 발명의 목적 및 장점들은 특허 청구 범위에 나타낸 수단 및 그 조합에 의해 실현될 수 있음을 쉽게 알 수 있을 것이다.Other objects and advantages of the present invention will become apparent from the following description, and it will be understood by those skilled in the art that the present invention is not limited thereto. It will also be readily apparent that the objects and advantages of the invention may be realized and attained by means of the instrumentalities and combinations particularly pointed out in the appended claims.
상기 목적을 달성하기 위한 본 발명은, 그래픽 가속장치에 적용되는 도형 드로잉 방법에 있어서, 원하는 도형을 그리기 위한 입력 값을 입력받아 직선 또는 원의 방정식을 계산하는 제1 단계; 디스플레이의 픽셀들 중 하나를 선택하여 상기 입력값과 상기 직선 또는 원 방정식에 의해 얻어지는 부등식 조건을 만족하는지 검사하는 제2 단계; 상기 제2 단계에서 상기 선택된 픽셀이 상기 부등식 조건을 만족하면 상기 선택된 픽셀의 칼라를 원하는 데이터 값으로 변경하는 제3 단계; 및 모든 대상 픽셀들에 대해 상기 제2 단계 및 상기 제3 단계를 수행하는 제4 단계를 포함하는 것을 특징으로 한다.According to an aspect of the present invention, there is provided a graphic drawing method applied to a graphics accelerator, comprising: a first step of receiving an input value for drawing a desired graphic form and calculating a linear or circular equation; Selecting one of the pixels of the display and checking whether the input value and an inequality condition obtained by the linear or circular equation are satisfied; A third step of changing the color of the selected pixel to a desired data value when the selected pixel satisfies the inequality condition in the second step; And a fourth step of performing the second step and the third step for all the target pixels.
또한 본 발명은, 컴퓨터에서, 원하는 도형을 그리기 위한 입력 값을 입력받아 직선 또는 원의 방정식을 계산하는 제1 단계; 디스플레이의 픽셀들 중 하나를 선택하여 상기 입력값과 상기 직선 또는 원 방정식에 의해 얻어지는 부등식 조건을 만족하는지 검사하는 제2 단계; 상기 제2 단계에서 상기 선택된 픽셀이 상기 부등식 조건을 만족하면 상기 선택된 픽셀의 칼라를 원하는 데이터 값으로 변경하는 제3 단계; 및 모든 대상 픽셀들에 대해 상기 제2 단계 및 상기 제3 단계를 수행하는 제4 단계를 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체를 제공한다.According to another aspect of the present invention, there is provided a computer-readable storage medium storing a program for causing a computer to execute: a first step of receiving an input value for drawing a desired graphic form and calculating a linear or circular equation; Selecting one of the pixels of the display and checking whether the input value and an inequality condition obtained by the linear or circular equation are satisfied; A third step of changing the color of the selected pixel to a desired data value when the selected pixel satisfies the inequality condition in the second step; And a fourth step of performing the second step and the third step with respect to all the target pixels. The computer readable recording medium records the program.
상술한 목적, 특징 및 장점은 첨부된 도면과 관련한 다음의 상세한 설명을 통하여 보다 분명해 질 것이며, 그에 따라 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자가 본 발명의 기술적 사상을 용이하게 실시할 수 있을 것이다. 또한, 본 발명을 설명함에 있어서 본 발명과 관련된 공지 기술에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우에 그 상세한 설명을 생략하기로 한다. 이하, 첨부된 도면을 참조하여 본 발명에 따른 바람직한 일 실시예를 상세히 설명하기로 한다.The foregoing and other objects, features and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings, in which: There will be. In the following description, well-known functions or constructions are not described in detail since they would obscure the invention in unnecessary detail. Hereinafter, a preferred embodiment of the present invention will be described in detail with reference to the accompanying drawings.
도 1은 본 발명에 따른 직선 드로잉 방법을 설명하기 위한 흐름도이다.1 is a flow chart for explaining a straight line drawing method according to the present invention.
도 1을 참조하여 본 발명에 따라 직선을 그리는 과정을 살펴본다. 직선을 그리기 위한 시작 픽셀 좌표(x1, y1)와 끝 픽셀 좌표(x2, y2)가 입력되면(101), 상기 입력된 시작 픽셀 좌표값과 끝 픽셀 좌표값을 이용해 직선 방정식을 다음 수학식 1과 같이 계산한다(102).The process of drawing a straight line according to the present invention will be described with reference to FIG. When the starting pixel coordinates (x1, y1) and the end pixel coordinates (x2, y2) for drawing a straight line are input (101), the linear equation is calculated by the following Equation 1 using the input starting pixel coordinate value and the end pixel coordinate value (102).
0 = {(y2 - y1) / (x2 - x1)} × (x - x1) - (y - y1)0 = {(y2 - y1) / (x2 - x1)} x - x1 - y -
상기 직선 방정식을 만족하는 (x, y) 값에 해당하는 위치의 픽셀 칼라를 원하는 데이터 값으로 바꿔주면 직선이 그려질 수 있다. 그러나 문제는 픽셀의 (x, y) 좌표가 정수이기 때문에, 위의 식을 만족하는 (x, y) 픽셀들로 선을 그리는 경우 선의 모양이 연속적이지 못하고 드문드문 그려질 수밖에 없다. 이러한 문제를 해결하기 위해 종래에는 부동 소수점을 계산하였다. 하지만, 본 발명에서는 부동 소수점을 계산하지 않고, 부등식을 구한 후, 상기 부등식을 만족하는 픽셀들의 칼라를 원하는 데이터로 변경하여 직선을 표시한다. 이에 대해 구체적으로 살펴보면 다음과 같다.If a pixel color at a position corresponding to the (x, y) value satisfying the above linear equation is changed to a desired data value, a straight line can be drawn. However, since the (x, y) coordinates of a pixel are integers, if a line is drawn with (x, y) pixels satisfying the above expression, the shape of the line is not continuous and it must be sparsely drawn. In order to solve this problem, a floating point has been conventionally calculated. However, in the present invention, an inequality is calculated without calculating a floating point, and a color of pixels satisfying the inequality is changed to a desired data to display a straight line. This will be described in detail as follows.
앞서 설명한 바와 같이 입력된 좌표 값을 이용해 직선 방정식을 계산한 다음에(102), 시작 픽셀 좌표와 끝 픽셀 좌표를 대각선으로 갖는 직사각형 내의 픽셀들을 직선을 이루는 픽셀에 해당되는지를 조회하는 대상 픽셀들로 설정한다(103). 이와 같이 조회 대상 픽셀들을 한정하는 이유는 조회에 따른 클럭 수를 줄이기 위함이다.After calculating the linear equations using the input coordinate values as described above, (102), it is determined whether or not the pixels in the rectangle having the starting pixel coordinates and the end pixel coordinates as diagonal lines are referred to as pixels constituting a straight line (103). The reason for limiting the pixels to be referred to in this way is to reduce the number of clocks according to the inquiry.
그런 다음, 설정된 조회 대상 픽셀들 중 하나의 픽셀을 선택하여(104) 아래의 수학식 2와 같은 부등식을 만족하는지 검사한다(105).Then, one pixel among the set reference pixels is selected (104) and it is checked whether an inequality (105) as shown in the following Equation (2) is satisfied.
-(x2 - x1) < {(y2 - y1) × (x - x1)} - {(y - y1) × (x2 - x1)}- (x2 - x1) <{(y2 - y1) x (x - x1)
0 < {(y2 - y1) × (x - x1)} - {(y - y1) × (x2 - x1)} + (x2 - x1)(X2 - x1)} + (x2 - x1)} - {(y - y1)
{(y2 - y1) × (x - x1)} - {(y - y1) × (x2 - x1)} < (x2 - x1)x2 - x1) < (x2 - x1) - (y2 - x1)
{(y2 - y1) × (x - x1)} - {(y - y1) × (x2 - x1)} - (x2 -x1) < 0x2-x1) - (x2-x1) < = (y2-y1)
검사 결과, 선택된 픽셀(x, y)이 상기 수학식 2의 부등식 조건을 만족하는 경우 해당 픽셀의 칼라를 원하는 데이터 값으로 변경한다(106). 이에 따라 디스플레이 상에는 직선이 표시된다.If the selected pixel (x, y) satisfies the inequality condition of Equation (2), the color of the corresponding pixel is changed to a desired data value (106). As a result, a straight line is displayed on the display.
한편, 선택된 픽셀이 부등식 조건을 만족하지 않거나 해당 픽셀의 칼라를 원하는 데이터 값으로 변경한 다음에는 103 단계에서 설정된 모든 대상 픽셀에 대해 상기 부등식을 만족하는지 여부를 조회하였는지 확인하여(107) 모든 대상 픽셀에 대해 완료되지 않았으면, 다음 픽셀을 순차적으로 선택하여(108), 부등식 조건을 만족하는지 검사한다. 그리고 모든 대상 픽셀에 대해 완료되었으면 종료한다.On the other hand, if the selected pixel does not satisfy the inequality condition or the color of the pixel is changed to a desired data value, it is checked whether all the target pixels set in
도 2는 본 발명에 따른 원을 그리는 과정을 설명하기 위한 흐름도이다.FIG. 2 is a flowchart illustrating a process of drawing circles according to the present invention.
원을 그리는 과정은 직선을 그리는 과정과 마찬가지로, 원의 중심 좌표 (a, b)와 반지름(r) 값을 입력받아(201), 입력된 값을 이용해 수학식 3과 같이 원 방정식을 계산한다(202).In the process of drawing a circle, the center coordinates (a, b) and the radius (r) of the circle are input (201), and the circular equation is calculated using Equation 3 using the input values 202).
그리고 조회에 따른 클럭 수를 줄이기 위해, 중심 픽셀 좌표에서 반지름만큼 떨어진 직선을 한 변으로 갖는 직사각형 내의 픽셀들을 조회 대상으로 설정한 다음(203), 설정된 대상 픽셀들 중 하나의 픽셀을 선택한다(204).In order to reduce the number of clocks according to the inquiry, pixels in a rectangle having a straight line spaced by a radius in the center pixel coordinates are set as an object of inquiry (203), and one pixel of the set target pixels is selected (204 ).
그런 다음 선택된 픽셀이 다음의 수학식 4와 같은 부등식 조건을 만족하는지 검사한다(205).Then, it is checked whether the selected pixel satisfies the inequality condition (Equation 4) (205).
검사 결과, 선택된 픽셀(x, y)이 상기 수학식 4의 부등식 조건을 만족하는 경우 해당 픽셀의 칼라를 원하는 데이터 값으로 변경한다(206). 이에 따라 디스플레이 상에는 원이 표시된다.If the selected pixel (x, y) satisfies the inequality condition of Equation (4), the color of the corresponding pixel is changed to a desired data value (206). As a result, a circle is displayed on the display.
한편, 선택된 픽셀이 부등식 조건을 만족하지 않거나 해당 픽셀의 칼라를 원하는 데이터 값으로 변경한 다음에는 203 단계에서 설정된 모든 대상 픽셀에 대해 상기 부등식을 만족하는지 여부를 조회하였는지 확인하여(207) 모든 대상 픽셀에 대해 완료되지 않았으면, 다음 픽셀을 순차적으로 선택하여(208), 부등식 조건을 만족하는지 검사한다. 그리고 모든 대상 픽셀에 대해 완료되었으면 종료한다.On the other hand, if the selected pixel does not satisfy the inequality condition or the color of the pixel is changed to a desired data value, it is checked whether all pixels set in the
한편, 다음의 수학식 5를 정리하면 수학식 6과 같이 다시 정리할 수 있다.On the other hand, the following Equation (5) can be rearranged as shown in Equation (6).
r-1 < r < 1+rr-1 < r < 1 + r
즉 중심에서 r-1보다는 멀고, r+1보다는 가까운 픽셀들이 원을 이루게 된다.In other words, the pixels farther from r-1 and closer to r + 1 in the center form a circle.
이상에서 설명한 본 발명은, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 있어 본 발명의 기술적 사상을 벗어나지 않는 범위 내에서 여러 가지 치환, 변형 및 변경이 가능하므로 전술한 실시예 및 첨부된 도면에 의해 한정되는 것이 아니다.It will be apparent to those skilled in the art that various modifications and variations can be made in the present invention without departing from the spirit or scope of the invention. The present invention is not limited to the drawings.
전술한 바와 같은 본 발명은, 한정된 픽셀을 갖는 디스플레이 장치에서 직선, 원과 같은 도형을 표시함에 있어서, 임의의 픽셀들이 부등식의 조건을 만족하는지의 여부를 판단하여, 상기 부등식을 만족하는 픽셀들을 디스플레이 상에 표시함으로써, 부동 소수점을 계산하지 않고도 도형을 고속으로 표시할 수 있는 효과가 있다.As described above, in the display device having a limited number of pixels, when displaying a figure such as a straight line or a circle, it is determined whether or not any of the pixels satisfies the condition of inequality, It is possible to display a graphic object at a high speed without calculating a floating point.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020050134241A KR100653514B1 (en) | 2005-12-29 | 2005-12-29 | A figure drawing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020050134241A KR100653514B1 (en) | 2005-12-29 | 2005-12-29 | A figure drawing method |
Publications (1)
Publication Number | Publication Date |
---|---|
KR100653514B1 true KR100653514B1 (en) | 2006-12-05 |
Family
ID=37731974
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020050134241A KR100653514B1 (en) | 2005-12-29 | 2005-12-29 | A figure drawing method |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR100653514B1 (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR19980026643A (en) * | 1996-10-10 | 1998-07-15 | 김영석 | High speed graphic drawing method |
-
2005
- 2005-12-29 KR KR1020050134241A patent/KR100653514B1/en not_active IP Right Cessation
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR19980026643A (en) * | 1996-10-10 | 1998-07-15 | 김영석 | High speed graphic drawing method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6437799B1 (en) | Method and apparatus for logical zooming of a directed graph | |
US11527040B2 (en) | Tessellating patches of surface data in tile based computer graphics rendering | |
US6323874B1 (en) | System and method for rendering an image | |
KR101159395B1 (en) | Design of arbitrary linear and non-linear maps | |
US6075541A (en) | Topographic triangulation in reduced time | |
CN103310480B (en) | By the method and apparatus using replaceable rejecting program to improve graphics performance | |
US9959685B2 (en) | Method and system for selectively blending buildings to improve route visibility in a 3D navigation system | |
US8345064B2 (en) | Method and system for tile binning using half-plane edge function | |
EP2523121A1 (en) | Method and device for processing spatial data | |
KR101953133B1 (en) | Apparatus and method for rendering | |
KR100723422B1 (en) | Apparatus and method for rendering image data using sphere splating and computer readable media for storing computer program | |
KR20170031479A (en) | Method and apparatus for performing a path stroke | |
US7505048B2 (en) | Estimation of overlap of polygons | |
US20090040230A1 (en) | Vector image drawing device, method for vector image drawing, and computer readable recording medium | |
JP2006107093A (en) | Image processor and program | |
US20080049040A1 (en) | Viewing multi-dimensional data in two dimensions | |
KR100653514B1 (en) | A figure drawing method | |
US20100134509A1 (en) | Image rendering processing apparatus | |
CN111932689B (en) | Three-dimensional object quick selection method adopting ID pixel graph | |
CN112988609B (en) | Data processing method, device, storage medium and client | |
CN101620743A (en) | Graphics processing with hidden surface removal | |
US20080165208A1 (en) | 3-Dimensional graphic processing apparatus and operating method thereof | |
US20100020096A1 (en) | Antialiasing apparatus | |
US20040012586A1 (en) | Image processing apparatus and method of same | |
KR101239965B1 (en) | Rendering apparatus employed in 3D graphic accelerator and method thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A201 | Request for examination | ||
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant | ||
FPAY | Annual fee payment |
Payment date: 20121022 Year of fee payment: 7 |
|
FPAY | Annual fee payment |
Payment date: 20131017 Year of fee payment: 8 |
|
FPAY | Annual fee payment |
Payment date: 20141020 Year of fee payment: 9 |
|
LAPS | Lapse due to unpaid annual fee |