JPH0664618B2 - Clipping circuit - Google Patents
Clipping circuitInfo
- Publication number
- JPH0664618B2 JPH0664618B2 JP2636486A JP2636486A JPH0664618B2 JP H0664618 B2 JPH0664618 B2 JP H0664618B2 JP 2636486 A JP2636486 A JP 2636486A JP 2636486 A JP2636486 A JP 2636486A JP H0664618 B2 JPH0664618 B2 JP H0664618B2
- Authority
- JP
- Japan
- Prior art keywords
- clipping
- boundary
- coordinate
- point
- circuit
- 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.)
- Expired - Lifetime
Links
- 238000000034 method Methods 0.000 description 18
- 230000008569 process Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 230000009466 transformation Effects 0.000 description 3
- 238000013459 approach Methods 0.000 description 2
- 230000008901 benefit Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
Landscapes
- Image Generation (AREA)
Description
【発明の詳細な説明】 産業上の利用分野 本発明はグラフィック・ディスプレイ装置のクリッピン
グ回路に関し、特にクリッピング境界と交差する線分の
クリッピング境界の外部にある部分をクリッピングする
ようなクリッピング回路に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a clipping circuit for a graphic display device, and more particularly to a clipping circuit for clipping a portion of a line segment that intersects with the clipping boundary and is outside the clipping boundary.
従来の技術 グラフィック・ディスプレイ装置において対象物を表示
する際、ビューポートを超えて図形が現われる場合が生
じうる。この場合表示図形がビューポート内に収まるよ
うに対象物のはみ出した部分を切りとる必要がある。こ
の処理は一般にクリッピング(またはクリップ)と呼ば
れ、切りとるための境界はクリッピング境界と呼ばれて
いる。表示対象物が2次元物体であるときはクリッピン
グ境界は複数(一般に4つ)の2次元直線で構成され、
表示対象物が3次元物体であるときはクリッピング境界
は複数(一般には4つないし6つ)の3次元平面で構成
される。一方、表示対象物は2次元物体の場合でも3次
元物体の場合でも多角形によって近似されることが多
い。従ってクリッピング処理は多角形の不要な部分を複
数のクリッピング境界線または境界面に対して切りとる
という処理であると考えられる。この処理に対する有力
な解法として、アイ・イー・サザーランドとジー・ダブ
リュー・ホッジマン(I・E・Sutherland and G・
W・Hodgman)による「リエントラント・ポリゴン・ク
リッピング」,コミュニケーションズ・オブ・ジ・エー
・シー・エム、第17巻、第1号(“Reentrant Polygon
Clipping",CACM,Vol.17,No.1),pp32−42,1974で述
べられているアルゴリズムが挙げられる。このアルゴリ
ズムでは、多角形を頂点の列として入力し、クリッピン
グ境界を構成する直線または平面で順次クリッピングを
行う。1つの直線または平面についてのクリッピングが
終わると、その処理結果として出力される頂点の列で構
成される多角形を入力として次の直線または平面につい
てクリッピングを行っていく。このアルゴリズムの特徴
は前記の1つ1つのクリッピング境界ごとに順次クリッ
ピングを行って行くことに加えて、多角形を頂点の列と
考えて隣接する2つの頂点を結ぶ線分に対してクリッピ
ングを行うということである。ある1つのクリッピング
境界(片面でも直線でもよい)と、多角形を構成する隣
接する2つの頂点の関係を第2図に示す。第2図a〜c
において201はクリッピング境界を、202はクリッピング
境界201に対する内部を、203はクリッピング境界201に
対する外部を示す。但し、クリッピング境界201上は内
部に含まれるものとする。第2図aは2つの頂点Pi及び
Pjがともに内部202にある場合を示す。この場合、線分P
iPj204もまた内部202にある。第2図bは2つの頂点Pi
及びPjがともに外部203にある場合を示す。この場合、
線分PiPj204もまた外部にある。第2図cは2つの頂点P
i,Pjのうち一方(本例ではPi)が内部202にあり、他方
(本例ではPj)が外部203にある場合を示す。この場
合、線分PiPj204の一部のみが内部202にある。線分PiPj
204とクリッピング境界201の交点をPkとすると線分PiPj
205が内部にある。従って前記第2図の各々の場合に応
じて不要な部分を切りとって行くことにより、入力され
た多角形の頂点の列に対するクリッピングされた多角形
の頂点の列が生成される。2. Description of the Related Art When displaying an object on a graphic display device, a graphic may appear beyond the viewport. In this case, it is necessary to cut out the protruding portion of the object so that the displayed figure fits in the viewport. This process is generally called clipping (or clipping), and the boundaries for cutting are called clipping boundaries. When the display object is a two-dimensional object, the clipping boundary is composed of a plurality of (generally four) two-dimensional straight lines,
When the display object is a three-dimensional object, the clipping boundary is composed of a plurality of (generally four to six) three-dimensional planes. On the other hand, the display object is often approximated by a polygon regardless of whether it is a two-dimensional object or a three-dimensional object. Therefore, the clipping process is considered to be a process of cutting an unnecessary portion of the polygon into a plurality of clipping boundary lines or boundary surfaces. Possible solutions to this process are I Sutherland and G. Sutherland and G.
"Reentrant Polygon Clipping" by W. Hodgman, Communications of the ACM, Volume 17, Issue 1 ("Reentrant Polygon
Clipping ", CACM, Vol.17, No. 1), pp32-42, 1974. This algorithm inputs polygons as a sequence of vertices and creates straight lines or When clipping of one straight line or plane is completed, clipping is performed for the next straight line or plane with the polygon formed of the row of vertices output as the processing result as an input. The characteristic of this algorithm is that, in addition to sequentially clipping each clipping boundary, a polygon is considered as a row of vertices and clipping is performed on a line segment connecting two adjacent vertices. The relationship between a certain clipping boundary (which may be one side or a straight line) and two adjacent vertices that form a polygon is shown in FIG. Figure 2a-c.
In 201, 201 indicates a clipping boundary, 202 indicates an inside of the clipping boundary 201, and 203 indicates an outside of the clipping boundary 201. However, it is assumed that the clipping boundary 201 is included inside. Figure 2a shows two vertices Pi and
The case where both Pj are in the inside 202 is shown. In this case, the line segment P
iPj204 is also inside 202. Figure 2b shows two vertices Pi
And Pj are both outside 203. in this case,
The line segment PiPj204 is also outside. Figure 2c shows two vertices P
One of i and Pj (Pi in this example) is inside 202 and the other (Pj in this example) is outside 203. In this case, only part of the line segment PiPj 204 is inside 202. Line segment PiPj
If the intersection of 204 and clipping boundary 201 is Pk, the line segment PiPj
205 is inside. Therefore, a clipped polygonal vertex row for the input polygonal vertex row is generated by cutting out unnecessary portions in each case of FIG.
第3図にこのアルゴリズムを用いて2次元のクリッピン
グを行う場合の例を示す。第3図aにおいて、301はク
リッピングの対象となる多角形P0,P1,P2を、302は
クリッピング境界x=x1を、303はクリッピング境界
x=x2を、304はクリッピング境界y=y1を、305は
クリッピング境界y=y2を示す。306は多角形301をク
リッピング境界302〜305でクリッピングした結果の多角
形を示す。まずクリッピング境界302に対して多角形301
をクリッピングする場合を例にとって、1つのクリッピ
ング境界に対するクリッピングの手順を説明する。FIG. 3 shows an example in which two-dimensional clipping is performed using this algorithm. In FIG. 3A, 301 is a polygon P 0 , P 1 , P 2 to be clipped, 302 is a clipping boundary x = x 1 , 303 is a clipping boundary x = x 2 , 304 is a clipping boundary y. = Y 1 and 305 indicates a clipping boundary y = y 2 . Reference numeral 306 denotes a polygon resulting from clipping the polygon 301 with clipping boundaries 302 to 305. First the polygon 301 against the clipping boundary 302
Taking the case of clipping as an example, the clipping procedure for one clipping boundary will be described.
多角形301は頂点の列P0,P1,P2として入力される。
まず2点P0,P1はクリッピング境界302に対してとも
に内部308にあるので2点P0,P1はそのままクリッピ
ング結果の多角形309の頂点として出力される。The polygon 301 is input as a sequence of vertices P 0 , P 1 and P 2 .
First, since the two points P 0 and P 1 are both inside 308 with respect to the clipping boundary 302, the two points P 0 and P 1 are output as they are as the vertices of the clipping result polygon 309.
次に2点P1,P2のうちP2は外部307にあるので、線
分 とクリッピング境界302の交点P3が出力される。最後
にP2,P0のうちP2は外部307に、P0は内部308にあ
るので線分 とクリッピング境界302の交点P4が出力される。以上
の結果、頂点の列P0,P1,P3,P4で示される多角形30
9がクリッピング境界302に対するクリッピング結果とな
る。以下同様に、順次クリッピング境界303に対するク
リッピング結果を第3図cに、クリッピング境界304に
対するクリッピング結果を第3図dに、クリッピング境
界305に対するクリッピング結果を第3図eにそれぞれ
示す。第3図eの306が最終的に得られた多角形P9,P
5,P7,P8,P3,P4,P10を示す。Next, since P 2 of the two points P 1 and P 2 is outside 307, the line segment And the intersection P 3 of the clipping boundary 302 is output. Finally, of P 2 and P 0 , P 2 is on the outside 307 and P 0 is on the inside 308. And a clipping boundary 302 intersecting point P 4 is output. As a result of the above, the polygon 30 indicated by the row of vertices P 0 , P 1 , P 3 and P 4
9 is the clipping result for clipping boundary 302. Similarly, the clipping result for the sequential clipping boundary 303 is shown in FIG. 3c, the clipping result for the clipping boundary 304 is shown in FIG. 3d, and the clipping result for the clipping boundary 305 is shown in FIG. 3e. The polygon P 9 , P finally obtained is 306 in FIG. 3e.
5 , P 7 , P 8 , P 3 , P 4 , and P 10 are shown.
発明が解決しようとする問題点 しかしながら、以上で説明したアルゴリズムのハードウ
ェア化を考える場合、ある点がクリッピング境界に対し
て内部にあるか外部にあるかを判定するには、その点の
座標値とクリッピング境界を表わす何らかの値との大小
比較などの簡単な処理でよいが、クリッピングの対象と
なる多角形の隣接する2点のうち一方がクリッピング境
界内部に、他方が外部にあるときのクリッピング境界と
2点を結ぶ線分の交点を求めるためには、乗算や除算が
必要でありハードウェア化には不利である。また、直線
的に交点を計算する代わりに、2点の中点を求め、漸近
的に交点を探索して行く「中点分割法」が、アール・エ
フ・スプロールとアイ・イー・サザーランド(R.F.Spro
ull and I.E.Sutherland)による「ア・クリッピング
・ディバイダ」,エフ・ジェー・シー・シー,トンプソ
ンブックス発行(“Clipping Divider",FJCC,Thompson
Books)pp765〜775,1968において提案されている。
「中点分割法」は通常座標系で表わされている2点の中
点の算出は加算とシフト演算という簡単なハードウェア
で実現できるため有力な方法であるといえる。しかしな
がら、クリッピングに先立つ座標変換処理においては、
変換の表現が容易であり、変換の合成が変換行列の積で
記述できるなどの理由から、一般に通常座標系ではなく
同次座標系での座標表現が用いられている。また、演算
の精度の問題(前記「リエントラント・ポリゴン・クリ
ッピング」による)などから、同次座標系においてクリ
ッピングを行うことが望ましい。ところが後記の発明の
実施例の項において説明するように、同次座標系におけ
る座標値で与えられる2点の中点は単純な加算では求ま
らないため、ハードウェア化における前記の「中点分割
法」の利点がなくなるという問題があった。Problems to be Solved by the Invention However, when considering the hardware implementation of the algorithm described above, to determine whether a certain point is inside or outside the clipping boundary, the coordinate value of the point is determined. Is a simple process such as comparing the size with a value indicating the clipping boundary, but when one of the two adjacent points of the polygon to be clipped is inside the clipping boundary and the other is outside, the clipping boundary In order to obtain the intersection of the line segment connecting the two points with and, multiplication and division are necessary, which is disadvantageous for hardware implementation. In addition, instead of calculating the intersections linearly, the “midpoint division method” that finds the midpoints of the two points and asymptotically searches for the intersections is the R.F. Sproll and A.I. Sutherland (RFSpro
"A Clipping Divider" by ull and IESutherland, FJC C, published by Thompson Books ("Clipping Divider", FJCC, Thompson)
Books) pp765-775,1968.
It can be said that the “midpoint division method” is an effective method because the calculation of the midpoint of two points normally represented by the coordinate system can be realized by simple hardware such as addition and shift calculations. However, in the coordinate conversion process prior to clipping,
Since the representation of the transformation is easy and the synthesis of the transformation can be described by the product of transformation matrices, the coordinate representation in the homogeneous coordinate system is generally used instead of the ordinary coordinate system. Further, it is desirable to perform clipping in the homogeneous coordinate system due to the problem of calculation accuracy (due to the “reentrant polygon clipping”). However, as will be described later in the embodiment of the invention, since the midpoint of two points given by the coordinate values in the homogeneous coordinate system cannot be found by simple addition, the above-mentioned "midpoint in hardware implementation" There was a problem that the advantage of "division method" was lost.
本発明はかかる点に鑑み、簡単な加減算やシフト演算の
みを用いて、同次座標系で表わされた2つの点を結ぶ線
分とクリッピング境界との交点を求めるようなクリッピ
ング回路を提供することを目的とする。In view of such a point, the present invention provides a clipping circuit that obtains an intersection of a line segment connecting two points represented by a homogeneous coordinate system and a clipping boundary by using only simple addition and subtraction and shift operations. The purpose is to
問題点を解決するための手段 本発明は前記問題点を解決するために、クリッピング境
界と交差する線分の2つの端点のうち前記クリッピング
境界に対して内部にある第1の端点の同次座標系におけ
る座標値を格納する第1のレジスタ群と、前記クリッピ
ング境界に対して外部にある第2の端点の同次座標系に
おける座標値を格納する第2のレジスタ群と、前記第1
のレジスタ群に格納されている第1の端点の座標値と前
記第2のレジスタ群に格納されている第2の端点の座標
値のW座標の絶対値を比較して両方または一方の座標デ
ータに適当な値を乗じて両者の絶対値の桁が等しくなる
ようにする桁合わせ回路と、前記桁合わせ回路によって
桁合わせされた前記第1及び第2の端点の各々の座標値
の対応する要素を加算する加算回路と、前記加算回路の
出力値を同次座標系における座標値としてもつ第3の点
が、前記クリッピング境界に対して境界上にあるか、境
界の内部にあるかまたは境界の外部にあるかのいずれか
を判定する判定回路と、前記判定回路の出力に基づき、
前記第3の点が前記クリッピング境界に対して境界上に
あるときには前記加算回路の出力値をクリッピング境界
と前記の線分との交点の座標値として出力し、境界の内
部にあるときには前記加算回路の出力値を前記第1のレ
ジスタ群に格納し、境界の外部にあるときには前記加算
回路の出力値を前記第2のレジスタ群に格納する制御回
路とを備えたクリッピング回路である。Means for Solving the Problem In order to solve the above-mentioned problems, the present invention provides, in order to solve the above-mentioned problems, homogeneous coordinates of a first end point, which is inside the clipping boundary, of two end points of a line segment intersecting the clipping boundary. A first register group for storing coordinate values in the system, a second register group for storing coordinate values in a homogeneous coordinate system of a second endpoint outside the clipping boundary, and the first register group.
Coordinate data of the first end point stored in the register group of No. 2 and the absolute value of the W coordinate of the coordinate value of the second end point stored in the second register group, and both or one of the coordinate data is compared. To a digit matching circuit for multiplying both by an appropriate value so that the digits of both absolute values are equal, and corresponding elements of the coordinate values of each of the first and second end points aligned by the digit matching circuit. And a third point having the output value of the adding circuit as a coordinate value in the homogeneous coordinate system is on the boundary with respect to the clipping boundary, inside the boundary, or at the boundary. Based on the output of the determination circuit and the determination circuit that determines which is external,
When the third point is on the boundary with respect to the clipping boundary, the output value of the adder circuit is output as the coordinate value of the intersection of the clipping boundary and the line segment, and when it is inside the boundary, the adder circuit is output. Is stored in the first register group, and when it is outside the boundary, the control circuit stores the output value of the adder circuit in the second register group.
作用 本発明は前記の構成により、クリッピング境界と交差す
る線分の2つの端点の同次座標系における座標値を入力
データとして受けとり第1及び第2のレジスタ群に格納
し、桁合わせ回路により各々のレジスタ群に格納された
座標値に適当な数を乗じ(例えば加算またはシフト演算
を行う)て各々のw座標(2次元の場合には座標値の第
3次元の要素、3次元の場合には座標値の第4次元の要
素)の絶対値の桁合わせを行い、桁合わせした座標値を
加算回路によって単純に加算して得られた値を「擬似的
な中点」の座標値と見なし「中点分割法」と同様の処理
を行う。すなわち、前記の判定回路によって前記の点と
クリッピング境界との位置関係を判定し、前記の制御回
路は前記の点がクリッピング境界の内部にあるときは加
算回路の出力を前記第1のレジスタ群に格納し、この値
と既に前記第2のレジスタ群に格納されている値とを新
らたな線分の2つの端点の座標値として前記の処理を繰
り返し、また前記の点がクリッピング境界の外部にある
ときは加算回路の出力を前記第2のレジスタ群に格納
し、この値と既に前記第1のレジスタ群に格納されてい
る値とを新らたな線分の2つの端点の座標値として前記
の処理を繰り返し、また前記の点がクリッピング境界上
にあるときには加算回路の出力を求めている交点の座標
値として出力し、1つの線分に対するクリッピング処理
を終える。With the above-described structure, the present invention receives the coordinate values of the two end points of the line segment intersecting the clipping boundary in the homogeneous coordinate system as input data, stores them in the first and second register groups, and uses the digit matching circuit to respectively receive them. The coordinate value stored in the register group of is multiplied by an appropriate number (for example, addition or shift operation is performed), and each w coordinate (in the case of two dimensions, the third dimension element of the coordinate value, in the case of three dimensions). Is the fourth-dimensional element of the coordinate value) and the absolute value of the absolute value is aligned, and the value obtained by simply adding the aligned coordinate value by the adder circuit is regarded as the "pseudo midpoint" coordinate value. The same processing as the "midpoint division method" is performed. That is, the determination circuit determines the positional relationship between the point and the clipping boundary, and the control circuit outputs the output of the adder circuit to the first register group when the point is inside the clipping boundary. This value and the value already stored in the second register group are stored as the coordinate values of the two end points of the new line segment, and the above processing is repeated, and the point is outside the clipping boundary. , The output of the adder circuit is stored in the second register group, and this value and the value already stored in the first register group are coordinate values of the two end points of the new line segment. The above process is repeated, and when the above point is on the clipping boundary, the output of the adding circuit is output as the coordinate value of the desired intersection point, and the clipping process for one line segment is completed.
実施例 本発明の実施例を図面を用いて説明する前に、本発明の
依るところの原理についての説明並らびに証明を行う。
以下の説明で用いる座標値はすべて3次元空間上の点を
示しているが、2次元平面上のクリッピングを考える場
合には座標値の次元を1つ減らせる(すなわちz座標を
省略する)ことにより容易に類推できる。なお座標値と
してアルファベット小文字を用いて表現されたもの〔例
えば(x,y,z)〕を通常座標系の座標値とし、アルファ
ベット大文字を用いて更に第4の座標wを付加して表現
されたもの〔例えば(x,y,z,w)〕を同次座標系の座標
値とする。Embodiments Before describing the embodiments of the present invention with reference to the drawings, a description and proof of the principle on which the present invention is based will be given.
All coordinate values used in the following description indicate points in a three-dimensional space, but when clipping on a two-dimensional plane is considered, the dimension of the coordinate value can be reduced by one (that is, the z coordinate is omitted). Can be easily analogized by. It should be noted that coordinate values expressed in lower case alphabets [eg (x, y, z)] are used as coordinate values in the normal coordinate system, and upper case letters are used to add the fourth coordinate w. A thing [eg (x, y, z, w)] is used as the coordinate value of the homogeneous coordinate system.
クリッピング境界の条件は一般に次式 で表現されるが説明を簡単にするため次式 で考える。通常座標系における点(x,y,z)は同次座標
系において(X,Y,Z,w)と表現される。但し、wは0で
ないものとし、 なる関係を満足する。従ってクリッピング境界の条件を
示す式(2)は同次座標系では次のように表わされる。The clipping boundary condition is generally It is expressed by Think in. The point (x, y, z) in the normal coordinate system is expressed as (X, Y, Z, w) in the homogeneous coordinate system. However, w is not 0, Satisfy the relationship. Therefore, equation (2), which indicates the clipping boundary condition, is expressed as follows in the homogeneous coordinate system.
または、 同次座標系における座標値に0でないスカラーを乗じて
も対応する通常座標は変化しないので式(4)の場合のみ
を考えるものとする。式(4)からわかるようにクリッピ
ング境界は次式(6)に示す6つの平面からなる。 Or Since the corresponding normal coordinates do not change even if the coordinate value in the homogeneous coordinate system is multiplied by a scalar other than 0, only the case of the formula (4) will be considered. As can be seen from equation (4), the clipping boundary consists of the six planes shown in equation (6).
いま、1つのクリッピング境界w−X=0に対して2点
P1(X1,Y1,Z1,w1)とP2(X2,Y2,Z2,w2)
を結ぶ線分をクリッピングを行う場合を考える。但し、
w1,w2>0とする。 Now, two points P 1 (X 1 , Y 1 , Z 1 , w 1 ) and P 2 (X 2 , Y 2 , Z 2 , w 2 ) for one clipping boundary w−X = 0.
Consider the case of clipping a line segment that connects to. However,
Let w 1 and w 2 > 0.
式(4)よりX1w1かつX2w2のときは2点P1
とP2はともにクリッピング境界の内部にあり、従って
線分 もまたクリッピング境界の内部にある。またx1>w1
かつX2>w2のときは2点P1とP2はともにクリッ
ピング境界の外部にあり、従って線分 もまたクリッピング境界の外部にある。またX1>w1
かつX2w2のときまたはX1w1かつX2>w2
のときは2点のうち一方がクリッピング境界の内部に、
他方が外部にあるので線分 のうちクリッピング境界の外部にある部分を切りとらな
ければならない。いま点P1がクリッピング境界の内部
にあり、点P2が外部にあるものとする。線分 とクリッピング境界w−X=0との交点をP3(X3,Y
3,Z3,w3)とすると、点P3は次式(7)で与えられ
る。From the formula (4), when X 1 w 1 and X 2 w 2 , two points P 1
And P 2 are both inside the clipping boundary, so the line segment Is also inside the clipping boundary. Also x 1 > w 1
When X 2 > w 2 , the two points P 1 and P 2 are both outside the clipping boundary, and thus the line segment Is also outside the clipping boundary. Also X 1 > w 1
And X 2 w 2 or X 1 w 1 and X 2 > w 2
When, one of the two points is inside the clipping boundary,
Line segment because the other is outside The part of the clip outside the clipping boundary must be clipped. It is now assumed that the point P 1 is inside the clipping boundary and the point P 2 is outside. line segment And the clipping boundary w−X = 0 intersects with P 3 (X 3 , Y
3 , Z 3 , w 3 ), the point P 3 is given by the following equation (7).
前記の同次座標系の座標値の性質から式(7)は、 とも表わせる。しかしながら式(8)を用いても交点P3
の算出には少なくとも6回の乗算が必要となる。一方、
前記の通常座標系における「中点分割法」を適用する場
合を考える。2点P1及びP2に対応する通常座標系に
おける座標値は各々(X1/w1,Y1/w1,Z1/
w1)と(X2/w2,Y2/w2,Z2/w2)であるこ
とから中点P4(X4,Y4,Z4,w4)に対応する通常座
標系における座標値は、次式(9)で与えられる。 From the property of the coordinate values of the above-mentioned homogeneous coordinate system, equation (7) is Can be expressed as However, even if equation (8) is used, the intersection point P 3
At least 6 multiplications are required to calculate on the other hand,
Consider a case where the above-mentioned "midpoint division method" in the normal coordinate system is applied. The coordinate values in the normal coordinate system corresponding to the two points P 1 and P 2 are respectively (X 1 / w 1 , Y 1 / w 1 , Z 1 / Z 1
w 1 ) and (X 2 / w 2 , Y 2 / w 2 , Z 2 / w 2 ), the normal coordinate system corresponding to the midpoint P 4 (X 4 , Y 4 , Z 4 , w 4 ). The coordinate value at is given by the following equation (9).
前記の同次座標系におる座標値の性質から式(9)は、 とも表わせる。しかしながら式(10)を用いても中点P4
の算出には少なくとも7回の乗算が必要となり、式(8)
に従って直接的に交点P3を求めるよりも処理が複雑と
なり、「中点分割法」を適用することは無意味となる。 From the property of the coordinate values in the above-mentioned homogeneous coordinate system, equation (9) is Can be expressed as However, even if equation (10) is used, the midpoint P 4
At least 7 multiplications are required to calculate
Therefore, the processing is more complicated than directly obtaining the intersection point P 3, and it is meaningless to apply the “midpoint division method”.
そこで中点P4に代わる点として次式(11)で表わされる
点PM(XM,YM,ZM,wM)を考える。Therefore, consider a point P M (X M , Y M , Z M , w M ) represented by the following equation (11) as a point that replaces the middle point P 4 .
いま通常座標系において2点P1とPMを結ぶベクトル は次式(12)で表わされる。 Now the vector connecting the two points P 1 and P M in the normal coordinate system Is expressed by the following equation (12).
一方、2点P1とP2を結ぶベクトル は次式(13)で表わされる。 On the other hand, the vector connecting the two points P 1 and P 2 Is expressed by the following equation (13).
従って式(12)及び式(13)より、次式が導かれる。 Therefore, the following equation is derived from the equations (12) and (13).
いまw1とw2はともに正であるから、 なる関係が成立する。以上から点PMは線分 上の端点P1及びP2の間にある点となる。従って式(1
1)に従って点PMの座標値を求め、得られた座標値に対
して式(4)を用いてクリッピング境界との位置関係を判
定し点PMがクリッピング境界の内部にある(XM<w
M)ときは点P1の座標値を点PMの座標値で置き換え
て線分 に対して前記と同様の処理を、また点PMがクリッピン
グ境界の外部にある(XM>wM)ときは点P2の座標
値を点PMの座標値で置き換えて線分 に対して前記と同様の処理を点PMがクリッピング境界
上に来るまで繰り返す。 Since w 1 and w 2 are both positive now, The relationship is established. From the above, the point P M is a line segment It is a point between the upper end points P 1 and P 2 . Therefore, the formula (1
The coordinate value of the point P M is obtained according to 1), the positional relationship with the clipping boundary is determined using the equation (4) for the obtained coordinate value, and the point P M is inside the clipping boundary (X M < w
M ) then replace the coordinate value of point P 1 with the coordinate value of point P M For point P M outside the clipping boundary (X M > w M ), the coordinate value of point P 2 is replaced with the coordinate value of point P M to obtain a line segment. The same process as described above is repeated for the point P M on the clipping boundary.
第1図は以上に説明した本発明のクリッピング処理を行
うクリッピング回路の実施例を示す図である。FIG. 1 is a diagram showing an embodiment of a clipping circuit for performing the clipping processing of the present invention described above.
第1図において101はあるクリッピング境界と交差する
線分の2つの端点のうちクリッピング境界の内部にある
第1の端点の座標値データを、102は座標値データ101の
要素を格納する第1のレジスタ群を、103はクリッピン
グ境界の外部にある第2の端点の座標値データを、104
は座標値データ103の要素を格納する第2のレジスタ群
を、105はレジスタ群102とレジスタ群104に格納されて
いる座標値データのw座標の桁合わせを行う桁合わせ回
路を、106は桁合わせ回路105によって補正された座標値
データの対応する要素の加算を行う加算回路を、107は
加算回路106の出力を座標値にもつ点と与えられたクリ
ッピング境界との位置関係を判定する判定回路を、108
は判定回路107の結果に応じて加算回路106の出力を第1
のレジスタ群102に格納したり、第2のレジスタ群104に
格納したり、最終結果109として出力する制御回路を示
す。In FIG. 1, 101 is the coordinate value data of the first end point inside the clipping boundary of the two end points of the line segment that intersects a certain clipping boundary, and 102 is the first value that stores the element of the coordinate value data 101. The register group 103 is the coordinate value data of the second end point outside the clipping boundary, and 104
Is a second register group that stores the elements of the coordinate value data 103, 105 is a digit alignment circuit that aligns the w coordinates of the coordinate value data stored in the register groups 102 and 104, and 106 is a digit. Reference numeral 107 denotes an adder circuit for adding corresponding elements of the coordinate value data corrected by the matching circuit 105, and 107 is a determination circuit for determining the positional relationship between a point having the coordinate value of the output of the adder circuit 106 and a given clipping boundary. A, 108
Outputs the output of the adder circuit 106 according to the result of the determination circuit 107.
2 shows a control circuit for storing in the register group 102, storing in the second register group 104, and outputting as the final result 109.
加算回路106、判定回路107、制御回路108の働きについ
ては前記の説明と重複するため再度の説明は省略し、桁
合わせ回路105の働きについてのみ補足説明をする。The functions of the adder circuit 106, the judgment circuit 107, and the control circuit 108 are the same as those described above, and therefore, the description thereof will be omitted, and only the function of the digit alignment circuit 105 will be supplementarily described.
レジスタ群102及び104に格納されている座標値データの
w座標の値の絶対値が非常に大きく異なる場合(例えば
w1≪w2のとき)、前記式(14)は、 となり、加算回路106から出力される点PMの座標値
は、もとの端点P2の座標値に非常に近い値となる。従
って、点PMがなかなかクリッピング境界との交点に収
束しないという現象が生じる。極端な場合、加算回路10
6における加算の際に「情報落ち」が生じ、点PMが永
久に最初の2つの端点のいずれかに留まり処理が終了し
ないことも起りうる。そこで、前記の同次座標系におけ
る座標値の性質を利用して、桁合わせ回路105によりレ
ジスタ群102及び104に格納されている座標データのw座
標の絶対値を比較し、絶対値の桁がほぼ等しくなるよう
にいずれか一方または両方の座標値データに対して適当
な値を乗じて桁合わせを行う。これにより式(15)のw2
/(w1+w2)も1/2に近づき点PMも真の中点に近
くなる。この桁合わせ処理は、座標値データが固定小数
点数で表現されているときには座標値データのシフト演
算により、また座標値データが浮動小数点数で表現され
ているときには座標値データの指数部に対する加減算で
実現できるため、実際には乗算回路を必要としない。When the absolute values of the w-coordinate values of the coordinate value data stored in the register groups 102 and 104 are very different (for example, when w 1 << w 2 ), the equation (14) is Therefore, the coordinate value of the point P M output from the adding circuit 106 is a value very close to the coordinate value of the original end point P 2 . Therefore, a phenomenon occurs in which the point P M does not easily converge at the intersection with the clipping boundary. In extreme cases, adder circuit 10
"Lost-'occurs during the addition in 6, the process remains in either of the first two end points the point P M is permanently may also happen that no ends. Therefore, by utilizing the property of the coordinate values in the above-mentioned homogeneous coordinate system, the digit matching circuit 105 compares the absolute values of the w coordinates of the coordinate data stored in the register groups 102 and 104, and finds that the digit of the absolute value is Digit alignment is performed by multiplying one or both coordinate value data by an appropriate value so that they are almost equal. This gives w 2 in equation (15)
/ (W 1 + w 2 ) also approaches 1/2, and the point P M also approaches the true midpoint. This digit alignment processing is performed by a shift operation of the coordinate value data when the coordinate value data is expressed by a fixed point number, and by an addition or subtraction with respect to the exponent part of the coordinate value data when the coordinate value data is expressed by a floating point number. Since it can be realized, a multiplication circuit is not actually required.
なお、実施例の説明においてはクリッピング境界として
w−X=0を用いたが、判定回路107における判定条件
を変えることにより他のクリッピング境界に対しても容
易に適用できることは言うまでもない。Although w−X = 0 is used as the clipping boundary in the description of the embodiment, it goes without saying that it can be easily applied to other clipping boundaries by changing the judgment conditions in the judgment circuit 107.
発明の効果 以上のように本発明によれば、同次座標系におけるクリ
ッピング処理が乗除算回路を用いずに実現でき、ハード
ウェア化、特にLSI化に適しており、グラフィック・デ
ィスプレイ装置における画像生成の高速化並びにハード
ウェア・コストの低減に対する寄与が大である。EFFECTS OF THE INVENTION As described above, according to the present invention, clipping processing in a homogeneous coordinate system can be realized without using a multiplication / division circuit, which is suitable for hardware implementation, particularly for LSI implementation, and image generation in a graphic display device is possible. It greatly contributes to the speeding up and reduction of hardware cost.
第1図は本発明のクリッピング回路の実施例の構成を示
すブロック図、第2図はクリッピングのアルゴリズムの
説明図、第3図は2つの端点を結ぶ線分とクリッピング
境界との位置関係図である。 102,104…レジスタ群、105…桁合わせ回路、106…加算
回路、107…判定回路、108…制御回路。FIG. 1 is a block diagram showing a configuration of an embodiment of a clipping circuit of the present invention, FIG. 2 is an explanatory diagram of a clipping algorithm, and FIG. 3 is a positional relationship diagram between a line segment connecting two end points and a clipping boundary. is there. 102, 104 ... Register group, 105 ... Digit alignment circuit, 106 ... Addition circuit, 107 ... Judgment circuit, 108 ... Control circuit.
Claims (1)
端点のうち前記クリッピング境界に対して内部にある第
1の端点の同次座標系における座標値を格納する第1の
レジスタ群と、前記クリッピング境界に対して外部にあ
る第2の端点の同次座標系における座標値を格納する第
2のレジスタ群と、前記第1のレジスタ群に格納されて
いる第1の端点の座標値と前記第2のレジスタ群に格納
されている第2の端点の座標値のW座標の絶対値を比較
して両方または一方の座標データに適当な値を乗じて両
者の絶対値の桁が等しくなるようにする桁合わせ回路
と、前記桁合わせ回路によって桁合わせされた前記第1
及び第2の端点の各々の座標値の対応する要素を加算す
る加算回路と、前記加算回路の出力値を同次座標系にお
ける座標値としてもつ第3の点が、前記クリッピング境
界に対して境界上にあるか、境界の内部にあるかまたは
境界の外部にあるかを判定する判定回路と、前記判定回
路の判定に基づき前記第3の点が前記クリッピング境界
に対して境界上にあるときには前記加算回路の出力値を
クリッピング境界と前記線分との交点の座標値として出
力し、前記第3の点が境界の内部にあるときには前記加
算回路の出力値を前記第1のレジスタ群に格納し、前記
第3の点が境界の外部にあるときには前記加算回路の出
力値を前記第2のレジスタ群に格納する制御回路とを具
備することを特徴とするクリッピング回路。1. A first register group for storing coordinate values in a homogeneous coordinate system of a first end point inside the clipping boundary among two end points of a line segment intersecting the clipping boundary, and A second register group that stores coordinate values in a homogeneous coordinate system of a second endpoint that is external to the clipping boundary, a coordinate value of the first endpoint that is stored in the first register group, and the The absolute value of the W coordinate of the coordinate value of the second end point stored in the second register group is compared, and both or one coordinate data is multiplied by an appropriate value so that the digits of both absolute values become equal. Digit adjusting circuit and the first digit adjusted by the digit adjusting circuit
And an adder circuit for adding corresponding elements of the coordinate values of the respective second end points, and a third point having the output value of the adder circuit as coordinate values in the homogeneous coordinate system is a boundary with respect to the clipping boundary. A determination circuit for determining whether it is above, inside the boundary, or outside the boundary; and when the third point is on the boundary with respect to the clipping boundary based on the determination of the determination circuit, The output value of the adder circuit is output as the coordinate value of the intersection of the clipping boundary and the line segment, and the output value of the adder circuit is stored in the first register group when the third point is inside the boundary. And a control circuit for storing the output value of the adder circuit in the second register group when the third point is outside the boundary.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2636486A JPH0664618B2 (en) | 1986-02-07 | 1986-02-07 | Clipping circuit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2636486A JPH0664618B2 (en) | 1986-02-07 | 1986-02-07 | Clipping circuit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS62184576A JPS62184576A (en) | 1987-08-12 |
| JPH0664618B2 true JPH0664618B2 (en) | 1994-08-22 |
Family
ID=12191443
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2636486A Expired - Lifetime JPH0664618B2 (en) | 1986-02-07 | 1986-02-07 | Clipping circuit |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0664618B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP4439060B2 (en) | 1999-12-17 | 2010-03-24 | 株式会社ルネサステクノロジ | Floating point adder |
-
1986
- 1986-02-07 JP JP2636486A patent/JPH0664618B2/en not_active Expired - Lifetime
Also Published As
| Publication number | Publication date |
|---|---|
| JPS62184576A (en) | 1987-08-12 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5363479A (en) | System and method for rendering bezier splines | |
| US7277096B2 (en) | Method and apparatus for surface approximation without cracks | |
| US7764285B2 (en) | Computer graphics systems and methods for encoding subdivision triangular surfaces | |
| JPH01124077A (en) | Pixel generation method and system | |
| JPH0927039A (en) | Method and apparatus for calculating texel values for displaying texture on an object | |
| JPH1049665A (en) | Device and method for image processing | |
| GB2204216A (en) | Curve generation in a display system | |
| US7636095B2 (en) | Pixel delta interpolation method and apparatus | |
| EP0349182B1 (en) | Method and apparatus for approximating polygonal line to curve | |
| US20050024385A1 (en) | Method and apparatus for interpolating pixel parameters based on a plurality of vertex values | |
| US6742008B2 (en) | Accurate and cost effective linear interpolators | |
| US7397483B1 (en) | Image data conversion using interpolation | |
| JPH0664618B2 (en) | Clipping circuit | |
| Milovanović et al. | Designing of processor-time optimal systolic arrays for band matrix-vector multiplication | |
| Bona et al. | Numerical black holes: a moving grid approach | |
| JP3039387B2 (en) | Apparatus for calculating intersection of B-spline curve and straight line in three-dimensional CAD | |
| US20030117399A1 (en) | Image processing apparatus and method, storage medium, and program | |
| US6380936B1 (en) | System and method for inferring projective mappings | |
| JP4089728B2 (en) | Multidimensional interpolator | |
| JP3312382B2 (en) | Normal vector coordinate converter | |
| JPS6114514B2 (en) | ||
| JP2713400B2 (en) | Projection information generation device | |
| TW479207B (en) | Elimination method and module for 3D graphics | |
| JPH0344773A (en) | Image interpolating method | |
| JPH0210476A (en) | Polygonal line approximating device for curve |