WO2013102955A1 - Drawing device and drawing method - Google Patents

Drawing device and drawing method Download PDF

Info

Publication number
WO2013102955A1
WO2013102955A1 PCT/JP2012/000057 JP2012000057W WO2013102955A1 WO 2013102955 A1 WO2013102955 A1 WO 2013102955A1 JP 2012000057 W JP2012000057 W JP 2012000057W WO 2013102955 A1 WO2013102955 A1 WO 2013102955A1
Authority
WO
WIPO (PCT)
Prior art keywords
triangle
vertex
polygon
unit
triangles
Prior art date
Application number
PCT/JP2012/000057
Other languages
French (fr)
Japanese (ja)
Inventor
博康 根岸
Original Assignee
三菱電機株式会社
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 三菱電機株式会社 filed Critical 三菱電機株式会社
Priority to PCT/JP2012/000057 priority Critical patent/WO2013102955A1/en
Publication of WO2013102955A1 publication Critical patent/WO2013102955A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Definitions

  • the present invention relates to a drawing apparatus and a drawing method for creating drawing data representing a graphic to be displayed.
  • a mask image of the figure is created as a method of drawing a figure including a self-intersecting polygon, and the mask image The method of filling the inside of was used.
  • a plurality of triangles obtained by selecting three points from points defining the outline of a closed region graphic are extracted, and the vertices constituting the extracted plurality of triangles are the first.
  • a mask buffer is configured using the image, and a mask image configuring the mask buffer is drawn according to the non-zero winding rule.
  • a linear contour and a curved contour are analyzed for graphic data without mounting the above-described three-dimensional graphics hardware accelerator, Triangulate to generate triangle data, generate a mask image based on the drawing order of the vertices of the generated triangle data, refer to the pixel value of the generated mask image, and rasterize the place where the pixel value is a predetermined value Drawing data is generated.
  • the present invention has been made to solve the above-described problems.
  • a graphic including a self-intersecting polygon without using a mask image memory and without mounting dedicated graphic drawing hardware.
  • An object of the present invention is to provide a drawing apparatus that enables drawing.
  • the drawing apparatus acquires polygon data of a polygon to be drawn, detects vertices that specify a polygon from the acquired polygon data, and acquires vertex data that gives a drawing order to the detected vertices And a triangle extracting unit for extracting a plurality of triangles obtained by changing the second vertex and the third vertex from the polygon based on the drawing start vertex based on the drawing order given by the vertex data obtaining unit, and a triangle An arithmetic unit that performs a logical operation using a plurality of triangles extracted by the extraction unit, a polygon storage unit that stores a polygon that is a set of triangles as a calculation result of the arithmetic unit, and a polygon storage unit A drawing unit for drawing a polygon, and the triangle extraction unit extracts a drawing start vertex and a drawing start triangle connecting two vertices whose drawing order is continuous from the drawing start vertex and stores the drawing start triangle in the polygon storage unit.
  • the arithmetic unit is The drawing start triangle stored in the square storage unit or the drawing order of the vertices of the triangle that is the operation result, and the second vertex and the third vertex are changed based on the drawing start point except for the drawing start triangle
  • the logical operation is performed on all triangles extracted by the triangle extraction unit in the operation unit, the logical operation is performed based on the drawing order of the respective vertices of the triangles, and stored in the storage unit. It draws a polygon.
  • FIG. 1 is a block diagram illustrating a configuration of a drawing apparatus according to Embodiment 1.
  • FIG. 3 is a flowchart illustrating an operation of the drawing apparatus according to the first embodiment.
  • FIG. 6 is an explanatory diagram illustrating processing of the drawing apparatus according to the first embodiment.
  • FIG. 6 is an explanatory diagram illustrating processing of the drawing apparatus according to the first embodiment.
  • FIG. 6 is an explanatory diagram illustrating processing of the drawing apparatus according to the first embodiment.
  • FIG. 1 is a block diagram illustrating a configuration of a drawing apparatus according to the first embodiment.
  • the drawing apparatus 1 includes a drawing processing unit 2 configured by an arithmetic processor represented by a CPU (Central Processing Unit) and the like, and a memory 3 that holds instruction codes and data of the drawing processing unit 2.
  • the drawing device 1 is connected to a storage device 5 and a display device 6 via an I / O interface 4.
  • the storage device 5 stores a plurality of polygon data for specifying polygons to be drawn.
  • the display device 6 displays the polygon drawn by the drawing device 1 on a screen or the like.
  • the drawing processing unit 2 includes a vertex data acquisition unit 21, a triangle extraction unit 22, a calculation unit 23, a polygon storage unit 24, a drawing unit 25, and a display control unit 26.
  • the vertex data acquisition unit 21 reads polygon data from the storage device 5 via the I / O interface 4, detects each vertex specifying the polygon from the read polygon data, and sets the drawing order to each detected vertex. Numbers shown (for example, V1, V2, V3,..., Vn) are assigned.
  • the triangle extraction unit 22 refers to the number of each vertex assigned by the vertex data acquisition unit 21, selects one vertex (for example, the vertex V1) as the start vertex, and then continues to the second vertex (for example, the vertex V2) and A third vertex (for example, vertex V3) is selected to extract a triangle. Further, with reference to the extracted triangle vertex numbers, it is determined whether the vertex arrangement direction is clockwise or counterclockwise. For the apex arrangement direction (clockwise or counterclockwise), for example, in the case of the triangle V1-V2-V3, the cross product of the vector V1-V2 and the vector V2-V3 is calculated, and the sign of the Z component in the depth direction of the calculated cross product Determined by.
  • the triangle (drawing start triangle) extracted first by the triangle extraction unit 22 and data indicating the arrangement direction of the vertices of the triangle are stored in a polygon storage unit 24 described later.
  • the calculation unit 23 acquires data indicating the arrangement direction of the triangles and vertices stored in the polygon storage unit 24, and data indicating the arrangement direction of the triangles and vertices most recently extracted by the triangle extraction unit 22, and obtains two triangles. Perform logical operation. When the two triangles are arranged in different directions, an operation based on a logical difference is performed. When the two triangles are arranged in the same direction, an operation based on a logical sum is performed.
  • the polygon storage unit 24 stores polygons that are aggregates of triangles that are the calculation results of the calculation unit 23. Further, the triangle extraction unit 22 stores data indicating the triangle (drawing start triangle) extracted first and the arrangement direction of the vertices.
  • the drawing unit 25 fills a polygon to be drawn using the calculation result stored in the polygon storage unit 24.
  • the display processing unit 26 performs display processing on the polygonal drawing data painted in the drawing unit 25.
  • FIG. 2 is a flowchart showing the operation of the drawing apparatus according to the first embodiment.
  • the vertex data acquisition unit 21 of the drawing processing unit 2 reads and acquires the necessary number of polygon data from the storage device 5 (step ST1). In this operation description, it is assumed that one piece of polygon data is acquired. Furthermore, the vertex data acquisition unit 21 reads out each vertex of the polygon to be drawn based on the acquired square data, and stores each vertex with a number indicating the drawing order (step ST2).
  • the triangle extraction unit 22 refers to the vertex data stored in the vertex data acquisition unit 21, selects the vertex having the smallest number from the numbers assigned in step ST2 as the drawing start vertex, and continues from the start vertex. Extract the triangles that connect the two vertices as the second vertex and the third vertex in ascending order of numbers, refer to the extracted triangle vertex numbers, and the vertex alignment direction is clockwise or counterclockwise Is determined (step ST3). The arrangement direction of the triangles and vertices extracted in step ST3 is stored in the polygon storage unit 24 (step ST4).
  • the triangle extraction unit 22 extracts the triangle connected with the last vertex of the previously extracted triangle as the second vertex and the next vertex continuous with the second vertex as the third vertex, It is determined whether the vertex arrangement direction is clockwise or counterclockwise (step ST5).
  • the vertex arrangement direction is determined by calculating the outer product of the vector from the drawing start vertex to the second vertex and the vector from the drawing start vertex to the third vertex as described above, and using the Z component code in the depth direction. .
  • the calculation unit 23 acquires the arrangement direction of the triangles and vertices stored in the polygon storage unit 24 and the arrangement direction of the triangles and vertices extracted by the triangle extraction unit 22, and the arrangement direction of the vertices of the two triangles is the same. Is determined (step ST6).
  • step ST6; YES When the arrangement directions of the vertices of the two triangles are the same (step ST6; YES), one or more triangles are obtained by performing an operation by logical sum (step ST7).
  • step ST6; NO one or more triangles are obtained by performing a calculation based on a logical difference (step ST8).
  • the triangle acquired in step ST7 or step ST8 is overwritten and stored in the polygon storage unit 24 (step ST9).
  • the calculation unit 23 determines whether or not the last vertex of the polygon is included in the two triangles used in the calculation process (step ST10). When it is determined that the last vertex is not included (step ST10). NO), returning to the process of step ST5 described above, extracting the next triangle and repeating the process described above.
  • step ST10 when it is determined that the last vertex is included (step ST10; YES), the drawing unit 25 reads out the triangle stored in the polygon storage unit 24, fills it, and draws the polygon to be drawn. Is performed (step ST11).
  • the display processing unit 26 performs display processing on the polygonal drawing data drawn in step ST11, and outputs it to the display device 6 via the I / O interface 4 (step ST12), and ends the processing. Note that various polygons can be obtained as the calculation method of the logical operation depending on the algorithm.
  • step ST1 the vertex data acquisition unit 21 reads polygon data relating to the polygon A, and in step ST2, assigns numbers a1, a2, a3, a4, a5 to the vertices of the polygon A in the drawing order and stores them.
  • step ST3 the triangle extraction unit 22 selects the vertex a1 as the drawing start vertex, and extracts the triangle a1-a2-a3 (drawing start triangle) having the vertex a2 as the second vertex and the vertex a3 as the third vertex.
  • the arrangement direction Q1 of the vertices a1, a2, and a3 is determined to be counterclockwise by the sign of the Z component in the depth direction of the outer product of the vector a1-a2 and the vector a1-a3 of the extracted triangle a1-a2-a3.
  • the extracted triangle a1-a2-a3 and vertex arrangement direction Q1 are stored in the polygon storage unit 24.
  • the vertex arrangement directions Q2, Q3, Q4, and Q5 shown in the following description are also determined by the sign of the Z component in the depth direction of the outer product of two vectors.
  • step ST5 the triangle extraction unit 22 extracts a triangle a1-a3-a4 having the last vertex a3 of the previously extracted triangle a1-a2-a3 as the second vertex and the vertex a4 as the third vertex. Then, it is determined that the vertex arrangement direction Q2 of the extracted triangles a1-a3-a4 is clockwise.
  • step ST6 the operation unit 23 compares the triangle a1-a2-a3 stored in the polygon storage unit 24 with the triangle a1-a3-a4 extracted by the triangle extraction unit 22, and arranges the apex directions Q1, It is determined that Q2 is not the same, and in step ST8, calculation is performed using a logical difference using the triangle a1-a2-a3 and the triangle a1-a3-a4, and the triangle a1-a4-a6 and the triangle a6-a2-a3 (FIG. 3 ( e) See). At the same time, the alignment directions Q4 and Q5 of the vertices of the triangle a1-a4-a6 and the triangle a6-a2-a3 are also acquired. As step ST9, the calculation unit 23 overwrites and stores the acquired triangle a1-a4-a6 and vertex arrangement direction Q4 and triangle a6-a2-a3 and vertex arrangement direction Q5 in the polygon storage unit 24.
  • step ST10 the calculation unit 23 determines that the triangle a1-a2-a3 and the triangle a1-a3-a4 used for the calculation do not include the last vertex a5 of the polygon, and the process of step ST5 Returning to FIG. 3, the triangle extraction unit 22 extracts the next triangle a1-a4-a5, and determines that the arrangement direction Q3 of the vertices of the extracted triangle a1-a4-a5 is counterclockwise.
  • the calculation unit 23 compares the triangle a1-a4-a6 stored in the polygon storage unit 24 with the triangle a1-a4-a5 extracted by the triangle extraction unit 22, and arranges the apex direction Q4 of each triangle. It is determined that Q3 is not the same, similarly, the triangle a6-a2-a3 and the triangle a1-a4-a5Q5, Q3 are compared to determine that the arrangement direction of the vertices of each triangle is the same, and in step ST7, the triangle a1 -A4-a6 and a triangle a1-a4-a5 are used to perform an arithmetic operation, the triangle a6-a2-a3 and a triangle a1-a4-a5 are used to perform an arithmetic operation, and a triangle a1-a6-a9 , Triangle a4-a10-a6, triangle a6-a2-a3, and triangle a8-a5-a7 (see FIG.
  • step ST9 the computing unit 23 overwrites and stores the acquired triangle a1-a6-a9, triangle a4-a10-a6, triangle a6-a2-a3, and triangle a8-a5-a7 in the polygon storage unit 24.
  • step ST10 the calculation unit 23 determines that the triangle a1-a4-a5 used for the calculation includes the last vertex a5 of the polygon, and in step ST11, the drawing unit 25 sets the polygon storage unit 24.
  • step ST12 the display processing unit 26 performs display processing on the drawing data of the polygon A, outputs it to the display device 6 via the I / O interface 4, and ends the processing.
  • step ST1 the vertex data acquisition unit 21 reads polygon data relating to the polygon B, and stores the vertexes of the polygon A with numbers b1, b2, b3, b4, and b5 in step ST2.
  • step ST3 the triangle extraction unit 22 selects the vertex b1 as the drawing start vertex, and extracts the triangle b1-b2-b3 (drawing start triangle) having the vertex b2 as the second vertex and the vertex b3 as the third vertex.
  • the arrangement direction R1 of the vertices b1, b2, and b3 is determined to be clockwise by the sign of the Z component in the depth direction of the outer product of the vector b1-b2 and the vector b1-b3 of the extracted triangle b1-b2-b3.
  • the extracted triangle b1-b2-b3 and vertex arrangement direction R1 are stored in the polygon storage unit 24. Note that the vertex arrangement directions R2, R3, and R4 shown in the following description are also determined by the sign of the Z component in the depth direction of the outer product of two vectors, as described above.
  • step ST5 the triangle extraction unit 22 extracts a triangle b1-b3-b4 having the last vertex b3 of the previously extracted triangle b1-b2-b3 as the second vertex and the vertex b4 as the third vertex. Then, it is determined that the vertex arrangement direction R2 of the extracted triangles b1-b3-b4 is counterclockwise.
  • step ST6 the calculation unit 23 compares the triangle b1-b2-b3 stored in the polygon storage unit 24 with the triangle b1-b3-b4 extracted by the triangle extraction unit 22, and arranges the apex alignment directions R1, R1 of the triangles. It is determined that R2 is not the same, and in step ST8, an operation based on a logical difference is performed using the triangle b1-b2-b3 and the triangle b1-b3-b4 to obtain the triangle b2-a3-a4 (see FIG. 4 (e)). .
  • step ST9 the calculation unit 23 overwrites and stores the acquired triangle b2-b3-b4 in the polygon storage unit 24.
  • step ST10 the calculation unit 23 determines that the triangle b1-b2-b3 and the triangle b1-b3-ab used in the calculation do not include the last vertex b5 of the polygon, and the process of step ST5 Returning to, the next triangle b1-b4-b5 is extracted, and it is determined that the vertex arrangement direction R3 of the extracted triangle b1-b4-b5 is counterclockwise.
  • step ST6 the calculation unit 23 compares the triangle b2-b3-b4 stored in the polygon storage unit 24 with the triangle b1-b4-b5 extracted by the triangle extraction unit 22, and arranges the apex alignment directions R4, R4 of the triangles. It is determined that R3 is the same, and in step ST7, an arithmetic operation is performed using the triangle b2-b3-b4 and the triangle b1-b4-b5, and the triangle b2-b3-b4 and the triangle b1-b4-b5 (FIG. 4 (f)). As step ST9, the calculation unit 23 overwrites and stores the acquired triangle b2-b3-b4 and triangle b1-b4-b5 in the polygon storage unit 24.
  • step ST10 the calculation unit 23 determines that the triangle b1-b4-b5 used for the calculation includes the last vertex b5 of the polygon, and in step ST11, the drawing unit 25 sets the polygon storage unit 24.
  • the triangles b2-b3-b4 and triangles b1-b4-b5 stored in the above are read out and painted, and the polygon B to be drawn is drawn.
  • step ST12 the display processing unit 26 performs a display process on the drawing data of the polygon B, outputs it to the display device 6 via the I / O interface 4, and ends the process.
  • the drawing apparatus 1 of the first embodiment can also draw a non-self-intersecting convex polygon shown in FIG.
  • the triangle c1-c2-c3 (drawing start triangle), the triangle c1-c3-c4, and the triangle c1-c4-c5 extracted sequentially from the drawing start vertex c1 do not overlap each other
  • the arrangement directions of the vertices are the same (counterclockwise in the example of FIG. 5)
  • the extracted triangles c1-c2-c3, triangles c1-c3-c4, and triangles c1-c4-c5 are all subjected to a logical OR operation. Do.
  • the polygon drawn by the drawing unit 25 is the same as the polygon C divided by three triangles (see FIG. 5B).
  • the vertex data acquisition unit 21 that detects a vertex of a polygon and assigns the drawing order
  • the triangle extraction unit that extracts a plurality of triangles based on the drawing order of the polygon 22
  • a calculation unit 23 that performs a logical sum operation or a logical difference calculation based on the arrangement direction of the triangles stored in the polygon storage unit 24 and the triangle vertices extracted by the triangle extraction unit 22, and the calculation result of the calculation unit 23 Since it is configured to include a polygon storage unit 24 that stores polygons that are aggregates of triangles and a drawing unit 25 that draws polygons stored in the polygon storage unit 24, mask data is created.
  • it is possible to draw a graphic including a self-intersecting polygon without mounting hardware dedicated to graphic drawing.
  • the vertex arrangement direction determined by the sign of the outer product of the two vectors constituting the triangle is calculated, and the calculation unit 23 performs logic based on the arrangement direction of the two triangle vertices. Since the sum operation or the logical difference operation is performed, it is possible to draw a graphic including a self-intersecting polygon without creating mask data.
  • any component of the embodiment can be modified or any component of the embodiment can be omitted within the scope of the invention.
  • drawing of polygons including self-intersecting figures by the drawing apparatus and drawing method according to the present invention may include a device that cannot secure a memory capacity for creating mask data or special hardware. Suitable for mounting on devices that cannot.

Abstract

The present invention is provided with a triangle extractor (22) and an operation unit (23). The triangle extractor (22) extracts, on the basis of a drawing order for vertices of a polygon, a plurality of triangles having each of a second vertex and a third vertex changed with reference to a draw-start vertex; extracts a draw-start triangle in which the draw-start vertex is connected to two vertices for which the drawing order is contiguous from the draw-start vertex; and stores the draw-start triangle in a polygon storage unit (24). The operation unit (23) performs a logical operation based on the drawing order of the vertices of the triangle that is the result of an [MV1] operation or the draw-start triangle stored in the polygon storage unit (24), and the drawing order of the vertices of a triangle in which the second vertex and the third vertex are changed with reference to a draw-start point, the triangle not being the draw-start triangle.

Description

描画装置および描画方法Drawing apparatus and drawing method
 この発明は、表示すべき図形を表す描画データを作成する描画装置および描画方法に関するものである。 The present invention relates to a drawing apparatus and a drawing method for creating drawing data representing a graphic to be displayed.
 従来、図形を点、線、三角形の基本描画プリミティブで描画処理するコンピュータグラフィックス処理において、特に自己交差型の多角形を含む図形を描画する方法として、図形のマスクイメージを作成し、該マスクイメージの内部を塗りつぶす方法が用いられていた。
 特許文献1に開示された描画処理装置では、閉領域図形の輪郭を定める点の中から3点を選択して得られる三角形を複数抽出し、抽出した複数の三角形を構成する頂点が第1の回転方向に並んだ三角形を有効にして描画した結果を用いたマスクイメージと、抽出した複数の三角形を構成する頂点が第2の回転方向に並んだ三角形を有効にして描画した結果を用いたマスクイメージとを用いてマスクバッファを構成し、ノンゼロワインディングルールに従ってマスクバッファを構成するマスク画像を描画している。なお、特許文献1の画像処理装置では、マスクイメージを作成するために3次元グラフィックスハードウェアアクセラレータを搭載する必要があった。
Conventionally, in computer graphics processing for drawing a figure with basic drawing primitives of points, lines, and triangles, a mask image of the figure is created as a method of drawing a figure including a self-intersecting polygon, and the mask image The method of filling the inside of was used.
In the drawing processing apparatus disclosed in Patent Document 1, a plurality of triangles obtained by selecting three points from points defining the outline of a closed region graphic are extracted, and the vertices constituting the extracted plurality of triangles are the first. Mask image using the result of rendering with triangles arranged in the rotation direction enabled, and mask using the result of drawing with the triangles constituting the extracted triangles arranged in the second rotation direction enabled A mask buffer is configured using the image, and a mask image configuring the mask buffer is drawn according to the non-zero winding rule. In the image processing apparatus of Patent Document 1, it is necessary to mount a three-dimensional graphics hardware accelerator in order to create a mask image.
 一方、特許文献2に開示された描画装置では、上述した3次元グラフィックスハードウェアアクセラレータを搭載することなく、図形データに対して直線輪郭と曲線輪郭の解析を行い、直線輪郭および曲線輪郭をそれぞれ三角形化して三角形データを生成し、生成した三角形データの頂点の描画順序に基づいてマスクイメージを生成し、生成したマスクイメージのピクセル値を参照し、ピクセル値が所定値の箇所をラスタライズすることにより描画データを生成している。 On the other hand, in the drawing apparatus disclosed in Patent Document 2, a linear contour and a curved contour are analyzed for graphic data without mounting the above-described three-dimensional graphics hardware accelerator, Triangulate to generate triangle data, generate a mask image based on the drawing order of the vertices of the generated triangle data, refer to the pixel value of the generated mask image, and rasterize the place where the pixel value is a predetermined value Drawing data is generated.
特開2011-165062号公報JP 2011-165062 A 特開2007-304871号公報JP 2007-304871 A
 しかしながら、上述した従来の技術では、マスクイメージを生成し、生成したマスクイメージを参照して描画処理を行うため、画像表示用のフレームバッファ用のメモリ以外に、マスクイメージ用のメモリが必要となるという課題があった。マスクイメージ作成用のメモリのサイズとしては、表示装置の画面全体を描画する可能性もあるため、画面表示用と同一の解像度が必要となる。そのため、メモリリソースが少なく、図形描画専用のハードウェアを搭載しない環境で自己交差型の多角形を含む図形を描画することが困難であるという課題があった。 However, in the above-described conventional technique, a mask image is generated, and drawing processing is performed with reference to the generated mask image. Therefore, in addition to a frame buffer memory for image display, a mask image memory is required. There was a problem. As the size of the memory for creating the mask image, since there is a possibility that the entire screen of the display device is drawn, the same resolution as that for the screen display is required. For this reason, there is a problem that it is difficult to draw a graphic including a self-intersecting polygon in an environment where there are few memory resources and hardware dedicated for graphic drawing is not installed.
 この発明は、上記のような課題を解決するためになされたもので、マスクイメージ用のメモリを用いることなく、さらに図形描画専用のハードウェアを搭載することなく自己交差型の多角形を含む図形の描画を可能にする描画装置を提供することを目的とする。 The present invention has been made to solve the above-described problems. A graphic including a self-intersecting polygon without using a mask image memory and without mounting dedicated graphic drawing hardware. An object of the present invention is to provide a drawing apparatus that enables drawing.
 この発明に係る描画装置は、描画対象となる多角形の多角形データを取得し、取得した多角形データから多角形を特定する頂点を検出し、検出した頂点に描画順序を付与する頂点データ取得部と、頂点データ取得部が付与した描画順序に基づき、多角形から描画開始頂点を基準に第2の頂点および第3の頂点をそれぞれ変化させた複数の三角形を抽出する三角形抽出部と、三角形抽出部が抽出した複数の三角形を用いて論理演算を行う演算部と、演算部の演算結果である三角形の集合体である多角形を記憶する多角形記憶部と、多角形記憶部に記憶された多角形を描画する描画部とを備え、三角形抽出部が描画開始頂点と、該描画開始頂点から描画順序が連続する2頂点を結んだ描画開始三角形を抽出して多角形記憶部に記憶し、演算部が多角形記憶部に記憶された描画開始三角形あるいは演算結果である三角形の各頂点の描画順序と、描画開始三角形以外であって、描画開始点を基準に第2の頂点および第3の頂点をそれぞれ変化させた三角形の各頂点の描画順序とに基づいた論理演算を行い、描画部が演算部において三角形抽出部が抽出した全ての三角形に対して論理演算が行われた場合に、記憶部に記憶された多角形を描画するものである。 The drawing apparatus according to the present invention acquires polygon data of a polygon to be drawn, detects vertices that specify a polygon from the acquired polygon data, and acquires vertex data that gives a drawing order to the detected vertices And a triangle extracting unit for extracting a plurality of triangles obtained by changing the second vertex and the third vertex from the polygon based on the drawing start vertex based on the drawing order given by the vertex data obtaining unit, and a triangle An arithmetic unit that performs a logical operation using a plurality of triangles extracted by the extraction unit, a polygon storage unit that stores a polygon that is a set of triangles as a calculation result of the arithmetic unit, and a polygon storage unit A drawing unit for drawing a polygon, and the triangle extraction unit extracts a drawing start vertex and a drawing start triangle connecting two vertices whose drawing order is continuous from the drawing start vertex and stores the drawing start triangle in the polygon storage unit. , The arithmetic unit is The drawing start triangle stored in the square storage unit or the drawing order of the vertices of the triangle that is the operation result, and the second vertex and the third vertex are changed based on the drawing start point except for the drawing start triangle When the logical operation is performed on all triangles extracted by the triangle extraction unit in the operation unit, the logical operation is performed based on the drawing order of the respective vertices of the triangles, and stored in the storage unit. It draws a polygon.
 この発明によれば、マスクイメージを作成することなく、且つ図形描画専用のハードウェアを搭載することなく、自己交差型の多角形を含む図形を描画することができる。 According to the present invention, it is possible to draw a graphic including a self-intersecting polygon without creating a mask image and without installing hardware dedicated to graphic drawing.
実施の形態1による描画装置の構成を示すブロック図である。1 is a block diagram illustrating a configuration of a drawing apparatus according to Embodiment 1. FIG. 実施の形態1による描画装置の動作を示すフローチャートである。3 is a flowchart illustrating an operation of the drawing apparatus according to the first embodiment. 実施の形態1による描画装置の処理を示す説明図である。FIG. 6 is an explanatory diagram illustrating processing of the drawing apparatus according to the first embodiment. 実施の形態1による描画装置の処理を示す説明図である。FIG. 6 is an explanatory diagram illustrating processing of the drawing apparatus according to the first embodiment. 実施の形態1による描画装置の処理を示す説明図である。FIG. 6 is an explanatory diagram illustrating processing of the drawing apparatus according to the first embodiment.
 以下、この発明をより詳細に説明するために、この発明を実施するための形態について、添付の図面に従って説明する。
実施の形態1.
 図1は、実施の形態1による描画装置の構成を示すブロック図である。
 描画装置1は、CPU(Central Processing Unit)などに代表される演算向けプロセッサで構成される描画処理部2および描画処理部2の命令コードやデータを保持するメモリ3で構成されている。また、この描画装置1は、I/Oインタフェース4を介して記憶装置5や表示装置6と接続されている。記憶装置5は、描画対象となる多角形を特定する複数の多角形データを格納している。表示装置6は、描画装置1において描画された多角形を画面上などに表示する。
Hereinafter, in order to explain the present invention in more detail, modes for carrying out the present invention will be described with reference to the accompanying drawings.
Embodiment 1 FIG.
FIG. 1 is a block diagram illustrating a configuration of a drawing apparatus according to the first embodiment.
The drawing apparatus 1 includes a drawing processing unit 2 configured by an arithmetic processor represented by a CPU (Central Processing Unit) and the like, and a memory 3 that holds instruction codes and data of the drawing processing unit 2. The drawing device 1 is connected to a storage device 5 and a display device 6 via an I / O interface 4. The storage device 5 stores a plurality of polygon data for specifying polygons to be drawn. The display device 6 displays the polygon drawn by the drawing device 1 on a screen or the like.
 描画処理部2は、頂点データ取得部21、三角形抽出部22、演算部23、多角形記憶部24、描画部25および表示制御部26を備えている。
 頂点データ取得部21は、I/Oインタフェース4を介して記憶装置5から多角形データを読み出し、読み出した多角形データから多角形を特定する各頂点を検出し、検出した各頂点に描画順序を示す番号(例えば、V1,V2,V3,・・・,Vn)を付与する。
The drawing processing unit 2 includes a vertex data acquisition unit 21, a triangle extraction unit 22, a calculation unit 23, a polygon storage unit 24, a drawing unit 25, and a display control unit 26.
The vertex data acquisition unit 21 reads polygon data from the storage device 5 via the I / O interface 4, detects each vertex specifying the polygon from the read polygon data, and sets the drawing order to each detected vertex. Numbers shown (for example, V1, V2, V3,..., Vn) are assigned.
 三角形抽出部22は、頂点データ取得部21が付与した各頂点の番号を参照し、1つの頂点(例えば、頂点V1)を開始頂点として選択し、続く第2の頂点(例えば、頂点V2)および第3の頂点(例えば、頂点V3)を選択して三角形を抽出する。さらに抽出した三角形の頂点番号を参照し、頂点の並び方向が時計回りであるか反時計回りであるか判別する。頂点の並び方向(時計回りまたは反時計回り)は、たとえば三角形V1-V2-V3の場合、ベクトルV1-V2とベクトルV2-V3の外積を算出し、算出した外積の奥行き方向のZ成分の符号により決定される。なお、三角形抽出部22が最初に抽出した三角形(描画開始三角形)と該三角形の頂点の並び方向を示すデータは、後述する多角形記憶部24に格納する。 The triangle extraction unit 22 refers to the number of each vertex assigned by the vertex data acquisition unit 21, selects one vertex (for example, the vertex V1) as the start vertex, and then continues to the second vertex (for example, the vertex V2) and A third vertex (for example, vertex V3) is selected to extract a triangle. Further, with reference to the extracted triangle vertex numbers, it is determined whether the vertex arrangement direction is clockwise or counterclockwise. For the apex arrangement direction (clockwise or counterclockwise), for example, in the case of the triangle V1-V2-V3, the cross product of the vector V1-V2 and the vector V2-V3 is calculated, and the sign of the Z component in the depth direction of the calculated cross product Determined by. The triangle (drawing start triangle) extracted first by the triangle extraction unit 22 and data indicating the arrangement direction of the vertices of the triangle are stored in a polygon storage unit 24 described later.
 演算部23は、多角形記憶部24に記憶された三角形と頂点の並び方向を示すデータと、三角形抽出部22が直近に抽出した三角形と頂点の並び方向を示すデータを取得し、2つの三角形の論理演算を行う。2つの三角形の並び方向が異なる場合には論理差による演算を行い、2つの三角形の並び方向が同一の場合には論理和による演算を行う。多角形記憶部24は、演算部23の演算結果である三角形の集合体である多角形を格納する。また、三角形抽出部22が最初に抽出した三角形(描画開始三角形)と頂点の並び方向を示すデータを格納する。描画部25は、多角形記憶部24に格納された演算結果を用いて描画対象である多角形の塗りつぶしを行う。表示処理部26は、描画部25において塗りつぶされた多角形の描画データに対して表示処理を行う。 The calculation unit 23 acquires data indicating the arrangement direction of the triangles and vertices stored in the polygon storage unit 24, and data indicating the arrangement direction of the triangles and vertices most recently extracted by the triangle extraction unit 22, and obtains two triangles. Perform logical operation. When the two triangles are arranged in different directions, an operation based on a logical difference is performed. When the two triangles are arranged in the same direction, an operation based on a logical sum is performed. The polygon storage unit 24 stores polygons that are aggregates of triangles that are the calculation results of the calculation unit 23. Further, the triangle extraction unit 22 stores data indicating the triangle (drawing start triangle) extracted first and the arrangement direction of the vertices. The drawing unit 25 fills a polygon to be drawn using the calculation result stored in the polygon storage unit 24. The display processing unit 26 performs display processing on the polygonal drawing data painted in the drawing unit 25.
 次に、描画装置1の動作について説明する。図2は実施の形態1による描画装置の動作を示すフローチャートである。
 描画装置1においてメモリ3のプログラムの実行が開始されると、描画処理部2の頂点データ取得部21は、記憶装置5から必要なる数の多角形データを読み出して取得する(ステップST1)。なお、この動作説明では一つの多角形データを取得するものとして説明する。さらに、頂点データ取得部21は、取得した角形データに基づき描画対象の多角形の各頂点を読み出し、各頂点に描画順序を示す番号を付して記憶する(ステップST2)。
Next, the operation of the drawing apparatus 1 will be described. FIG. 2 is a flowchart showing the operation of the drawing apparatus according to the first embodiment.
When execution of the program in the memory 3 is started in the drawing device 1, the vertex data acquisition unit 21 of the drawing processing unit 2 reads and acquires the necessary number of polygon data from the storage device 5 (step ST1). In this operation description, it is assumed that one piece of polygon data is acquired. Furthermore, the vertex data acquisition unit 21 reads out each vertex of the polygon to be drawn based on the acquired square data, and stores each vertex with a number indicating the drawing order (step ST2).
 三角形抽出部22は、頂点データ取得部21に記憶された頂点データを参照して、ステップST2で付した番号のうち、最も小さい番号を有する頂点を描画開始頂点として選択し、該開始頂点から連続する2つの頂点を番号の小さい順に第2の頂点、第3の頂点として接続した三角形を抽出し、抽出した三角形の頂点の番号を参照して頂点の並び方向が時計回りであるか反時計回りであるか判別を行う(ステップST3)。ステップST3で抽出した三角形および頂点の並び方向を多角形記憶部24に格納する(ステップST4)。さらに三角形抽出部22は、前回抽出した三角形の最後の頂点を第2の頂点とし、該第2の頂点に連続する次の頂点を第3の頂点として接続した三角形を抽出し、抽出した三角形の頂点の並び方向が時計回りであるか反時計回りであるか判別を行う(ステップST5)。
 頂点の並び方向の判別は、上述したように描画開始頂点から第2の頂点へのベクトル、描画開始頂点から第3の頂点へのベクトルの外積を求め、その奥行き方向のZ成分の符号により行う。
The triangle extraction unit 22 refers to the vertex data stored in the vertex data acquisition unit 21, selects the vertex having the smallest number from the numbers assigned in step ST2 as the drawing start vertex, and continues from the start vertex. Extract the triangles that connect the two vertices as the second vertex and the third vertex in ascending order of numbers, refer to the extracted triangle vertex numbers, and the vertex alignment direction is clockwise or counterclockwise Is determined (step ST3). The arrangement direction of the triangles and vertices extracted in step ST3 is stored in the polygon storage unit 24 (step ST4). Further, the triangle extraction unit 22 extracts the triangle connected with the last vertex of the previously extracted triangle as the second vertex and the next vertex continuous with the second vertex as the third vertex, It is determined whether the vertex arrangement direction is clockwise or counterclockwise (step ST5).
The vertex arrangement direction is determined by calculating the outer product of the vector from the drawing start vertex to the second vertex and the vector from the drawing start vertex to the third vertex as described above, and using the Z component code in the depth direction. .
 演算部23は、多角形記憶部24に記憶された三角形および頂点の並び方向および三角形抽出部22が抽出した三角形および頂点の並び方向を取得し、2つの三角形の頂点の並び方向が同一であるか否か判定を行う(ステップST6)。2つの三角形の頂点の並び方向が同一である場合(ステップST6;YES)、論理和による演算を行い1以上の三角形を取得する(ステップST7)。一方、2つの三角形の頂点の並び方向が同一でない場合(ステップST6;NO)、論理差による演算を行い1以上の三角形を取得する(ステップST8)。ステップST7あるいはステップST8で取得した三角形は多角形記憶部24に上書き格納される(ステップST9)。 The calculation unit 23 acquires the arrangement direction of the triangles and vertices stored in the polygon storage unit 24 and the arrangement direction of the triangles and vertices extracted by the triangle extraction unit 22, and the arrangement direction of the vertices of the two triangles is the same. Is determined (step ST6). When the arrangement directions of the vertices of the two triangles are the same (step ST6; YES), one or more triangles are obtained by performing an operation by logical sum (step ST7). On the other hand, if the arrangement directions of the vertices of the two triangles are not the same (step ST6; NO), one or more triangles are obtained by performing a calculation based on a logical difference (step ST8). The triangle acquired in step ST7 or step ST8 is overwritten and stored in the polygon storage unit 24 (step ST9).
 演算部23は、演算処理に用いた2つの三角形に多角形の最後の頂点が含まれていたか否か判定を行う(ステップST10)最後の頂点が含まれていないと判定された場合(ステップST10;NO)、上述したステップST5の処理に戻り、次の三角形の抽出を行い、上述した処理を繰り返す。 The calculation unit 23 determines whether or not the last vertex of the polygon is included in the two triangles used in the calculation process (step ST10). When it is determined that the last vertex is not included (step ST10). NO), returning to the process of step ST5 described above, extracting the next triangle and repeating the process described above.
 一方、最後の頂点を含んでいると判定された場合(ステップST10;YES)、描画部25は、多角形記憶部24に格納された三角形を読み出して塗りつぶしを行い、描画対象の多角形の描画を行う(ステップST11)。表示処理部26は、ステップST11において描画された多角形の描画データに対して表示処理を行い、I/Oインタフェース4を介して表示装置6に出力し(ステップST12)、処理を終了する。なお、論理演算の計算方法はアルゴリズムの違いにより様々な多角形が得られる。 On the other hand, when it is determined that the last vertex is included (step ST10; YES), the drawing unit 25 reads out the triangle stored in the polygon storage unit 24, fills it, and draws the polygon to be drawn. Is performed (step ST11). The display processing unit 26 performs display processing on the polygonal drawing data drawn in step ST11, and outputs it to the display device 6 via the I / O interface 4 (step ST12), and ends the processing. Note that various polygons can be obtained as the calculation method of the logical operation depending on the algorithm.
 次に、図2に示したフローチャートに沿って、図3に示す自己交差型の多角形の描画処理について説明を行う。
 ステップST1として頂点データ取得部21は多角形Aに関する多角形データを読み出し、ステップST2として多角形Aの各頂点に描画順序に沿って番号a1,a2,a3,a4,a5を付して記憶する。ステップST3として、三角形抽出部22は、頂点a1を描画開始頂点として選択し、頂点a2を第2の頂点、頂点a3を第3の頂点とする三角形a1-a2-a3(描画開始三角形)を抽出し、抽出した三角形a1-a2-a3のベクトルa1-a2およびベクトルa1-a3の外積の奥行き方向のZ成分の符号により、頂点a1,a2,a3の並び方向Q1が反時計回りであると判別する。ステップST4として、抽出した三角形a1-a2-a3と、頂点の並び方向Q1を多角形記憶部24に格納する。
 なお、以下の説明で示す頂点の並び方向Q2,Q3,Q4,Q5も上記と同様に、2つのベクトルの外積の奥行き方向のZ成分の符号により判定される。
