JPH03202979A - Polygon approximation system - Google Patents
Polygon approximation systemInfo
- Publication number
- JPH03202979A JPH03202979A JP34040289A JP34040289A JPH03202979A JP H03202979 A JPH03202979 A JP H03202979A JP 34040289 A JP34040289 A JP 34040289A JP 34040289 A JP34040289 A JP 34040289A JP H03202979 A JPH03202979 A JP H03202979A
- Authority
- JP
- Japan
- Prior art keywords
- circle
- point
- line
- determined
- polygon
- 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
Links
Landscapes
- Image Generation (AREA)
Abstract
(57)【要約】本公報は電子出願前の出願データであるた
め要約のデータは記録されません。(57) [Summary] This bulletin contains application data before electronic filing, so abstract data is not recorded.
Description
【発明の詳細な説明】
〔概要〕
正N角形によって円又は円弧を近似して表示する円弧の
多角形近似方式に関し、
円を高速に描画することを目的とし、
多角形を表示する際に、表示する円の半径と表示する線
の円の線の太さから長さを決定し、多角形近似する為の
多角形の一辺を決定する為の第1の点の位置を、描画す
べき円の中心点と前記長さから決定し、
前記一辺を決定する為の集会の点の位置を描画すべき円
の中心点と前記長さから決定し、前記第1の点と第2の
点間を結ぶと共に、前記第1の点と第2の点間で結ばれ
る第1の線と平行線であり且つ円の線の太さだけ円の中
心方向に離れている線分で決定される線で挟まれる太線
を描画する゛ことを特徴とする。[Detailed Description of the Invention] [Summary] Regarding a polygonal approximation method for arcs that approximates and displays circles or arcs using regular N-gons, the purpose is to draw circles at high speed, and when displaying polygons, The length is determined from the radius of the circle to be displayed and the thickness of the circle to be displayed, and the position of the first point to determine one side of the polygon for polygon approximation is determined by the circle to be drawn. from the center point of the circle to be drawn and the length, the position of the gathering point for determining the side is determined from the center point of the circle to be drawn and the length, and the distance between the first point and the second point is determined from the center point of the circle to be drawn and the length A line determined by a line segment that connects the first point and the second point, is parallel to the first line, and is separated by the thickness of the circle line in the direction of the center of the circle. It is characterized by drawing a thick line sandwiched between .
本発明は、円の多角形近似方式に関する。 The present invention relates to a circle polygon approximation method.
従来からデイスプレィ等の上で円を描画する際には、多
角形近似方式が行われている。Conventionally, when drawing a circle on a display or the like, a polygonal approximation method has been used.
第5図、第6図、第7図で従来の多角形近似方式を示す
。A conventional polygonal approximation method is shown in FIG. 5, FIG. 6, and FIG. 7.
第5図では、半径R(ここではRは画素数で表現してい
る)の円をN角形で近似する場合を示している。○は円
の中心点であり、A、B、Cは多角形の頂点である。FIG. 5 shows a case where a circle with a radius R (here R is expressed by the number of pixels) is approximated by an N-gon. ○ is the center point of the circle, and A, B, and C are the vertices of the polygon.
頂点の計算には、−船釣な三角関数によるθから求める
計算式を用いる。To calculate the vertex, a calculation formula obtained from θ using a −Funatsuri trigonometric function is used.
半径Rの円のある頂点(x、y)はθから、次式によっ
て求まる。A certain vertex (x, y) of a circle with radius R is determined from θ by the following equation.
χ=RXcos θ 〜・・−・−・〜・・−・−−−
一−・・−・−・−・■y = RX5in θ
多角形近似とは角度θを一定値Δθづつ増加し、次々と
得られる頂点を結び、円の代わりとするものである。(
Δθを360°の約数から選べば、正n角形に近似する
ことになる。)
Δθは、第6図に示すように近似された多角形の内接円
と外接円の半径の差が1面素未満になるよう計算するこ
とが望ましい。χ=RXcos θ 〜・・−・−・〜・・−・−−−
1-・・・・−・−・■y=RX5inθ Polygonal approximation is one in which the angle θ is increased by a constant value Δθ, and the vertices obtained one after another are connected and used instead of a circle. (
If Δθ is selected from divisors of 360°, it will approximate a regular n-gon. ) It is desirable to calculate Δθ so that the difference between the radii of the inscribed circle and the circumscribed circle of the approximated polygon is less than one plane element as shown in FIG.
Δθ= 2 cos −’ (1−R−’) −−−−
−−−−−−−−−■任意線幅の線について描画する場
合に多角形の一辺を単純に太らせると、各頂点の外側に
「抜け」が生じる、それを補うために頂点処理を通して
いる。Δθ= 2 cos -'(1-R-') -----
−−−−−−−−−■ When drawing a line with an arbitrary line width, if you simply thicken one side of the polygon, "missing" will occur outside of each vertex. To compensate for this, use vertex processing. There is.
第7図で頂点処理の例を説明する。An example of vertex processing will be explained with reference to FIG.
第7図のA、B、Cは、第5図で説明した計算で求めら
れる頂点の位置である。A, B, and C in FIG. 7 are the positions of vertices determined by the calculation described in FIG. 5.
円の太さがεとすると、点Aと点Bが決定された後に、
線ABが中心を通る様な矩形a、a、b。If the thickness of the circle is ε, after points A and B are determined,
Rectangles a, a, and b with line AB passing through their centers.
b4を描画する。第7図に示す通り、線分ABの両側に
線の太さの半分の長さε/2づつ太らせる様な感じにな
る。Draw b4. As shown in FIG. 7, it appears as if the line segment AB is thickened by half the line thickness by ε/2 on both sides.
即ち、これは、点A1点8間に太さεの線を描画するも
のであり、通常の直線描画の処理を利用する為である。That is, this is to draw a line of thickness ε between points A1 and 8, and is to use normal straight line drawing processing.
従って、直1aABと直線BCを描画した後に、頂点B
の位置にす、b、Bの位置にぬけが生じることになる。Therefore, after drawing the straight line 1aAB and the straight line BC, the vertex B
If it is placed at position b, a gap will occur at position B.
線の太さが細ければ、その抜けはめだたないが、太さが
ある程度になると抜けが目立ってしまう。If the thickness of the line is thin, the omission is not noticeable, but when the line thickness reaches a certain level, the omission becomes noticeable.
そこで、抜けを埋める処理として、点Bを中心とした半
径ε/2の円を描く処理を行う。抜けの補正はこれに限
られたものでは無いが、頂点の数だけ補正を行っていた
。Therefore, as a process to fill in the gaps, a process of drawing a circle with radius ε/2 centered on point B is performed. Correction of omissions is not limited to this, but corrections are made for as many vertices as there are.
従来の多角形近似によって生成された各頂点について頂
点処理を施していたのでは頂点数が増える程、図形描画
制御プロセッサの処理が増大するので、円弧の描画が終
了するまでに時間がかかってしまう。If vertex processing was performed for each vertex generated by conventional polygon approximation, as the number of vertices increases, the processing of the figure drawing control processor increases, so it takes time to finish drawing the arc. .
正N角形によって円及び円弧を近似して表示する円弧の
多角形近似方式に於いて、
多角形を表示する際に、表示する円の半径と表示する線
の円の線の太さから長さを決定し、多角形近似する為の
多角形の一辺を決定する為の第1の点の位置を、描画す
べき円の中心点と前記長さから決定し、
前記一辺を決定する為の第2の点の位置を描画すべき円
の中心点と前記長さから決定し、前記第1の点と第2の
点間を結ぶと共に、前記第1の点と第2の点間で結ばれ
る第1の線と平行線であり且つ円の線の太さだけ円の中
心方向に離れている線分で決定される線で挟まれる太線
を描画する。In the arc polygon approximation method that approximates and displays circles and arcs using regular N-gons, when displaying a polygon, the radius of the circle to be displayed and the length of the line to be displayed are determined from the thickness of the circle. , determine the position of the first point for determining one side of the polygon for polygonal approximation from the center point of the circle to be drawn and the length, and determine the position of the first point for determining the one side of the polygon. Determine the position of the second point from the center point of the circle to be drawn and the length, connect the first point and the second point, and connect the first point and the second point. A thick line is drawn that is parallel to the first line and is sandwiched between lines determined by line segments separated in the direction of the center of the circle by the thickness of the circle line.
多角形近似する為の多角形の一辺を決定する為の第1の
点と第2の点の位置を、描画すべき円の中心点と前記長
さから決定した後に、
前記第1の点と第2の点を結ぶ線を円の中心方向に円の
線の太さ分だけ太らせた線を描画する。After determining the positions of the first point and the second point for determining one side of the polygon for polygon approximation from the center point and the length of the circle to be drawn, Draw a line connecting the second point that is thickened by the thickness of the circle line toward the center of the circle.
即ち、第1の点と第2の点を結ぶ線の中心方向には線を
太らせないので抜けが表示ない。That is, since the line connecting the first point and the second point is not thickened toward the center, no omissions are displayed.
以下、最初に第4図で、本実施例の概要を示す。 The outline of this embodiment will first be shown below with reference to FIG.
○は円の中心点、A、B、Cは多角形近似によって計算
された頂点群である。○ is the center point of the circle, and A, B, and C are a group of vertices calculated by polygonal approximation.
B点を頂点処理した場合に求まるF点はOBの延長線上
にある。Point F, which is found when point B is subjected to vertex processing, is on the extension line of OB.
すなわち、半径にある値εを加えれば、直接Fが求まる
。これを利用する。That is, by adding a certain value ε to the radius, F can be directly determined. Take advantage of this.
(文中、/は、平行の意味。)
これをB点について頂点処理を行い、F点を得る場合に
ついて説明する。(In the sentence, / means parallel.) A case will be explained in which the vertex processing is performed on point B and point F is obtained.
AO,BO,COは中心から頂点へのベクトルであり、
全て同じ長さである。AO, BO, CO are vectors from the center to the vertices,
All are the same length.
ZAOB=ZCOB=ΔθヨΔAOBミΔCOBである
ことがわかる。It can be seen that ZAOB=ZCOB=ΔθyoΔAOBmiΔCOB.
DBは弦ABに対して太線描画の短辺といえるもので、
AB上DBである。DB can be said to be the short side of the thick line drawn with respect to string AB,
AB above DB.
DFはABを太線描画した長方形pqr DをA→B方
向に延長したときの延長用で、AB/DFとなる。同様
にCB土BEIEFなのでCB/EFである。DF is an extension when a rectangle pqr D, in which AB is drawn as a thick line, is extended in the direction of A→B, and becomes AB/DF. Similarly, it is CB Sat BEIEF, so it is CB/EF.
ここでAB/DF、CB/EFから、ZABC=ZDF
E=2αとなる。この2角の2等分はやはり等しく、Z
ABO=ZDEB=αになる。Here, from AB/DF and CB/EF, ZABC=ZDF
E=2α. The two halves of these two angles are still equal, and Z
ABO=ZDEB=α.
以上のことから、OB/BFである。すなわち、F点は
OBの延長線上にある。From the above, it is OB/BF. That is, point F is on the extension line of OB.
つまり、半径にある値εを加えて頂点を計算すると、直
接Fが求まることを意味している。厳密には、εには線
幅を補正した値を使わなければならない。つまり、DF
前方向正しい線幅は取り方であるが、εはBF力方向あ
り、実際より細くなってしまう。この補正は次式を用い
る
線幅 Δθ
ε= sec ・−・−−−−−−−
■2
Δθが十分小さい場合はsecβが1に近くなるので、
線幅をそのままεに使っても問題ない。In other words, if we calculate the vertex by adding a certain value ε to the radius, we can directly find F. Strictly speaking, a value corrected for line width must be used for ε. In other words, D.F.
The correct line width in the forward direction is a matter of how you take it, but ε is in the BF force direction, making it thinner than it actually is. This correction uses the following formula for line width Δθ ε= sec ・−・−−−−−−−
■2 If Δθ is sufficiently small, secβ will be close to 1, so
There is no problem even if the line width is used as ε.
以下第1図乃至第3図から実施例を詳しく説明する。Embodiments will be described in detail below with reference to FIGS. 1 to 3.
第1図は、本実施例の円を描画する円描画プログラムの
フローチャートである。FIG. 1 is a flowchart of a circle drawing program for drawing a circle according to this embodiment.
第2図は、前記円描画プログラムが多角形の頂点の位置
を決定する際に使用するテーブルで第2図(a)はコサ
インテーブル、第2図(ロ)は半径角度対応テーブルで
ある。FIG. 2 shows tables used by the circle drawing program to determine the positions of the vertices of a polygon; FIG. 2(a) is a cosine table, and FIG. 2(b) is a radius-angle correspondence table.
第3図はシステムの構成であり、31は描画用プロセッ
サ、32はメモリ、33は表示メモリ、34はデイスプ
レィである。FIG. 3 shows the configuration of the system, in which 31 is a drawing processor, 32 is a memory, 33 is a display memory, and 34 is a display.
描画用プロセッサ31はメモリ32の内容を読み出して
処理を行う。メモリ32には、第1図の円描画プログラ
ム321、第2図(a)のコサインテーブル、第2図(
b)の半径角度対応テーブルが格納されている。The drawing processor 31 reads the contents of the memory 32 and processes them. The memory 32 includes the circle drawing program 321 shown in FIG. 1, the cosine table shown in FIG.
The radius-angle correspondence table b) is stored.
描画用プロセッサ31と円描画用プログラム321は円
を表示用メモリ33にマツピングして、その表示用メモ
リ33に従って、デイスプレィ34に円乃至円弧が表し
表示される。The drawing processor 31 and the circle drawing program 321 map a circle to the display memory 33, and the circle or arc is displayed on the display 34 according to the display memory 33.
以下第5図(a)で線幅10で半径500の円を処理す
る場合を想定して説明する。ここでは点A50゜B50
を求め線をひく、ここで扱う角度の値は処理の都合上、
数学のそれとは異なる単位を使う。The following description will be made assuming that a circle with a line width of 10 and a radius of 500 is processed in FIG. 5(a). Here, point A50°B50
Find the line and draw the line. For processing purposes, the angle value used here is
Use units different from those used in mathematics.
それは三角関数の計算を削減する為、cos θの値を
予め図4.1 (alの様にテーブルとして持っており
、その指標を角度として使うからである。This is because in order to reduce the calculation of trigonometric functions, the value of cos θ is stored in advance as a table as shown in Figure 4.1 (al), and that index is used as the angle.
ステップI R=500としてΔθを求める。Step I: Find Δθ with R=500.
以下、ステップは、第1図円描画プログラムのそれであ
る。The steps below are those of the circle drawing program shown in FIG.
実際は式■に代入してcos−’を計算する訳ではなく
、予め図4.1 (blのように、テーブルとして持っ
ており、Rから直接求められるようにしておく。In reality, cos-' is not calculated by substituting it into the formula (2), but is prepared in advance as a table, as shown in Figure 4.1 (bl), so that it can be calculated directly from R.
Δθ= 3.5156° (内部では整数10として扱
う)ステップ2 次に補正値εを計算する。Δθ=3.5156° (Internally treated as an integer 10) Step 2 Next, the correction value ε is calculated.
式■に代入して計算する訳だが、式■を代入すると次の
様になる。It is calculated by substituting into the formula ■, but when formula ■ is substituted, it becomes as follows.
これは半径が大きい程、5ecx#1となり無視しても
問題ない事を示している。この場合、ε=線幅/2=5
としてしまう。This shows that the larger the radius, the more 5ecx#1 there is, and there is no problem in ignoring it. In this case, ε=line width/2=5
It will be.
ステップ3 半径に補正値εを加える。新しい半径値は
505となる。Step 3 Add the correction value ε to the radius. The new radius value will be 505.
ステップ4 θ−〇として、−点目を計算する。Step 4 Calculate the - point as θ-〇.
A50 (505,O)となる。A50 (505, O).
θを指標としてcosテーブルを参照。sinはずらし
て参照すればcosのものが使える。Refer to the cos table using θ as an index. If you shift the sin and refer to it, you can use the cos.
x1=RXcos θ=505X1=505y、=Rx
sin θ−505XO=0ステ・ノブ5 θにΔθを
加えて、計算する。二点目はB50 (504,30)
θ−θ+Δθ= O+3.5156=3.5156x、
=RXcos θ=505 Xo、998 =504.
049y2=RXsin θ=505 Xo、061
=30.967ステノブ6 計算した二点から太線を描
画する。x1=RXcos θ=505X1=505y,=Rx
sin θ-505XO=0 Ste-knob 5 Calculate by adding Δθ to θ. The second point is B50 (504,30) θ-θ+Δθ= O+3.5156=3.5156x,
=RXcos θ=505 Xo, 998 =504.
049y2=RXsin θ=505 Xo, 061
=30.967Stenob6 Draw a thick line from the two calculated points.
円の内側に向かって太らせなければならないがθは単純
増加されるので、反時計回りに描画される事が判る。つ
まり、左側に太らせる。We need to make the circle thicker towards the inside, but since θ is simply increased, we can see that it is drawn counterclockwise. In other words, make it fatter on the left side.
ステップ7 二点目の座標を一点目に移す。Step 7 Move the coordinates of the second point to the first point.
フチツブ8 θが1024以内であれば、以下ステップ
5〜ステツプ7を円周を全て描画するまで繰り返す。θ
−1024になったら、終了する。If the edge 8 θ is within 1024, steps 5 to 7 are repeated until the entire circumference is drawn. θ
When it reaches -1024, it ends.
以上、本発明では頂点処理が無(なる為、描画速度が著
しく速くなる。As described above, in the present invention, there is no vertex processing, so the drawing speed is significantly increased.
本発明によれば、任意の線幅の円弧を多角形近似する場
合に、頂点処理が無くなった為、−点毎に頂点処理する
場合に比べ、高速に処理することができる。According to the present invention, when a circular arc with an arbitrary line width is approximated as a polygon, since vertex processing is no longer required, the processing can be performed at a higher speed than in the case where vertex processing is performed for each -point.
第1図は本発明の実施例であるフローチャート、第2図
はコサインテーブルと、半径角度対応テーブル、第3図
は本実施例のハードウェア構成国、第4図は本発明の多
角形近似の説明図、第5図(a)は円を描画する場合の
一例図、第5図(b)は従来の多角形近似の説明図、第
6図は従来の多角形近似の説明図、第7図は従来の頂点
処理の説明図である。
31・−・−・・・−・−−−−−・−−一−−描画用
プロセッサ321−・−・−・−・−・・円描画プログ
ラム322 コサインテーブル
323 −−−−−一半径角度対応テーブル実
1キ1 イダ11
男 2 図
第 j 図
二値装置
実
胤
第
例
図
第
図
イ芝釆
(b)
’ff1s 図
イJす
夷
乙
図Fig. 1 is a flowchart of an embodiment of the present invention, Fig. 2 is a cosine table and a radius-angle correspondence table, Fig. 3 is the hardware configuration country of this embodiment, and Fig. 4 is a polygon approximation diagram of the present invention. Explanatory drawings, FIG. 5(a) is an example of drawing a circle, FIG. 5(b) is an explanatory diagram of conventional polygonal approximation, FIG. 6 is an explanatory diagram of conventional polygonal approximation, and FIG. The figure is an explanatory diagram of conventional vertex processing. 31・−・−・・−・−−−−−・−−1−−Drawing processor 321−・−・−・−・−・・Circle drawing program 322 Cosine table 323 −−−−−1 radius Angle compatible table real
1 Ki 1 Ida 11 Man 2 Figure J Figure Binary device actual example Figure Figure I Shiba pot (b) 'ff1s Figure I J Sui Otsu diagram
Claims (1)
多角形近似方式に於いて、 表示する円の半径と表示する円の線の太さから長さを決
定し、 多角形近似する為の多角形の一辺を決定する為の第1の
点の位置を、描画すべき円の中心点と前記長さから決定
し、 前記一辺を決定する為の第2の点の位置を描画すべき円
の中心点と前記長さから決定し、前記第1の点と第2の
点間を結ぶと共に、前記第1の点と第2の点間で結ばれ
る第1の線と平行線であり且つ円の線の太さだけ円の中
心方向に離れている線分で決定される線で挟まれる太線
を描画することを特徴とする多角形近似方式。[Claims] In a polygonal approximation method for arcs in which a circle or arc is approximated and displayed using a regular N-gon, the length is determined from the radius of the circle to be displayed and the thickness of the line of the circle to be displayed, The position of the first point for determining one side of the polygon for polygon approximation is determined from the center point of the circle to be drawn and the length, and the position of the second point for determining the one side is determined. A first line whose position is determined from the center point of the circle to be drawn and the length, which connects the first point and the second point, and which connects the first point and the second point. A polygonal approximation method characterized by drawing a thick line sandwiched between lines that are parallel to the line and are determined by line segments separated in the direction of the center of the circle by the thickness of the line of the circle.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP34040289A JPH03202979A (en) | 1989-12-29 | 1989-12-29 | Polygon approximation system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP34040289A JPH03202979A (en) | 1989-12-29 | 1989-12-29 | Polygon approximation system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH03202979A true JPH03202979A (en) | 1991-09-04 |
Family
ID=18336608
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP34040289A Pending JPH03202979A (en) | 1989-12-29 | 1989-12-29 | Polygon approximation system |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH03202979A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8654129B2 (en) * | 2004-05-25 | 2014-02-18 | 3Dlabs Inc., Ltd. | Tile based rendering of smooth points using polygons |
-
1989
- 1989-12-29 JP JP34040289A patent/JPH03202979A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8654129B2 (en) * | 2004-05-25 | 2014-02-18 | 3Dlabs Inc., Ltd. | Tile based rendering of smooth points using polygons |
| US9589375B2 (en) | 2004-05-25 | 2017-03-07 | 3Dlabs Inc., Ltd. | Tile based rendering of smooth points using polygons |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Prager | On the use of singular yield conditions and associated flow rules | |
| Edelsbrunner | Finding transversals for sets of simple geometric figures | |
| CN110147003B (en) | Special-shaped display panel and manufacturing method thereof | |
| CA2060039C (en) | Line draw pre-clipping method | |
| JPH03202979A (en) | Polygon approximation system | |
| JPH01131913A (en) | portable computer | |
| JPS59202433A (en) | Field effect type liquid-crystal display element | |
| Guinand | Euler lines, tritangent centers, and their triangles | |
| Askwith | The analytical geometry of the conic sections | |
| JPS59211165A (en) | Arc generation method | |
| JPS63140382A (en) | How to draw polygon approximations for circles | |
| JPS60179793A (en) | Graphic drawing apparatus | |
| JPH02128283A (en) | Rotating figure drawing method | |
| JPS63187326A (en) | input display device | |
| JPH0214385A (en) | External shape generation processing method | |
| JPH03152675A (en) | Drafting device | |
| JPH03278273A (en) | Method for rotating block and displaying mirror | |
| JPH02294787A (en) | Method for displaying straight line | |
| JPS63184128A (en) | display device | |
| JPS6168633A (en) | circle drawing device | |
| JPS63228266A (en) | Processing system for display of graphic data | |
| JPS6370387A (en) | Arc drawing method | |
| CN116955346A (en) | Ramp intersection road data storage method, terminal equipment and storage medium | |
| JPH0282363A (en) | Arc processing method in 3D figure processing system | |
| JPH0833919B2 (en) | Image processing apparatus and method |