JPS62127971A - Clipping system in line segment drawing - Google Patents

Clipping system in line segment drawing

Info

Publication number
JPS62127971A
JPS62127971A JP26853185A JP26853185A JPS62127971A JP S62127971 A JPS62127971 A JP S62127971A JP 26853185 A JP26853185 A JP 26853185A JP 26853185 A JP26853185 A JP 26853185A JP S62127971 A JPS62127971 A JP S62127971A
Authority
JP
Japan
Prior art keywords
line segment
point
coordinates
line
intersection
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.)
Pending
Application number
JP26853185A
Other languages
Japanese (ja)
Inventor
Junichi Ichikawa
純一 市川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP26853185A priority Critical patent/JPS62127971A/en
Publication of JPS62127971A publication Critical patent/JPS62127971A/en
Pending legal-status Critical Current

Links

Landscapes

  • Digital Computer Display Output (AREA)
  • Image Generation (AREA)

Abstract

PURPOSE:To draw accurately a clipped line segment at a high speed by specifying an initial setting value given to a digital differentiation analyzer. CONSTITUTION:In drawing a line segment from an integer coordinate PC being a cross point between a line segment (between a start point PS and an end point PE) and a line in parallel with the X or Y axis through the optional point PC (clipping line) to the end point PE, as the initial condition of the digital differentiation analyzer (DDA), each axis difference is set and as the main axis designation, a value calculated by the coordinates of the points PS, PE is set. Then as an error, a value to be given at the point PC is set while supporting that a line segment is drawn from the point PS to the point PE, and as the length of the main axis, the length in the main axis from the point PC to the point PE is set and the analyzer DDA is started. Thus, a line segment is drawn accurately without any error from dot string of the line segment displayed when only the displayed line segment is drawn from the start point to the end point while no coordinate calculation of all picture elements from the start point to the end point is executed.

Description

【発明の詳細な説明】 〔概  要〕 本発明は図形処理を実行するワークステーションにおい
てディスプレイ画面上に複数のウィンドウを表示するマ
ルチウィンドウ化に必要となるウィンドウィングに係り
、特にディスプレイファイルから必要な線分のみを取出
すクリッピング機能方式に関する。
[Detailed Description of the Invention] [Summary] The present invention relates to windowing, which is necessary for displaying multiple windows on a display screen in a workstation that executes graphic processing, and particularly relates to windowing that is necessary for displaying multiple windows on a display screen in a workstation that executes graphic processing. This invention relates to a clipping function method that extracts only line segments.

このような線分描画におけるクリッピング方式において
、従来は、クリッピングがある場合でも始点から終点に
至る全画素の座標を計算し、クリッピングラインに達し
た整数座標から描画を行っていたので非常に時間がかか
るという問題があった。
Conventionally, in the clipping method for drawing line segments, even if there was clipping, the coordinates of all pixels from the start point to the end point were calculated, and drawing was performed from the integer coordinates that reached the clipping line, which was very time consuming. There was a problem that it took a while.

本発明は二次元の整数座標でアクセス可能なメモリ上に
線分を発生するディジタル微分解析器において、任意の
始点から終点に至る線分の途中でクリッピングラインで
クリッピングされた時、線分とクリッピングラインとの
交点を求め、求められた交点に最も近い整数座標から終
点までの線分を描画するクリッピング方式である。この
場合、本発明では前記交点から終点までのクリッピング
された線分の描画における前記ディジタル微分解析器の
初期条件として、各軸方向差分値、主軸指定は前記始点
から終点までの座標値から計算された値を計算し、誤差
量としては前記始点から終点まで描画したと仮定した時
に前記交点整数座標において持つべき値を設定し、主軸
方向長さとしては前記交点整数座標から終点に至るもの
を設定して前記ディジタル微分解析器を起動することを
特徴としている。
The present invention is a digital differential analyzer that generates line segments on a memory that can be accessed using two-dimensional integer coordinates. This is a clipping method that finds the intersection with a line and draws a line segment from the integer coordinate closest to the found intersection to the end point. In this case, in the present invention, as an initial condition of the digital differential analyzer in drawing the clipped line segment from the intersection point to the end point, each axial difference value and principal axis designation are calculated from the coordinate values from the start point to the end point. The error amount is set as the value that should be at the intersection integer coordinates when it is assumed that the drawing is drawn from the start point to the end point, and the length in the principal axis direction is set as the value from the intersection integer coordinates to the end point. The method is characterized in that the digital differential analyzer is activated.

このような方法に従えば、始点から終点に至る全画素の
座標を計算することなく、表示される線分のみを始点か
ら終点まで描いた場合に表示される線分の点列から全く
誤差がなく正確に描画できるという効果がある。
If you follow this method, there will be no errors at all from the line segment point sequence that is displayed when only the displayed line segment is drawn from the start point to the end point without calculating the coordinates of all pixels from the start point to the end point. This has the effect of allowing accurate drawing.

〔産業上の利用分野〕[Industrial application field]