Next, the drawing process of the self-intersecting polygon shown in FIG. 3 will be described along the flowchart shown in FIG.
In step ST1, the vertex data acquisition unit 21 reads polygon data relating to the polygon A, and in step ST2, assigns numbers a1, a2, a3, a4, a5 to the vertices of the polygon A in the drawing order and stores them. . As step ST3, the triangle extraction unit 22 selects the vertex a1 as the drawing start vertex, and extracts the triangle a1-a2-a3 (drawing start triangle) having the vertex a2 as the second vertex and the vertex a3 as the third vertex. Then, the arrangement direction Q1 of the vertices a1, a2, and a3 is determined to be counterclockwise by the sign of the Z component in the depth direction of the outer product of the vector a1-a2 and the vector a1-a3 of the extracted triangle a1-a2-a3. To do. In step ST4, the extracted triangle a1-a2-a3 and vertex arrangement direction Q1 are stored in the polygon storage unit 24.
Note that the vertex arrangement directions Q2, Q3, Q4, and Q5 shown in the following description are also determined by the sign of the Z component in the depth direction of the outer product of two vectors.
 次にステップST5として、三角形抽出部22は、前回抽出した三角形a1-a2-a3の最後の頂点a3を第2の頂点とし、頂点a4を第3の頂点とする三角形a1-a3-a4を抽出し、抽出した三角形a1-a3-a4の頂点の並び方向Q2が時計回りであると判別する。 Next, in step ST5, the triangle extraction unit 22 extracts a triangle a1-a3-a4 having the last vertex a3 of the previously extracted triangle a1-a2-a3 as the second vertex and the vertex a4 as the third vertex. Then, it is determined that the vertex arrangement direction Q2 of the extracted triangles a1-a3-a4 is clockwise.
 ステップST6として、演算部23は多角形記憶部24に記憶された三角形a1-a2-a3と三角形抽出部22が抽出した三角形a1-a3-a4を比較し、各三角形の頂点の並び方向Q1,Q2が同一でないと判定し、ステップST8として三角形a1-a2-a3と三角形a1-a3-a4を用いて論理差による演算を行い三角形a1-a4-a6および三角形a6-a2-a3(図3(e)参照)を取得する。同時に三角形a1-a4-a6および三角形a6-a2-a3の頂点の並び方向Q4およびQ5も取得する。ステップST9として、演算部23は取得した三角形a1-a4-a6と頂点の並び方向Q4および三角形a6-a2-a3と頂点の並び方向Q5を多角形記憶部24に上書き格納する。 As step ST6, the operation unit 23 compares the triangle a1-a2-a3 stored in the polygon storage unit 24 with the triangle a1-a3-a4 extracted by the triangle extraction unit 22, and arranges the apex directions Q1, It is determined that Q2 is not the same, and in step ST8, calculation is performed using a logical difference using the triangle a1-a2-a3 and the triangle a1-a3-a4, and the triangle a1-a4-a6 and the triangle a6-a2-a3 (FIG. 3 ( e) See). At the same time, the alignment directions Q4 and Q5 of the vertices of the triangle a1-a4-a6 and the triangle a6-a2-a3 are also acquired. As step ST9, the calculation unit 23 overwrites and stores the acquired triangle a1-a4-a6 and vertex arrangement direction Q4 and triangle a6-a2-a3 and vertex arrangement direction Q5 in the polygon storage unit 24.
 さらに、ステップST10として、演算部23は演算に用いた三角形a1-a2-a3および三角形a1-a3-a4には、多角形の最後の頂点a5が含まれていないと判定し、ステップST5の処理に戻って三角形抽出部22が次の三角形a1-a4-a5を抽出し、抽出した三角形a1-a4-a5の頂点の並び方向Q3が反時計回りであると判別する。 Further, in step ST10, the calculation unit 23 determines that the triangle a1-a2-a3 and the triangle a1-a3-a4 used for the calculation do not include the last vertex a5 of the polygon, and the process of step ST5 Returning to FIG. 3, the triangle extraction unit 22 extracts the next triangle a1-a4-a5, and determines that the arrangement direction Q3 of the vertices of the extracted triangle a1-a4-a5 is counterclockwise.
 ステップST6として、演算部23は多角形記憶部24に格納された三角形a1-a4-a6と三角形抽出部22が抽出した三角形a1-a4-a5を比較し、各三角形の頂点の並び方向Q4,Q3が同一でないと判定し、同様に三角形a6-a2-a3と三角形a1-a4-a5Q5,Q3を比較して、各三角形の頂点の並び方向が同一であると判定し、ステップST7として三角形a1-a4-a6と三角形a1-a4-a5を用いて論理差による演算を行い、三角形a6-a2-a3と三角形a1-a4-a5を用いて論理和による演算を行い、三角形a1-a6-a9、三角形a4-a10-a6、三角形a6-a2-a3および三角形a8-a5-a7(図3(f)参照)を取得する。なお、論理演算の計算方法はアルゴリズムの違いにより様々な多角形が得られる。ステップST9として、演算部23は取得した三角形a1-a6-a9、三角形a4-a10-a6、三角形a6-a2-a3および三角形a8-a5-a7を多角形記憶部24に上書き格納する。 As step ST6, the calculation unit 23 compares the triangle a1-a4-a6 stored in the polygon storage unit 24 with the triangle a1-a4-a5 extracted by the triangle extraction unit 22, and arranges the apex direction Q4 of each triangle. It is determined that Q3 is not the same, similarly, the triangle a6-a2-a3 and the triangle a1-a4-a5Q5, Q3 are compared to determine that the arrangement direction of the vertices of each triangle is the same, and in step ST7, the triangle a1 -A4-a6 and a triangle a1-a4-a5 are used to perform an arithmetic operation, the triangle a6-a2-a3 and a triangle a1-a4-a5 are used to perform an arithmetic operation, and a triangle a1-a6-a9 , Triangle a4-a10-a6, triangle a6-a2-a3, and triangle a8-a5-a7 (see FIG. 3 (f)). Note that various polygons can be obtained as the calculation method of the logical operation depending on the algorithm. As step ST9, the computing unit 23 overwrites and stores the acquired triangle a1-a6-a9, triangle a4-a10-a6, triangle a6-a2-a3, and triangle a8-a5-a7 in the polygon storage unit 24.
 ステップST10として、演算部23は演算に用いた三角形a1-a4-a5には、多角形の最後の頂点a5が含まれていると判定し、ステップST11として、描画部25は多角形記憶部24に格納された三角形a1-a6-a9、三角形a4-a10-a6、三角形a6-a2-a3および三角形a8-a5-a7を読み出して塗りつぶしを行い、描画対象の多角形Aの描画を行う。ステップST12として、表示処理部26は多角形Aの描画データに対して表示処理を行い、I/Oインタフェース4を介して表示装置6に出力し、処理を終了する。 In step ST10, the calculation unit 23 determines that the triangle a1-a4-a5 used for the calculation includes the last vertex a5 of the polygon, and in step ST11, the drawing unit 25 sets the polygon storage unit 24. The triangles a1-a6-a9, triangles a4-a10-a6, triangles a6-a2-a3 and triangles a8-a5-a7 stored in FIG. As step ST12, the display processing unit 26 performs display processing on the drawing data of the polygon A, outputs it to the display device 6 via the I / O interface 4, and ends the processing.
 次に、図2に示したフローチャートに沿って、図4に示す非自己交差型の凹型の多角形の描画処理について説明を行う。
 ステップST1として頂点データ取得部21は多角形Bに関する多角形データを読み出し、ステップST2として多角形Aの各頂点に番号b1,b2,b3,b4,b5を付して記憶する。ステップST3として、三角形抽出部22は、頂点b1を描画開始頂点として選択し、頂点b2を第2の頂点、頂点b3を第3の頂点とする三角形b1-b2-b3(描画開始三角形)を抽出し、抽出した三角形b1-b2-b3のベクトルb1-b2およびベクトルb1-b3の外積の奥行き方向のZ成分の符号により、頂点b1,b2,b3の並び方向R1が時計回りであると判別する。ステップST4として、抽出した三角形b1-b2-b3と、頂点の並び方向R1を多角形記憶部24に格納する。
 なお、以下の説明で示す頂点の並び方向R2,R3,R4も上記と同様に、2つのベクトルの外積の奥行き方向のZ成分の符号により判定される。