本発明は図形処理を実行するワークステーションにおい
てディスプレイ画面上、に複数のウィンドウを表示する
マルチウィンドウ化に必要となるウィンドウィングに係
り、ディスプレイファイルがら必要な線分のみを取出す
クリッピング機能方式に関する。特に、任意の始点から
終点座標に至る線分を水平又は垂直な直線でクリッピン
グされた場合に前記線分と前記クリッピング線分との交
点を求めてその交点から終点までの線分の描画を正確に
実行する線分描画におけるクリッピング方式%式% 集積化技術の発展に伴い、マンマシンインターフェース
の基本技術である図形処理を専用に行う専用プロセッサ
を有効に使ってワークステーションにおけるグラフィッ
ク処理を実現する技術の重要性が高まってきた。このワ
ークステーションは主にメモリの1ビツトを画面の1ド
ツトに対応させるビットマツプディスプレイ装置を用い
てディスプレイ画面に複数のウィンドウを表示するマル
チウィンドウ機能を有し、それぞれのウィンドウをオー
バーランプして表示したり画面を分割して表示できるよ
うにしている。このマルチウィンドウ方式において重要
となる技術が広い座標系で定義された図形から興味のあ
る部分を抽出し、ウィンドウの座標系に変換するウィン
ドウィングの機能である。このウィンドウィングを行う
ためには図形に対して平行移動や回転あるいは拡大や縮
小といった機能ばかりでなく部分図形の面や線が他の部
分図形の面により隠され、隠された状態から再現する機
能が必要となる。そしてこのウィンドウィングに対して
はディスプレイファイルから必要な線分データのみを取
出すクリッピング機能が重要となる。ディスプレイファ
イルでは各部分図形は集合として形成され、各図形がウ
ィンドウ化のために図形変換を受ける場合には、ディス
プレイファイル上の広い座標系にまずウィンドウが設定
された後、ディスプレイ画面に相当する表示画面の所望
の場所にマルチウィンドウとして表示できるようにビュ
ーイング変換が行なわれる。ビューイング変換を行う場
合、特定の部分図形の拡大、縮小、あるいは平行移動や
回転等の変換はいわゆる写像変換であり、行列の掛算動
作で行われるが、前記クリッピング機能においては線分
の切り出しを効率良く行う必要がある。特にこのクリッ
ピングはディスプレイファイル上のウィンドウをディス
プレイ上の実際に見える部分とそうでない部分に分け、
見える部分だけに線分を描画することになる。このよう
な線分描画におけるクリッピング方式において、従来は
、クリッピングがある場合でも始点から終点に至る全画
素の座標を計算し、クリッピングラインに達した整数座
標から描画を行っていたので非常に時間がかかるという
問題があった。
The present invention relates to windowing necessary for displaying multiple windows on a display screen in a workstation that executes graphic processing, and relates to a clipping function method for extracting only necessary line segments from a display file. In particular, when a line segment from an arbitrary start point to the end point coordinates is clipped with a horizontal or vertical straight line, the intersection point between the line segment and the clipped line segment is determined and the line segment from the intersection point to the end point is accurately drawn. Clipping method for line segment drawing % formula % With the development of integrated technology, technology that realizes graphic processing on workstations by effectively using a dedicated processor dedicated to graphic processing, which is the basic technology of man-machine interface. has become increasingly important. This workstation mainly has a multi-window function that displays multiple windows on the display screen using a bitmap display device that associates one bit in memory with one dot on the screen, and each window is displayed in an overlamp manner. You can also split the screen and display it. An important technology in this multi-window method is the windowing function that extracts interesting parts from figures defined in a wide coordinate system and converts them to the window coordinate system. In order to perform this windowing, not only functions such as parallel translation, rotation, enlargement, and reduction are required for the figure, but also a function that allows the faces and lines of a partial figure to be hidden by the faces of other partial figures, and reproduces them from the hidden state. Is required. For this windowing, a clipping function that extracts only necessary line segment data from the display file is important. In a display file, each partial figure is formed as a set, and when each figure undergoes figure transformation to become a window, a window is first set in a wide coordinate system on the display file, and then a display corresponding to the display screen is set. Viewing conversion is performed so that it can be displayed in a desired location on the screen as a multi-window. When performing viewing transformation, transformations such as enlargement, reduction, translation, rotation, etc. of a specific partial figure are so-called mapping transformations, which are performed by matrix multiplication operations, but in the clipping function, line segments are cut out. It needs to be done efficiently. In particular, this clipping divides the window on the display file into the part that is actually visible on the display and the part that is not.
Line segments will be drawn only in the visible areas. Conventionally, in the clipping method for drawing line segments, even if there was clipping, the coordinates of all pixels from the start point to the end point were calculated, and drawing was performed from the integer coordinates that reached the clipping line, which was very time consuming. There was a problem that it took a while.

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

本発明はこのような従来の欠点を除去し、任意の始点座
標から終点座標に至る線分のうち垂直または水平なクリ
ッピングラインでクリッピングされた場合に前記クリッ
ピングラインと前記線分との交点から終点までのクリッ
ピングされた線分を高速かつ正確に描画する線分描画に
おけるクリッピング方式を提供するものである。
The present invention eliminates such conventional drawbacks, and when a line segment from arbitrary start point coordinates to end point coordinates is clipped by a vertical or horizontal clipping line, the end point is calculated from the intersection of the clipping line and the line segment. This invention provides a clipping method for drawing line segments that quickly and accurately draws clipped line segments up to

〔問題点を解決するための手段〕[Means for solving problems]