Next, the non-self-intersecting concave polygon drawing process shown in FIG. 4 will be described with reference to the flowchart shown in FIG.
In step ST1, the vertex data acquisition unit 21 reads polygon data relating to the polygon B, and stores the vertexes of the polygon A with numbers b1, b2, b3, b4, and b5 in step ST2. As step ST3, the triangle extraction unit 22 selects the vertex b1 as the drawing start vertex, and extracts the triangle b1-b2-b3 (drawing start triangle) having the vertex b2 as the second vertex and the vertex b3 as the third vertex. Then, the arrangement direction R1 of the vertices b1, b2, and b3 is determined to be clockwise by the sign of the Z component in the depth direction of the outer product of the vector b1-b2 and the vector b1-b3 of the extracted triangle b1-b2-b3. . In step ST4, the extracted triangle b1-b2-b3 and vertex arrangement direction R1 are stored in the polygon storage unit 24.
Note that the vertex arrangement directions R2, R3, and R4 shown in the following description are also determined by the sign of the Z component in the depth direction of the outer product of two vectors, as described above.
 次にステップST5として、三角形抽出部22は、前回抽出した三角形b1-b2-b3の最後の頂点b3を第2の頂点とし、頂点b4を第3の頂点とする三角形b1-b3-b4を抽出し、抽出した三角形b1-b3-b4の頂点の並び方向R2が反時計回りであると判別する。 Next, as step ST5, the triangle extraction unit 22 extracts a triangle b1-b3-b4 having the last vertex b3 of the previously extracted triangle b1-b2-b3 as the second vertex and the vertex b4 as the third vertex. Then, it is determined that the vertex arrangement direction R2 of the extracted triangles b1-b3-b4 is counterclockwise.
 ステップST6として、演算部23は多角形記憶部24に記憶された三角形b1-b2-b3と三角形抽出部22が抽出した三角形b1-b3-b4を比較し、各三角形の頂点の並び方向R1,R2が同一でないと判定し、ステップST8として三角形b1-b2-b3と三角形b1-b3-b4を用いて論理差による演算を行い三角形b2-a3-a4(図4(e)参照)を取得する。ステップST9として、演算部23は取得した三角形b2-b3-b4を多角形記憶部24に上書き格納する。 As step ST6, the calculation unit 23 compares the triangle b1-b2-b3 stored in the polygon storage unit 24 with the triangle b1-b3-b4 extracted by the triangle extraction unit 22, and arranges the apex alignment directions R1, R1 of the triangles. It is determined that R2 is not the same, and in step ST8, an operation based on a logical difference is performed using the triangle b1-b2-b3 and the triangle b1-b3-b4 to obtain the triangle b2-a3-a4 (see FIG. 4 (e)). . In step ST9, the calculation unit 23 overwrites and stores the acquired triangle b2-b3-b4 in the polygon storage unit 24.
 さらに、ステップST10として、演算部23は演算に用いた三角形b1-b2-b3および三角形b1-b3-abには、多角形の最後の頂点b5が含まれていないと判定し、ステップST5の処理に戻って次の三角形b1-b4-b5を抽出し、抽出した三角形b1-b4-b5の頂点の並び方向R3が反時計回りであると判別する。 Further, in step ST10, the calculation unit 23 determines that the triangle b1-b2-b3 and the triangle b1-b3-ab used in the calculation do not include the last vertex b5 of the polygon, and the process of step ST5 Returning to, the next triangle b1-b4-b5 is extracted, and it is determined that the vertex arrangement direction R3 of the extracted triangle b1-b4-b5 is counterclockwise.
 ステップST6として、演算部23は多角形記憶部24に記憶された三角形b2-b3-b4と三角形抽出部22が抽出した三角形b1-b4-b5を比較し、各三角形の頂点の並び方向R4,R3が同一であると判定し、ステップST7として三角形b2-b3-b4と三角形b1-b4-b5を用いて論理和による演算を行い、三角形b2-b3-b4および三角形b1-b4-b5(図4(f)参照)を取得する。ステップST9として、演算部23は取得した三角形b2-b3-b4および三角形b1-b4-b5を多角形記憶部24に上書き格納する。 As step ST6, the calculation unit 23 compares the triangle b2-b3-b4 stored in the polygon storage unit 24 with the triangle b1-b4-b5 extracted by the triangle extraction unit 22, and arranges the apex alignment directions R4, R4 of the triangles. It is determined that R3 is the same, and in step ST7, an arithmetic operation is performed using the triangle b2-b3-b4 and the triangle b1-b4-b5, and the triangle b2-b3-b4 and the triangle b1-b4-b5 (FIG. 4 (f)). As step ST9, the calculation unit 23 overwrites and stores the acquired triangle b2-b3-b4 and triangle b1-b4-b5 in the polygon storage unit 24.
 ステップST10として、演算部23は演算に用いた三角形b1-b4-b5には、多角形の最後の頂点b5が含まれていると判定し、ステップST11として、描画部25は多角形記憶部24に格納された三角形b2-b3-b4および三角形b1-b4-b5を読み出して塗りつぶしを行い、描画対象の多角形Bの描画を行う。ステップST12として、表示処理部26は多角形Bの描画データに対して表示処理を行い、I/Oインタフェース4を介して表示装置6に出力し、処理を終了する。 In step ST10, the calculation unit 23 determines that the triangle b1-b4-b5 used for the calculation includes the last vertex b5 of the polygon, and in step ST11, the drawing unit 25 sets the polygon storage unit 24. The triangles b2-b3-b4 and triangles b1-b4-b5 stored in the above are read out and painted, and the polygon B to be drawn is drawn. As step ST12, the display processing unit 26 performs a display process on the drawing data of the polygon B, outputs it to the display device 6 via the I / O interface 4, and ends the process.
 さらに、この実施の形態1の描画装置1は、図5に示す非自己交差型の凸型の多角形の描画を行うこともできる。凸型の多角形の場合には、描画開始頂点c1から順に抽出する三角形c1-c2-c3(描画開始三角形)、三角形c1-c3-c4および三角形c1-c4-c5はそれぞれ重なることがなく、さらに各頂点の並び方向が同一(図5の例では反時計回り)であるため、抽出した三角形c1-c2-c3、三角形c1-c3-c4および三角形c1-c4-c5は全て論理和演算を行う。これにより、描画部25により描画される多角形は、多角形Cを3つの三角形で分割したもとの同一となる(図5(b)参照)。 Furthermore, the drawing apparatus 1 of the first embodiment can also draw a non-self-intersecting convex polygon shown in FIG. In the case of a convex polygon, the triangle c1-c2-c3 (drawing start triangle), the triangle c1-c3-c4, and the triangle c1-c4-c5 extracted sequentially from the drawing start vertex c1 do not overlap each other, Furthermore, since the arrangement directions of the vertices are the same (counterclockwise in the example of FIG. 5), the extracted triangles c1-c2-c3, triangles c1-c3-c4, and triangles c1-c4-c5 are all subjected to a logical OR operation. Do. As a result, the polygon drawn by the drawing unit 25 is the same as the polygon C divided by three triangles (see FIG. 5B).
 以上のように、この実施の形態1によれば、多角形の頂点を検出して描画順序を付与する頂点データ取得部21と、多角形の描画順序に基づき複数の三角形を抽出する三角形抽出部22と、多角形記憶部24に記憶された三角形と三角形抽出部22が抽出した三角形の頂点の並び方向に基づいて論理和演算あるいは論理差演算を行う演算部23と、演算部23の演算結果である三角形の集合体である多角形を記憶する多角形記憶部24と、多角形記憶部24に記憶された多角形を描画する描画部25とを備えるように構成したので、マスクデータを作成することなく、且つ図形描画専用のハードウェアを搭載することなく、自己交差型の多角形を含む図形を描画することができる。 As described above, according to the first embodiment, the vertex data acquisition unit 21 that detects a vertex of a polygon and assigns the drawing order, and the triangle extraction unit that extracts a plurality of triangles based on the drawing order of the polygon 22, a calculation unit 23 that performs a logical sum operation or a logical difference calculation based on the arrangement direction of the triangles stored in the polygon storage unit 24 and the triangle vertices extracted by the triangle extraction unit 22, and the calculation result of the calculation unit 23 Since it is configured to include a polygon storage unit 24 that stores polygons that are aggregates of triangles and a drawing unit 25 that draws polygons stored in the polygon storage unit 24, mask data is created. Thus, it is possible to draw a graphic including a self-intersecting polygon without mounting hardware dedicated to graphic drawing.
 また、この実施の形態1によれば、三角形を構成する2つのベクトルの外積の符号により決定される頂点の並び方向を算出し、演算部23が2つの三角形の頂点の並び方向に基づいて論理和演算あるいは論理差演算を行うように構成したので、マスクデータを作成することなく、自己交差型の多角形を含む図形を描画することができる。 Further, according to the first embodiment, the vertex arrangement direction determined by the sign of the outer product of the two vectors constituting the triangle is calculated, and the calculation unit 23 performs logic based on the arrangement direction of the two triangle vertices. Since the sum operation or the logical difference operation is performed, it is possible to draw a graphic including a self-intersecting polygon without creating mask data.
 なお、上述した実施の形態1では、頂点に付した番号の小さい順に三角形を抽出する構成を示したが、抽出順はこれに限定されるものではない。 In the above-described first embodiment, the configuration in which the triangles are extracted in ascending order of the numbers assigned to the vertices is shown, but the extraction order is not limited to this.
 なお、本願発明はその発明の範囲内において、実施の形態の任意の構成要素の変形、もしくは実施の形態の任意の構成要素の省略が可能である。 In the present invention, any component of the embodiment can be modified or any component of the embodiment can be omitted within the scope of the invention.
 以上のように、この発明に係る描画装置および描画方法による自己交差型の図形を含む多角形の描画は、マスクデータを作成するメモリ容量を確保できない装置、や特別なハードウェアを搭載することができない装置への搭載に適している。 As described above, drawing of polygons including self-intersecting figures by the drawing apparatus and drawing method according to the present invention may include a device that cannot secure a memory capacity for creating mask data or special hardware. Suitable for mounting on devices that cannot.
 1 描画装置、2 描画処理部、3 メモリ、4 I/Oインタフェース、5 記憶装置、6 表示装置、21 頂点データ取得部、22 三角形抽出部、23 演算部、24 多角形記憶部、25 描画部、26 表示処理部。 1 drawing device, 2 drawing processing unit, 3 memory, 4 I / O interface, 5 storage device, 6 display device, 21 vertex data acquisition unit, 22 triangle extraction unit, 23 operation unit, 24 polygon storage unit, 25 drawing unit , 26 Display processing unit.