本発明は上記目的を達成するために、二次元の整数座標
でアクセス可能なメモリ上に線分を発生するディジタル
微分解析器において、任意の始点座標から終点座標に至
る線分を垂直又は水平なクリッピングラインによってク
リッピングし、該線分とクリッピングラインの交点から
終点に至る線分を描画する場合の前記ディジタル微分解
析器に与える初期設定値として、各軸方向差分値、主軸
指定は前記始点座標と前記終点座標の座標値から計算さ
れる値を設定し、誤差量は前記始点座標から終点座標ま
で描画したと仮定した時に方程式の根から求められる交
点座標に最も近い交点整数座標において持つべき値を設
定し、主軸方向長さとしては前記交点整数座標から前記
終点座標に至る長さを設定することによって前記ディジ
タル微分解析器を起動することを特徴とする。
In order to achieve the above object, the present invention uses a digital differential analyzer that generates line segments on a memory that can be accessed by two-dimensional integer coordinates to generate line segments from arbitrary start point coordinates to end point coordinates in a vertical or horizontal direction. As the initial setting values given to the digital differential analyzer when clipping is performed using a clipping line and a line segment is drawn from the intersection of the line segment and the clipping line to the end point, each axial difference value and principal axis specification are set to the coordinates of the starting point. Set the value calculated from the coordinate value of the end point coordinate, and the error amount is the value that should be at the intersection integer coordinate closest to the intersection coordinate found from the root of the equation when it is assumed that drawing is done from the start point coordinate to the end point coordinate. The digital differential analyzer is started by setting the length from the intersection integer coordinates to the end point coordinates as the principal axis direction length.

〔作   用〕[For production]

任意の始点psから終点PEに至る線分の中間のXまた
はy座標軸に平行な直線でクリッピングされた交点整数
座標pcよりPEに至る線分を描画する際にディジタル
微分解析器(DDA)の初期条件として各軸方向差分値
、主軸指定はPS、PEの座標値から計算された値を設
定し、誤差量としてはPSからPEまで描画したと仮定
した時にpcにおいて持つべき値を設定し、主軸方向長
さとしてはPCからPEに至る主軸方向長さを設定して
からDDAの起動を行っている。
The initial stage of the digital differential analyzer (DDA) is used when drawing a line segment from an arbitrary starting point ps to an end point PE from an intersection integer coordinate pc clipped by a straight line parallel to the X or y coordinate axis in the middle of the line segment. As the conditions, set the difference value in each axis direction, the principal axis specification to the value calculated from the coordinate values of PS and PE, and set the error amount to the value that should be at pc when it is assumed that it is drawn from PS to PE, and specify the principal axis. The DDA is activated after setting the length in the main axis direction from the PC to the PE.

〔実  施  例〕〔Example〕

次に本発明の線分描画におけるクリッピング方式を図面
を参照して説明する。
Next, a clipping method for line segment drawing according to the present invention will be explained with reference to the drawings.

第1図は本発明の実施例を示す図形処理用装置の構成ブ
ロック図である。
FIG. 1 is a block diagram of a graphic processing device showing an embodiment of the present invention.

主制御部100は図形処理を実行するために全体の制御
を実行する部分で中央演算装置を内部に含む。主制御部
100は主にディジタル微分解析器(DDA)200に
対するパラメータの設定及び起動を実行する。DDA2
00は特定の部分図形の拡大、縮小、平行移動、回転、
あるいはマルチウィンドウにおけるウィンドウィング等
を実行するための描画処理において、特に、線分の処理
を行う部分で、線分をドツト単位で処理するためのハー
ドウェアである。そして、非常に大きな座標系で定義さ
れた対象図形の全体から必要な部分を抽出し表示するた
めのウィンドウィング機能において、DDA200はビ
ットマツプメモリ301.302,303に必要な線分
データのみを書き出すクリッピング機能に対する線分の
発生あるいは切り出しを実行する。このDDA200は
、例えば、第4図に示すプレゼンハム(Bresenh
am )のアルゴリズムに従って線分を描画する機能を
含んでいる。DDA200は主制御部100から座標X
及びY、XとYのそれぞれの差分の絶対値DXとDY、
主軸方向DIR1主軸方向の長さLEN及び誤差iE等
のパラメータを入力し、線分を描画する。第4図にX方
向が主軸の時の流れ図を示す。DDAではまずDYから
DXをひいて2倍してDDとし、Y方向の差分DYを2
倍したものをDとする。次に、誤差量Eの符号によりE
の初期値を決める。即ちEが正である場合にはEにDD
を加えてEとし、正でない場合にはEにDを加えて新し
いEとする。その後点列を発生するルーチンに入る。先
ず座標X、Yに対して色指定レジスタ400で示される
色の点を座標X、Yに打つ。誤差−IEが正である場合
には已にDDを加えてEを更新し、Yを1だけディクリ
メントする。Eが正でない場合にはEにDを加えてEを
更新する。すなわちEが正である場合にのみYはディク
リメントされる。その後Xは常にインクリメントされる
。これはXを主軸とした場合であって、Xは常に1だけ
インクリメントされる。
The main control unit 100 is a part that performs overall control to perform graphic processing, and includes a central processing unit therein. The main control unit 100 mainly executes parameter setting and startup for the digital differential analyzer (DDA) 200. DDA2
00 is enlargement, reduction, translation, rotation of a specific partial figure,
Alternatively, it is hardware for processing line segments dot by dot, especially in the part that processes line segments in drawing processing for executing windowing in a multi-window. Then, in the windowing function for extracting and displaying the necessary parts from the entire target figure defined in a very large coordinate system, the DDA 200 writes only the necessary line segment data to the bitmap memories 301, 302, and 303. Generates or cuts out line segments for the clipping function. This DDA 200 is, for example, a Bresenham (Bresenh) shown in FIG.
am ) includes a function to draw line segments according to the algorithm. The DDA 200 receives the coordinate X from the main control unit 100.
and Y, the absolute values DX and DY of the respective differences between X and Y,
Parameters such as principal axis direction DIR1 length LEN in principal axis direction and error iE are input, and a line segment is drawn. FIG. 4 shows a flowchart when the main axis is in the X direction. In DDA, first subtract DX from DY, double it to get DD, and then calculate the difference DY in the Y direction by 2.
Let the multiplied value be D. Next, depending on the sign of the error amount E, E
Determine the initial value of. That is, if E is positive, DD to E
is added to make E, and if it is not positive, D is added to E to make a new E. After that, a routine that generates a point sequence is entered. First, a color point indicated by the color designation register 400 is set at the coordinates X and Y. If the error-IE is positive, DD is then added to update E, and Y is decremented by 1. If E is not positive, D is added to E and E is updated. That is, Y is decremented only if E is positive. After that, X is always incremented. This is the case where X is the main axis, and X is always incremented by 1.