Claims (8)

  1.  描画対象となる多角形の多角形データを取得し、取得した多角形データから多角形を特定する頂点を検出し、検出した頂点に描画順序を付与する頂点データ取得部と、
     前記頂点データ取得部が付与した前記描画順序に基づき、前記多角形から描画開始頂点を基準に第2の頂点および第3の頂点をそれぞれ変化させた複数の三角形を抽出する三角形抽出部と、
     前記三角形抽出部が抽出した複数の三角形を用いて論理演算を行う演算部と、
     前記演算部の演算結果である三角形の集合体である多角形を記憶する多角形記憶部と、
     前記多角形記憶部に記憶された多角形を描画する描画部とを備えた描画装置であって、
     前記三角形抽出部は、前記描画開始頂点と、該描画開始頂点から描画順序が連続する2頂点を結んだ描画開始三角形を抽出して前記多角形記憶部に記憶し、
     前記演算部は、前記多角形記憶部に記憶された前記描画開始三角形あるいは前記演算結果である三角形の各頂点の描画順序と、前記描画開始三角形以外であって、前記描画開始点を基準に第2の頂点および第3の頂点をそれぞれ変化させた三角形の各頂点の描画順序に基づいた論理演算を行い、
     前記描画部は、前記演算部において前記三角形抽出部が抽出した全ての三角形に対して論理演算が行われた場合に、前記多角形記憶部に記憶された多角形を描画することを特徴とする描画装置。
    A vertex data acquisition unit that acquires polygon data of a polygon to be drawn, detects a vertex that identifies the polygon from the acquired polygon data, and assigns a drawing order to the detected vertex;
    Based on the drawing order given by the vertex data acquisition unit, a triangle extraction unit that extracts a plurality of triangles, each of which changes the second vertex and the third vertex based on the drawing start vertex from the polygon,
    An arithmetic unit that performs a logical operation using a plurality of triangles extracted by the triangle extraction unit;
    A polygon storage unit that stores polygons that are aggregates of triangles that are calculation results of the calculation unit;
    A drawing device comprising a drawing unit for drawing a polygon stored in the polygon storage unit,
    The triangle extraction unit extracts a drawing start triangle connecting the drawing start vertex and two vertices whose drawing order is continuous from the drawing start vertex, and stores the drawing start triangle in the polygon storage unit,
    The calculation unit is the drawing start triangle stored in the polygon storage unit or the drawing order of each vertex of the triangle as the calculation result, and other than the drawing start triangle, and based on the drawing start point Perform a logical operation based on the drawing order of each vertex of the triangle with each of the 2 vertices and the 3rd vertex changed,
    The drawing unit draws a polygon stored in the polygon storage unit when a logical operation is performed on all the triangles extracted by the triangle extraction unit in the calculation unit. Drawing device.
  2.  前記演算部は、前記多角形記憶部に記憶された前記描画開始三角形あるいは前記演算結果である三角形と、前記描画開始三角形以外であって、前記描画開始点を基準に第2の頂点および第3の頂点をそれぞれ変化させた三角形とのそれぞれについて、所定の頂点を基点として、該基点から他の2頂点を描画する際の描画順序を示す描画方向を取得し、取得した2つの三角形の描画方向が同一の場合には論理和演算を行い、2つの三角形の描画方向が同一でない場合には論理差演算を行うことを特徴とする請求項1記載の描画装置。 The calculation unit is other than the drawing start triangle stored in the polygon storage unit or the calculation result triangle and the drawing start triangle, and the second vertex and the third are based on the drawing start point. For each of the triangles whose vertices are respectively changed, the drawing direction indicating the drawing order when drawing the other two vertices from the base point is obtained from the predetermined vertex, and the drawing directions of the obtained two triangles 2. The drawing apparatus according to claim 1, wherein a logical sum operation is performed when the two are the same, and a logical difference operation is performed when the drawing directions of the two triangles are not the same.
  3.  前記三角形抽出部は、前記描画開始三角形、および前記描画開始三角形以外であって前記描画開始点を基準に第2の頂点および第3の頂点をそれぞれ変化させた三角形について、前記基点から他の2頂点に向けて延びる2つのベクトルの外積の符号を用いて前記描画方向を判定することを特徴とする請求項2記載の描画装置。 The triangle extraction unit is configured to change the second vertex and the third vertex other than the drawing start triangle and the drawing start triangle and changing the second vertex and the third vertex respectively with reference to the drawing start point, and the other two from the base point. The drawing apparatus according to claim 2, wherein the drawing direction is determined using a sign of an outer product of two vectors extending toward the vertex.
  4.  前記演算部は、前記演算結果である三角形について、前記基点から他の2頂点に向けて延びる2つのベクトルの外積の符号を用いて前記描画方向を判定することを特徴とする請求項2記載の描画装置。 The said calculating part determines the said drawing direction using the code | symbol of the outer product of two vectors extended toward the other two vertexes from the said base point about the triangle which is the said calculation result. Drawing device.
  5.  頂点データ取得部が、描画対象となる多角形の多角形データを取得し、取得した多角形データから多角形を特定する頂点を検出し、検出した頂点に描画順序を付与するステップと、
     三角形抽出部が、前記頂点データ取得部が付与した前記描画順序に基づき、前記多角形から描画開始頂点を基準に第2の頂点および第3の頂点をそれぞれ変化させた複数の三角形を抽出するステップと、
     演算部が、前記三角形抽出部が抽出した複数の三角形を用いて論理演算を行うステップと、
     多角形記憶部が、前記演算部の演算結果である三角形の集合体である多角形を記憶するステップと、
     描画部が、前記多角形記憶部に記憶された多角形を描画するステップとを備えた描画方法であって、
     前記三角形抽出部が、前記描画開始頂点と、該描画開始頂点から描画順序が連続する2頂点を結んだ描画開始三角形を抽出して前記多角形記憶部に記憶するステップと、
     前記演算部が、前記多角形記憶部に記憶された前記描画開始三角形あるいは前記演算結果である三角形と、前記描画開始三角形以外であって、前記描画開始点を基準に第2の頂点および第3の頂点をそれぞれ変化させた三角形とを用いた論理演算を行うステップと、
     前記描画部が、前記演算部において前記三角形抽出部が抽出した全ての三角形に対して論理演算が行われた場合に、前記多角形記憶部に記憶された多角形を描画するステップとを備えたことを特徴とする描画方法。
    A vertex data acquisition unit acquires polygon data of a polygon to be drawn, detects a vertex specifying the polygon from the acquired polygon data, and assigns a drawing order to the detected vertex;
    A step of extracting a plurality of triangles in which the second vertex and the third vertex are respectively changed from the polygon based on the drawing start vertex based on the drawing order given by the vertex data obtaining unit; When,
    A calculation unit performing a logical operation using a plurality of triangles extracted by the triangle extraction unit;
    A step of storing a polygon which is an aggregate of triangles as a result of the operation of the operation unit;
    A drawing unit comprising a step of drawing a polygon stored in the polygon storage unit,
    The triangle extraction unit extracts the drawing start vertex and a drawing start triangle connecting two vertices whose drawing order is continuous from the drawing start vertex, and stores the drawing start triangle in the polygon storage unit;
    The calculation unit is other than the drawing start triangle stored in the polygon storage unit or the calculation result triangle, and the drawing start triangle, and the second vertex and the third based on the drawing start point Performing a logical operation using triangles with different vertices of
    The drawing unit includes a step of drawing a polygon stored in the polygon storage unit when a logical operation is performed on all the triangles extracted by the triangle extraction unit in the calculation unit. A drawing method characterized by that.
  6.  前記演算部が、前記多角形記憶部に記憶された前記描画開始三角形あるいは前記演算結果である三角形と、前記描画開始三角形以外であって、前記描画開始点を基準に第2の頂点および第3の頂点をそれぞれ変化させた三角形とのそれぞれについて、所定の頂点を基点として、該基点から他の2頂点を描画する際の描画順序を示す描画方向を取得するステップと、取得した2つの三角形の描画方向が同一の場合には論理和演算を行うステップと、2つの三角形の描画方向が同一でない場合には論理差演算を行うステップとを備えたこと特徴とする請求項5記載の描画方法。 The calculation unit is other than the drawing start triangle stored in the polygon storage unit or the calculation result triangle, and the drawing start triangle, and the second vertex and the third based on the drawing start point Obtaining a drawing direction indicating a drawing order when drawing the other two vertices from the base point with respect to each of the triangles each having the vertex of each changed as a base point; and 6. The drawing method according to claim 5, further comprising a step of performing a logical sum operation when the drawing directions are the same and a step of performing a logical difference operation when the drawing directions of the two triangles are not the same.
  7.  前記三角形抽出部が、前記描画開始三角形、および前記描画開始三角形以外であって前記描画開始点を基準に第2の頂点および第3の頂点をそれぞれ変化させた三角形について、前記基点から他の2頂点に向けて延びる2つのベクトルの外積の符号を用いて前記描画方向を判定するステップを備えたことを特徴とする請求項6記載の描画方法。 The triangle extraction unit, for the triangles other than the drawing start triangle and the drawing start triangle and changing the second vertex and the third vertex based on the drawing start point, respectively, from the base point to the other two The drawing method according to claim 6, further comprising the step of determining the drawing direction using a sign of an outer product of two vectors extending toward the vertex.
  8.  前記演算部が、前記演算結果である三角形について、前記基点から他の2頂点に向けて延びる2つのベクトルの外積の符号を用いて前記描画方向を判定するステップを備えたことを特徴とする請求項6記載の描画方法。 The calculation unit includes a step of determining the drawing direction with respect to a triangle as the calculation result by using a sign of an outer product of two vectors extending from the base point toward the other two vertices. Item 7. The drawing method according to Item 6.
PCT/JP2012/000057 2012-01-06 2012-01-06 Drawing device and drawing method WO2013102955A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/JP2012/000057 WO2013102955A1 (en) 2012-01-06 2012-01-06 Drawing device and drawing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2012/000057 WO2013102955A1 (en) 2012-01-06 2012-01-06 Drawing device and drawing method

Publications (1)

Publication Number Publication Date
WO2013102955A1 true WO2013102955A1 (en) 2013-07-11

Family

ID=48745033

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2012/000057 WO2013102955A1 (en) 2012-01-06 2012-01-06 Drawing device and drawing method

Country Status (1)

Country Link
WO (1) WO2013102955A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62256092A (en) * 1986-04-03 1987-11-07 アドバンスト・マイクロ・デイバイシズ・インコ−ポレ−テツド Computer graphic apparatus and method for painting complicated polygon
JPH1021415A (en) * 1996-07-03 1998-01-23 Brother Ind Ltd Graphic processor and graphic processing method
JP2007304871A (en) * 2006-05-11 2007-11-22 Toshiba Corp Drawing device, drawing method, and drawing program
JP2010072808A (en) * 2008-09-17 2010-04-02 Mitsubishi Electric Corp Drawing device
JP2011165062A (en) * 2010-02-12 2011-08-25 Canon Inc Drawing processing apparatus, drawing processing method, and program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62256092A (en) * 1986-04-03 1987-11-07 アドバンスト・マイクロ・デイバイシズ・インコ−ポレ−テツド Computer graphic apparatus and method for painting complicated polygon
JPH1021415A (en) * 1996-07-03 1998-01-23 Brother Ind Ltd Graphic processor and graphic processing method
JP2007304871A (en) * 2006-05-11 2007-11-22 Toshiba Corp Drawing device, drawing method, and drawing program
JP2010072808A (en) * 2008-09-17 2010-04-02 Mitsubishi Electric Corp Drawing device
JP2011165062A (en) * 2010-02-12 2011-08-25 Canon Inc Drawing processing apparatus, drawing processing method, and program