そして長さLENがディクリメントされ、以上のルーチ
ンがLEN=Oになるまで繰り返されて線分が描かれ線
分は点列として打たれることになる。
Then, the length LEN is decremented, and the above routine is repeated until LEN=O, and a line segment is drawn and the line segment is printed as a series of dots.

各点列を示すX座標、Y座標は第1図の構成ブロック図
に示すようにRGBの各ビットマツプメモリ301,3
02.303に与えられる。そして、色指定レジスタ4
00の内容に従って特定な色のドツトを示す論理がメモ
リに書込まれると、各メモリの1ビツトを画面の1ドツ
トに対応させるビットマツプディスプレイ表示装置、即
ちCRT制御部500を介してCRT600に線分の点
列が表示されることになる。すなわち基本描画単位であ
る線分がビットマツプメモリ上に形成されるとラスク型
ディスプレイ装置500及び600によって線分のベク
トルが離散画素列として生成されることになる。この場
合、格子上の各交点における整数的な点列として離散的
な線分が描画されることになる。又、マルチウィンドウ
方式におけるクリッピングにおいては、主制御部100
内に保持されるディスプレイファイルの内容の内、必要
な線分データのみが取り出されて、ピントマツプディス
プレイ600に表示されるが、このクリッピング処理は
主制御部100によって実行される。すなわちマルチウ
ィンドウ方式のウィンドウィングは、ウィンドウとビュ
ーポートの対応づけを行うために図形の平行移動や拡大
縮小等が行われるが、そのウィンドウが一般に複数個設
けられている場合には、それに対するビューポートに優
先順位をつけて重ねて表示したり、優先順がダイナミッ
クに変更できるようにしている。そのウィンドウの変換
に伴ってウィンドウの境界線において線分のクリッピン
グが行われることになる。
The X and Y coordinates indicating each point sequence are determined by the RGB bitmap memories 301 and 3 as shown in the block diagram of FIG.
Given on 02.303. And color specification register 4
When the logic indicating a dot of a particular color is written into the memory according to the contents of 00, a line is sent to the CRT 600 via the bit map display device, that is, the CRT control unit 500, which makes one bit in each memory correspond to one dot on the screen. A series of dots will be displayed. That is, when a line segment, which is a basic drawing unit, is formed on the bitmap memory, the vector of the line segment is generated as a discrete pixel string by the Rask-type display devices 500 and 600. In this case, discrete line segments are drawn as an integer sequence of points at each intersection on the grid. In addition, in clipping in the multi-window method, the main control unit 100
Only necessary line segment data is extracted from the contents of the display file held in the display file and displayed on the focus map display 600, and this clipping process is executed by the main control unit 100. In other words, in a multi-window system, the figure is moved in parallel, scaled, etc. in order to establish a correspondence between the window and the viewport, but if there are generally multiple windows, the view for that window is Ports can be prioritized and displayed overlapping, and the priority order can be changed dynamically. As the window is converted, line segment clipping will be performed at the border of the window.

例えば、あるウィンドウに線分を描画していた場合にそ
のウィンドウの優先順位が下がって他のウィンドウで半
分隠されてしまった場合、ウィンドウの境界線において
線分のクリッピングがおこることになる。従って、ウィ
ンドウ内部の線分のみを表示するために特別なりリッピ
ング処理を行う必要がある。
For example, if a line segment is drawn in a certain window, and that window's priority is lowered and half of the line is hidden by another window, clipping of the line segment will occur at the border of the window. Therefore, special ripping processing must be performed to display only the line segments inside the window.

このようなラスクスキャン方式に従うビットマツプディ
スプレイ装置において線分描画する場合、前記DDAと
いう専用のハードウェアを用いて行うがクリッピングを
行う場合に線分の引き方には2通りの方法がある。これ
を説明するために、例えば、第2図の線分描画の説明図
に示すようにX。
When drawing line segments in a bitmap display device that follows such a rask scan method, it is done using dedicated hardware called the DDA, but when performing clipping, there are two methods for drawing line segments. To explain this, for example, as shown in the explanatory diagram of line segment drawing in FIG.