Similar Documents

Publication Publication Date Title
JP7004645B2 (en) Foveal geometry tessellation
JP6652257B2 (en) Varying the effective resolution with screen position by changing the active color sample count in multiple render targets
EP3748584B1 (en) Gradient adjustment for texture mapping for multiple render targets with resolution that varies by screen location
US9959659B2 (en) Tile-based rendering apparatus and method for rendering 3D graphics using binning information and property information
JP5232358B2 (en) Rendering outline fonts
JP4613313B2 (en) Image processing system and image processing program
KR102410351B1 (en) Single pass flexible screen/scale rasterization
US20150091892A1 (en) Method and apparatus for rendering image data
KR102598915B1 (en) Graphics processing
US10535188B2 (en) Tessellation edge shaders
KR20160046614A (en) Method and apparatus for processing texture
US20150145858A1 (en) Method and apparatus to process current command using previous command information
US20170061682A1 (en) Rendering method and apparatus
KR102644276B1 (en) Apparatus and method for processing graphic
US20150221122A1 (en) Method and apparatus for rendering graphics data
JP6424329B2 (en) Image data processing method in image processing processor and program thereof
US20150103072A1 (en) Method, apparatus, and recording medium for rendering object
US20230082839A1 (en) Rendering scalable raster content
WO2013102955A1 (en) Drawing device and drawing method
US10297067B2 (en) Apparatus and method of rendering frame by adjusting processing sequence of draw commands
US9830721B2 (en) Rendering method and apparatus
KR20120138185A (en) Graphic image processing apparatus and method for realtime transforming low resolution image into high resolution image
US20150103071A1 (en) Method and apparatus for rendering object and recording medium for rendering
US10026216B2 (en) Graphics data processing method and apparatus
JP6266678B2 (en) Avionics display system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12864645

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12864645

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: JP