Y座標系においてX=o、Y=18の点とx=22、Y
=Oの点を結ぶ線分を描画している場合に、例えば、X
=8という直線によってこの線分をクリッピングする場
合を考察する。そして、X=8よりもXが大きいか等し
い線分のみを表示し、X=8よりも小さい線分は上部の
ウィンドウによって隠される場合を想定する。このよう
に、X=8以上の線分を描く場合に、第1の方法はX=
0.Y=18の点からドツト単位で座標系を線分に沿っ
て発生し、X=8との交点に達してから表示するように
する方法である。第2の方法は、線分とクリッピングラ
インの交点を予め方程式を解いて求め、その交点から線
分に沿って表示する方法である。本発明はこの後者の方
法に従うもので予めクリッピングラインと線分との交点
を求め、その点から終点までの線分を描画する方法に関
するものである。このような交点を予め求めて終点まで
の線分を描いていく場合は高速であるが、交点の座標位
置が1ドツト分ずれる場合がある。例えば、第2図にお
いては、O印に従う線分が本来の線分であるが、交点を
求めてから線分を引(場合にはΔ印で示される線分が発
生される。この場合、O印の交点とΔ印の交点はずれる
ことがある。
In the Y coordinate system, the point X=o, Y=18 and the point x=22, Y
For example, when drawing a line segment connecting the points of =O,
Consider the case where this line segment is clipped by a straight line =8. Then, assume that only line segments with X greater than or equal to X=8 are displayed, and line segments smaller than X=8 are hidden by the upper window. In this way, when drawing a line segment with X=8 or more, the first method is
0. This is a method in which a coordinate system is generated dot by dot along a line segment from the point Y=18, and is displayed after reaching the intersection with X=8. The second method is to find the intersection between a line segment and a clipping line by solving an equation in advance, and display the image along the line segment from the intersection. The present invention follows this latter method, and relates to a method in which the intersection point between a clipping line and a line segment is determined in advance, and a line segment is drawn from that point to the end point. If such an intersection point is found in advance and a line segment is drawn to the end point, the speed is high, but the coordinate position of the intersection point may shift by one dot. For example, in Fig. 2, the line segment following the O mark is the original line segment, but the line segment is drawn after finding the intersection (in some cases, the line segment shown by the Δ mark is generated. In this case, The intersection point of the O mark and the intersection point of the Δ mark may be different.

このズレはラスクスキャン方式においては座標が整数値
のみで与えられることによって起こるものである。即ち
第2図においては本来は点線で示す線分に従うが交点を
求めてから線分を求める方式に従うと一点鎖線で示され
る線分が発生されてズレを生じることになる。本発明は
、この1ドツト分のズレをハードウェア上で補正するよ
うにしたものである。すなわちズレの部分をハードウェ
アに知らせることによってハードウェア上でそのズレを
補正するようにしているものである。従って本発明によ
ればΔ印に沿った一点鎖線の線分ではなくO印に沿った
点線の線分が結果として発生することが可能となる。
This shift occurs because coordinates are given only as integer values in the rask scan method. That is, in FIG. 2, the line segment shown by the dotted line is originally followed, but if the method of finding the line segment after finding the intersection point is followed, the line segment shown by the dashed-dotted line will be generated, resulting in a deviation. In the present invention, this one-dot deviation is corrected using hardware. In other words, the deviation is corrected on the hardware by notifying the hardware of the deviation. Therefore, according to the present invention, it is possible to generate a dotted line segment along the O mark instead of a dashed line segment along the Δ mark.

なお、この1ドツト分のズレは線分を例えば排他的論理
和演算によって消去する場合、問題となる。例えばマル
チウィンドウを実現できるシステムにおいて、第2図の
線分のPSからPEまでの線分をPSの始点からPEの
終端まで線分が描画されていた場合にPSからPCまで
が上のウィンドウによって隠されて表示されない状態か
ら、その後、上のウィンドウが移動又は消去されたため
にPSからPCまでが復元されたと仮定する。さらにこ
の状態からこの線分をPSからPEまでに関して排他的
論理和を用いて消去しようとしても1ドツト分のズレが
あると消去されるドツトが1ドツト分ずれて線分が完全
に消去できなくなるという問題が発生する。従って本発
明を用いて1ドツト分のズレを除くことの意義は非常に
大きいことになる。
Note that this one-dot deviation becomes a problem when the line segment is erased by, for example, an exclusive OR operation. For example, in a system that can realize multi-windows, if the line segment from PS to PE in Figure 2 is drawn from the starting point of PS to the end of PE, the line from PS to PC will be drawn by the window above. Assume that the PS to PC is restored from the hidden and undisplayed state because the upper window is subsequently moved or deleted. Furthermore, even if you try to erase this line segment from PS to PE using exclusive OR from this state, if there is a shift of one dot, the erased dot will shift by one dot and the line segment will not be able to be erased completely. This problem arises. Therefore, using the present invention to eliminate the deviation of one dot is of great significance.

次にクリッピング計算によって求められたPCからPE
までの線分を描画する際に、DDA200に対する初期
条件を適当に設定することによってPSからPEまでを
描画した時の軌跡と完全に一致する線分を描画する本発
明の方式について第3図の主制御部100に対する動作
流れ図を用いて説明する。本発明の方式はクリ・ノビン
グラインと線分との交点を求めてそこから終点までドツ
トを発生する方式に従うもので非常に高速になるという
長所があり、ズレも発生しないという特徴がある。DD
A200はX、Y座標のド・ノド列を発生するハードウ
ェアであるがこの初期値として始点のX、Y座標、X方
向、Y方向の差分であるDX、DY、方向(7)D I
 R,長さLEN及び誤差量Eである。本発明はこのパ
ラメータを適当に制御して線分の描画をり肝ノピングが
ある場合でも正確に描画できるようにしている。
Next, from PC obtained by clipping calculation to PE
Fig. 3 shows the method of the present invention to draw a line segment that completely matches the locus when drawing from PS to PE by appropriately setting the initial conditions for the DDA 200 when drawing the line segment from PS to PE. An explanation will be given using an operation flowchart for the main control unit 100. The method of the present invention follows the method of finding the intersection of the clear nobbing line and the line segment and generating dots from there to the end point, and has the advantage of being extremely fast and of not causing any deviation. DD
A200 is hardware that generates a do/nodo sequence of X and Y coordinates, and its initial values are the X, Y coordinates of the starting point, the difference between the X direction and the Y direction, DX, DY, direction (7) DI
R, length LEN, and error amount E. The present invention appropriately controls these parameters so that line segments can be drawn accurately even when there is liver knocking.

第3図(alは、第3図(C)に示すように(XS。FIG. 3 (al is XS as shown in FIG. 3(C).

YS)の点から(XE、YE)までの線分を書く場合を
示す流れ図である。そしてクリッピングはX=XCでク
リッピングした場合を想定している。
12 is a flowchart showing a case where a line segment from a point (YS) to (XE, YE) is drawn. The clipping is assumed to be performed with X=XC.

まずXE−XSの絶対値、即ちX方向の差分をDXに設
定する。同様にY方向の差分であるYE−YSの絶対値
をDYに設定する。次にノ\−ドウエアで線分を描く場
合には方向が問題となり、第3図(blに示すように方
向は8つの方向が定められているものと仮定する。即ち
DIR=OからDIR=7までの8つの方向である。例
えば第2図の線分の方向はDIR=7である。その次に
交点のY座標を求める。すなわち線分の方程式はY−Y
S= ((YE−YS)/ (XE−XS)3x(x−
XS)      ・・・・(1)であるからx=XC
を満足するyの値はYC±  □ XE−XS     ・・・・(2) となる。即ちクリッピングラインであるx=XCと線分
との交点の座標は整数値の座標点(XC。
First, the absolute value of XE-XS, that is, the difference in the X direction is set to DX. Similarly, the absolute value of YE-YS, which is the difference in the Y direction, is set to DY. Next, when drawing a line segment using nodeware, the direction becomes a problem, and it is assumed that eight directions are determined as shown in Figure 3 (bl). That is, from DIR=O to DIR= For example, the direction of the line segment in Figure 2 is DIR = 7. Next, find the Y coordinate of the intersection. That is, the equation of the line segment is Y-Y
S= ((YE-YS)/(XE-XS)3x(x-
XS) ...(1), so x=XC
The value of y that satisfies the following is YC±□XE−XS (2). That is, the coordinates of the intersection of the clipping line x=XC and the line segment are integer-valued coordinate points (XC.

YC)ではなく、±Q/ (XE−XS)だけズレを生
じると仮定している。次に、クリッピングラインとの交
点に最も近い整数点PCのY座標YCとそのときの余り
Qを求め、次にそのQから誤差iEを2 Q −IX 
E −X Stとして計算して設定する。
It is assumed that the deviation occurs by ±Q/(XE-XS) instead of by YC). Next, find the Y coordinate YC of the integer point PC closest to the intersection with the clipping line and the remainder Q at that time, and then calculate the error iE from that Q by 2 Q - IX
Calculate and set as E −X St.

なお余りQはOに等しいか、それよりも大きく、IX 
E −X Slよりは小さい。次に交点の整数値である
(XC,YC)を始点座標(X、Y)として設定する。
Note that the remainder Q is equal to or greater than O, and IX
E −X It is smaller than Sl. Next, the integer value of the intersection (XC, YC) is set as the starting point coordinates (X, Y).

次に線分の長さLENをIX E −X C++ 1と
して設定する。これはX方向の長さに相当する。
Next, the length LEN of the line segment is set as IX E −X C++ 1. This corresponds to the length in the X direction.

このようにして始点座標である(XC,YC)、差分値
DX、DY、方向DIR,及び長さLENが設定される
のでDDA200を起動することができ、DDA200
を起動することによって交点整数座標であるPCから終
点PEまでの線分が描画されることになる。このような
誤差fiEをDDA200の設定値として用いることに
よってDDA200内部の動作である第4図のアルゴリ
ズムに従えば、交点の実際の座標から最も近い交点整数
座標PCからPEまでの線分PSからPEまで直接描画
した場合のPCからPEまでの線分と等価なものとして
描画されることになる。すなわちLENが0になるまで
第3図の流れ図を繰り返すことにより正しい線分がPC
からPEまで描画されることになる。なお、第4図に示
すようなプレゼンハムのアルゴリズムを実行するDDA
200である場合には第3図に示すような誤差iEの設
定によりクリッピングラインと線分との交点におけるズ
レは削除することができるが、DDA200の内部動作
は必ずしも第4図に示す変数の設定方式にはよらず、他
の変数の設定を行ってもよく、この場合には、第3図の
主制御部100の動作流れ図の変数の選定の仕方はそれ
に合わせて変更する必要がある。しかしここで、本発明
の重要な基本技術は、任意の始点PCから終点PEに至
る線分の中間においてクリッピングされた場合に交点p
cからPHに至る線分を描画する場合、DDA初期条件
として、各軸の方向に対する差分値DX、DY及び主軸
指定はPS、PRの座標値から計算された値を設定し、
誤差fiEとしてはPSからPEまでの描画したと仮定
した時にPCにおいて持つべき値を設定している点であ
る。そして主軸方向長さとしてはPCからPEまでに至
る主軸方向長さを設定している点であり、これらの設定
に従ってDDAを起動している点である。このことを第
2図の線分描画の説明図で説明する。
In this way, the starting point coordinates (XC, YC), the difference values DX, DY, the direction DIR, and the length LEN are set, so the DDA 200 can be started, and the DDA 200
By activating , a line segment from the intersection integer coordinates PC to the end point PE is drawn. By using such an error fiE as a setting value of the DDA 200 and following the algorithm shown in FIG. It will be drawn as equivalent to the line segment from PC to PE when directly drawn. In other words, by repeating the flowchart in Figure 3 until LEN becomes 0, the correct line segment is
It will be drawn from PE to PE. Note that the DDA that executes the Presentham algorithm as shown in FIG.
200, the deviation at the intersection of the clipping line and the line segment can be removed by setting the error iE as shown in Figure 3, but the internal operation of the DDA 200 does not necessarily depend on the variable settings shown in Figure 4. Regardless of the method, other variables may be set, and in this case, the method of selecting variables in the operation flowchart of the main control unit 100 in FIG. 3 needs to be changed accordingly. However, an important basic technique of the present invention is that when clipping occurs in the middle of a line segment from an arbitrary starting point PC to an ending point PE, the intersection point p
When drawing a line segment from c to PH, as a DDA initial condition, the difference values DX and DY for each axis direction and the principal axis designation are set to values calculated from the coordinate values of PS and PR,
The error fiE is set as a value that should be held in the PC when it is assumed that drawing is performed from PS to PE. The length in the main axis direction is set as the length from the PC to the PE, and the DDA is started according to these settings. This will be explained with reference to FIG. 2, which is an explanatory diagram of line segment drawing.

方程式から計算された交点はPS、PEを結ぶ線分とX
=8のクリッピングラインとの交点であるPC’である
がこれは整数値でない。そのためにPC’に最も近い整
数値としての交点であるPCを求めると同時にpc’と
PCとの誤差分を誤差量Eとして換算してDDA200
に与えて線分PCとPE間の点列をそれ以後発生してい
る。即ちPC′は理想的な交点であるがこのPC′を求
めると同時にPC’に最も近い整数値PCを求め、その
誤差量をEとして換算してDDA200に与えて線分を
発生している。このことは、交点からPEまでの線分を
正しい線分として描画するためにはPC′の非整数値と
して与えられる交点を初期値として計算するようにして
いることに対応する。このようにすれば、交点PCから
終点のPEまでの線分は正しい線分、即ち点線に従う線
分に対応する点列であり、○印の点列が描画されること
になる。即ちPC′を改めて初期設定値として用いるこ
とにより、交点整数座標PCから終点PEまでの線分は
○印の整数値として点列が打たれることになり、この点
列はPSの始点からPEの終点までの長い線分をpsを
初期設定として第4図のアルゴリズムに従って描画した
○印の点列のクリッピングラインとの交点からPEまで
の点列と等価になることは明白である。
The intersection point calculated from the equation is the line segment connecting PS and PE and X
PC', which is the intersection with the clipping line of =8, is not an integer value. To do this, find PC, which is the intersection point as an integer value closest to PC', and at the same time convert the error between pc' and PC as the error amount E, and calculate DDA200.
, and a sequence of points between the line segments PC and PE is generated thereafter. That is, PC' is an ideal intersection, and at the same time as finding PC', the nearest integer value PC to PC' is found, and the error amount is converted as E and fed to the DDA 200 to generate a line segment. This corresponds to the fact that in order to draw the line segment from the intersection point to PE as a correct line segment, the intersection point given as a non-integer value of PC' is calculated as an initial value. In this way, the line segment from the intersection point PC to the end point PE is a correct line segment, that is, a sequence of points corresponding to a line segment that follows a dotted line, and a sequence of points marked with ◯ is drawn. That is, by using PC' again as the initial setting value, the line segment from the intersection point integer coordinates PC to the end point PE will be marked with a point sequence as an integer value of ○ marks, and this point sequence will be drawn from the starting point of PS to PE. It is clear that the long line segment from the end point to the end point is equivalent to the point sequence from the point of intersection with the clipping line of the point sequence marked with ◯ drawn according to the algorithm of FIG. 4 with ps as the initial setting to PE.

〔発明の効果〕 本発明はこのように任意の始点PSから終点PEに至る
線分のうち水平又は垂直な直線でクリッピングされた場
合、ディジタル微分解析器に与える初期条件として各軸
方向差分値、主軸指定はPS、PEの座標値から計算さ
れた値から設定し、誤差量としてはPSからPEまで描
画したと仮定した時に交点の最も近い整数座標値PCに
おいて持つべき値を設定し、主軸方向長さとしては前記
PCからPEに至る主軸方向長さを設定して前記ディジ
タル微分解析器を起動することによって、クリッピング
された線分のみを始点から終点に至る全画素の座標値を
計算することなく、必要な点列の座標のみを計算するこ
とにより高速がっ正確に描くことが出来るという効果が
ある。
[Effects of the Invention] As described above, the present invention provides that when a line segment from an arbitrary start point PS to an end point PE is clipped by a horizontal or vertical straight line, each axial difference value, The principal axis specification is set from the value calculated from the coordinate values of PS and PE, and the error amount is set to the value that should be at the integer coordinate value PC closest to the intersection when it is assumed that drawing is done from PS to PE, and the principal axis direction By setting the length in the principal axis direction from the PC to the PE and activating the digital differential analyzer, the coordinate values of all pixels from the starting point to the ending point of only the clipped line segment are calculated. By calculating only the coordinates of the necessary point sequence, it is possible to draw quickly and accurately.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は本発明の線分描画におけるクリッピング方式に
従うシステムの構成図、 第2図は線分描画の説明図、 第3図は本発明の主制御部の動作流れ図、第4図はディ
ジタル微分解析器の動作流れ図である。 100・・・主制御部、 200・・・ディジタル微分解析器(DDA)、301
.302,303 ・・・RGB用のビットマツプメモリ、400・・・色
指定レジスタ、 500・・・CRT制御、 600・・・CRT。 (Q) 第3図 ODAの動(¥うJs(目 第4図
Figure 1 is a configuration diagram of a system that follows the clipping method for drawing line segments of the present invention, Figure 2 is an explanatory diagram of line segment drawing, Figure 3 is an operation flowchart of the main control section of the present invention, and Figure 4 is a digital differentiation diagram. It is an operation flowchart of the analyzer. 100... Main control unit, 200... Digital differential analyzer (DDA), 301
.. 302, 303...Bitmap memory for RGB, 400...Color specification register, 500...CRT control, 600...CRT. (Q) Figure 3 ODA movement (¥U Js (Figure 4)

Claims (1)

【特許請求の範囲】 二次元の整数座標でアクセス可能なメモリ上に線分を発
生するディジタル微分解析器において、任意の始点座標
から終点座標に至る線分を垂直又は水平なクリッピング
ラインによってクリッピングし、前記線分とクリッピン
グラインの交点から終点に至る線分を描画する場合の前
記ディジタル微分解析器に与える初期設定値として、 各軸方向差分値、主軸指定は前記始点座標と前記終点座
標の座標値から計算される値を設定し、誤差量は前記始
点座標から終点座標まで描画したと仮定した時に方程式
の根から求められる交点座標に最も近い交点整数座標に
おいて持つべき値を設定し、 主軸方向長さとしては前記交点整数座標から前記終点座
標に至るものを設定することによって前記ディジタル微
分解析器を起動することを特徴とする微分描画における
クリッピング方式。
[Claims] In a digital differential analyzer that generates line segments on a memory that can be accessed using two-dimensional integer coordinates, a line segment from arbitrary start point coordinates to end point coordinates is clipped by vertical or horizontal clipping lines. , as the initial setting values given to the digital differential analyzer when drawing a line segment from the intersection of the line segment and the clipping line to the end point, each axis direction difference value and principal axis designation are the coordinates of the start point coordinates and the end point coordinates. Set the value calculated from the value, and set the error amount to the value that should be at the intersection integer coordinate closest to the intersection coordinate found from the root of the equation when it is assumed that the drawing is drawn from the starting point coordinate to the end point coordinate, and A clipping method in differential drawing, characterized in that the digital differential analyzer is activated by setting the length from the integer coordinates of the intersection point to the coordinates of the end point.
JP26853185A 1985-11-29 1985-11-29 Clipping system in line segment drawing Pending JPS62127971A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP26853185A JPS62127971A (en) 1985-11-29 1985-11-29 Clipping system in line segment drawing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP26853185A JPS62127971A (en) 1985-11-29 1985-11-29 Clipping system in line segment drawing

Publications (1)

Publication Number Publication Date
JPS62127971A true JPS62127971A (en) 1987-06-10

Family

ID=17459806

Family Applications (1)

Application Number Title Priority Date Filing Date
JP26853185A Pending JPS62127971A (en) 1985-11-29 1985-11-29 Clipping system in line segment drawing

Country Status (1)

Country Link
JP (1) JPS62127971A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01116889A (en) * 1987-10-30 1989-05-09 Hitachi Ltd Straight line drawing system in clipping area
JPH01166179A (en) * 1987-12-22 1989-06-30 Fujitsu Ltd Method for drawing clipped straight line

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01116889A (en) * 1987-10-30 1989-05-09 Hitachi Ltd Straight line drawing system in clipping area
JPH01166179A (en) * 1987-12-22 1989-06-30 Fujitsu Ltd Method for drawing clipped straight line

Similar Documents

Publication Publication Date Title
US4475104A (en) Three-dimensional display system
US4609917A (en) Three-dimensional display system
EP0360155B1 (en) Image transformation method and device
JP2976945B2 (en) Image drawing device
JPH02213286A (en) Video data processor and video data processing method
JP3547250B2 (en) Drawing method
JP2010146255A (en) Vector graphics drawing device
WO2010089805A1 (en) Graphical user interface device and method for realizing graphical user interface
JPS62127971A (en) Clipping system in line segment drawing
US5777631A (en) Method and apparatus for displaying a video window in a computer graphics display
JPH0241790B2 (en)
JPH0350686A (en) Graphic processing system
JP2641790B2 (en) Vector raster converter
JP2802890B2 (en) Display control device in graphic display system
JP2988936B2 (en) 3D graphics processing unit
JPH04172497A (en) Image display method
JPH01292424A (en) Picture information control and clipping system for multiwindow display
JP2787487B2 (en) Circuit for determining the position of a line segment displayed and operated on a computer system
JPS63240682A (en) Clipping processing system for graphic display
JPH0896148A (en) Graphic plotting device
JPH0346826B2 (en)
JPH01156881A (en) Plotting method for stroke character
JPH0535912B2 (en)
JPH04239984A (en) Graphic display device
JPS61159689A (en) Crt display unit