JPH10198811A - Line segment approximating method for tertiary bezier curve - Google Patents
Line segment approximating method for tertiary bezier curveInfo
- Publication number
- JPH10198811A JPH10198811A JP86097A JP86097A JPH10198811A JP H10198811 A JPH10198811 A JP H10198811A JP 86097 A JP86097 A JP 86097A JP 86097 A JP86097 A JP 86097A JP H10198811 A JPH10198811 A JP H10198811A
- Authority
- JP
- Japan
- Prior art keywords
- segment
- bezier curve
- point
- cubic bezier
- curve
- 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 Processing (AREA)
- Image Generation (AREA)
Abstract
Description
【0001】[0001]
【発明の属する技術分野】本発明は、3次ベジェ曲線に
よって表される図形をビットマップなどに描画するにあ
たり、当該3次ベジェ曲線を一連の線分の連なりとして
近似するための方法に関する。The present invention relates to a method for approximating a cubic Bezier curve as a series of line segments when drawing a graphic represented by a cubic Bezier curve on a bit map or the like.
【0002】[0002]
【従来の技術】コンピュータグラフィックスや描画系の
ソフトウエアでは、自由曲線を3次ベジェ曲線で近似し
て表現することが一般的である。3次ベジェ曲線は、始
点、終点、及び2つの制御点で定義されるパラメータ曲
線であり、その形状を変えることなく2つの3次ベジェ
曲線に分割できることが知られている。とくに、3次ベ
ジェ曲線をP(t)(0≦t≦1)なるパラメトリック
曲線として表現した場合に、P(0.5)なる点におい
て2分割する方法は、計算が容易でありよく用いられて
いる。2. Description of the Related Art In computer graphics and drawing software, a free curve is generally approximated by a cubic Bezier curve. A cubic Bezier curve is a parameter curve defined by a start point, an end point, and two control points, and is known to be able to be divided into two cubic Bezier curves without changing its shape. In particular, when a cubic Bezier curve is expressed as a parametric curve of P (t) (0 ≦ t ≦ 1), a method of dividing into two at a point of P (0.5) is easy to calculate and is often used. ing.
【0003】例えば、図14に示すように、始点P0 ,
第1制御点P1 ,第2制御点P2 ,終点P3 で定義され
る3次ベジェ曲線(以下、このような3次ベジェ曲線を
「3次ベジェ曲線P0 ・P1 ・P2 ・P3 」のように表
記する)は、形状を変えることなく、2つの3次ベジェ
曲線、すなわち、3次ベジェ曲線P0 ・P01・P012・
P0123と、3次ベジェ曲線P0123・P123 ・P23・P3
とに分割できる。ここで、For example, as shown in FIG. 14, starting points P0,
A cubic Bezier curve defined by a first control point P1, a second control point P2, and an end point P3 (hereinafter, such a cubic Bezier curve is represented as "cubic Bezier curve P0.P1.P2.P3". ) Is two cubic Bezier curves, ie, cubic Bezier curves P0, P01, P012,
P0123 and cubic Bezier curves P0123 ・ P123 ・ P23 ・ P3
Can be divided into here,
【数1】 P01=(P0 +P1 )/2 P12=(P1 +P2 )/2 P012 =(P01+P12)/2 P23=(P2 +P3 )/2 P123 =(P12+P23)/2 P0123=(P012 +P123 )/2 である。P01 = (P0 + P1) / 2 P12 = (P1 + P2) / 2 P012 = (P01 + P12) / 2 P23 = (P2 + P3) / 2 P123 = (P12 + P23) / 2 P0123 = (P012 + P123) / 2 It is.
【0004】このように、3次ベジェ曲線は、再帰的に
分割を繰り返すことにより、際限なく細分することがで
きる。この3次ベジェ曲線の性質を利用した3次ベジェ
曲線描画アルゴリズムとして、つぎのようなものが知ら
れている。すなわち、描画しようとする3次ベジェ曲線
を再帰的に分割していき、分割後の各セグメント(すな
わち3次ベジェ曲線)が予め設定しておいた許容値より
平坦であると判断された時点でこの分割を停止し、この
ときの平坦なセグメントを当該セグメントの始点と終点
とを結ぶ線分(直線分)で近似するというアルゴリズム
である。このアルゴリズムによれば、1つの3次ベジェ
曲線が、線分の連なりとして近似的に描画される。As described above, the cubic Bezier curve can be subdivided without limit by repeating the division recursively. The following is known as a cubic Bezier curve drawing algorithm utilizing the property of the cubic Bezier curve. That is, the cubic Bezier curve to be drawn is recursively divided, and when each segment after division (ie, the cubic Bezier curve) is determined to be flatter than the preset allowable value, This algorithm stops the division and approximates the flat segment at this time with a line segment (linear segment) connecting the start point and the end point of the segment. According to this algorithm, one cubic Bezier curve is approximately drawn as a series of line segments.
【0005】この描画アルゴリズムにおいては、近似の
精度は、セグメントを線分に近似する判定基準(すなわ
ち前述の例では、平坦さの許容値)に左右される。In this drawing algorithm, the accuracy of approximation depends on a criterion for approximating a segment to a line segment (ie, in the above-described example, an allowable value of flatness).
【0006】この線分近似の判定基準としては、次のよ
うなものが知られている。The following is known as a criterion for this line segment approximation.
【0007】(a)図15に示すように、セグメントの
始点と終点とを結ぶ線分P0 P3 と、各制御点P1 ,P
2 それぞれとの距離d1 ,d2 が所定の許容値以下であ
る場合に線分近似可能と判定する方法。(A) As shown in FIG. 15, a line segment P0 P3 connecting a start point and an end point of a segment and control points P1 and P
(2) A method of determining that line segment approximation is possible when distances d1 and d2 to each of them are equal to or smaller than a predetermined allowable value.
【0008】(b)特開平2−105979号公報に示
される方法。この方法では、セグメントの始点又は終点
とセグメント上の所定の点とを結ぶ線分と、前記始点と
終点とを結ぶ線分とのなす角が所定の許容角度以下の場
合に、線分近似可能と判定する。(B) A method disclosed in JP-A-2-105979. In this method, when the angle formed by the line segment connecting the start point or the end point of the segment and the predetermined point on the segment and the line segment connecting the start point and the end point is equal to or smaller than a predetermined allowable angle, the line segment can be approximated. Is determined.
【0009】(c)特開平2−71384号公報に示さ
れる方法。この方法では、セグメントの始点及び終点の
中点と、2つの制御点の中点と、の距離が所定の許容値
以下の場合に線分近似可能と判定する。(C) A method disclosed in JP-A-2-71384. In this method, when the distance between the midpoint of the start point and end point of the segment and the midpoint of the two control points is equal to or smaller than a predetermined allowable value, it is determined that the line segment can be approximated.
【0010】(d)特開平4−223577号公報に示
される方法。この方法では、セグメントの始点及び終点
の中点と各制御点との距離が、いずれも所定の許容値以
下の場合に線分近似可能と判定する。(D) A method disclosed in JP-A-4-223577. In this method, when the distance between the middle point of the start point and the end point of the segment and each control point is equal to or smaller than a predetermined allowable value, it is determined that the line segment can be approximated.
【0011】(e)特開平4−266847号公報に示
される方法。この方法では、セグメントの始点及び終点
との距離の1/3と、始点又は終点といずれかの制御点
との距離との差が所定の許容値以下である場合に線分近
似可能と判定する。(E) A method disclosed in JP-A-4-266847. In this method, if the difference between one third of the distance between the start point and the end point of the segment and the distance between the start point or the end point and any of the control points is equal to or smaller than a predetermined allowable value, it is determined that the line segment can be approximated. .
【0012】[0012]
【発明が解決しようとする課題】しかしながら、以上に
述べた各判定基準には、それぞれ以下に示すような問題
がある。However, each of the above-described criteria has the following problems.
【0013】まず上記(a)の基準では、図16に示す
ようなセグメントP0 ・P1 ・P2・P3 が線分P0 P3
に近似されてしまう。図16に示すセグメントは、線
分P0 P3 の外側にはみ出た部分があるにもかかわら
ず、それが線分P0 P3 に近似されると実際よりも短く
描画されてしまい、問題となる。First, according to the criterion (a), a segment P0.P1.P2.P3 as shown in FIG.
Is approximated by Although the segment shown in FIG. 16 has a portion outside the line segment P0 P3, if it is approximated to the line segment P0 P3, it will be drawn shorter than it actually is, causing a problem.
【0014】また上記(b)の基準では、図17に示す
ように始点P0 又は終点P3 と制御点P1 ,P2 との距
離が大きい場合のように、角度θ1 、θ2 は許容値以下
でも、セグメントの中央部分が線分P0 P3 から離れて
いる場合も考えられ、このような場合に線分近似を行う
ことは近似精度上問題となる。また、これを避けるため
に許容角度を小さく設定すると、分割処理の回数が多く
なり処理に要する時間が指数関数的に増大してしまう。Further, according to the criterion (b), even if the angles θ1 and θ2 are smaller than the allowable values, as in the case where the distance between the start point P0 or the end point P3 and the control points P1 and P2 is large as shown in FIG. May be distant from the line segment P0 P3, and performing line segment approximation in such a case poses a problem in terms of approximation accuracy. Further, if the allowable angle is set small to avoid this, the number of times of the division processing increases, and the time required for the processing increases exponentially.
【0015】また上記(c)の基準では、セグメントが
図18に示すような平坦とはいえない形状の場合でも、
線分P0 P3 の中点P03と線分P1 P2 の中点P12との
距離は小さくなり、線分近似を行ってしまうおそれがあ
る。According to the criterion (c), even if the segment has a shape that is not flat as shown in FIG.
The distance between the midpoint P03 of the line segment P0 P3 and the midpoint P12 of the line segment P1 P2 becomes small, and there is a possibility that the line segment may be approximated.
【0016】また上記(d)の基準では、図19に示す
ようにセグメントは十分に平坦でも両制御点P1 ,P2
の間隔が離れている場合には、線分近似可能であるにも
かかわらず制御点P1 ,P2 と始点終点の中点P03との
距離d3 ,d4 が大きくなって近似不可能と判定されて
しまう。したがって、この場合、余計な分割をしてしま
って処理時間が掛かるという問題がある。According to the criterion (d), as shown in FIG. 19, even if the segment is sufficiently flat, both control points P1, P2
Are too large, the distances d3 and d4 between the control points P1 and P2 and the middle point P03 of the start point and end point are large even though the line segment can be approximated, and it is determined that approximation is impossible. . Therefore, in this case, there is a problem that extra division is required and processing time is required.
【0017】また上記(e)の基準では、セグメントは
十分に平坦でも、図20に示すように両制御点P1 ,P
2 が始点及び終点の中央近傍で近接しているような場合
では、実際には線分近似可能であるにもかかわらず、始
点又は終点と制御点との距離が始点終点間の距離の1/
3から掛け離れた値となり、近似不可能と判定されてし
まう。したがって、この場合、余計な分割をしてしまっ
て処理時間が掛かるという問題がある。According to the criterion (e), even if the segment is sufficiently flat, as shown in FIG. 20, both control points P1, P2
2 is close to the center of the start point and the end point, the distance between the start point or the end point and the control point is 1/1/1 of the distance between the start point and the end point, although the line segment can actually be approximated.
The value is far from 3 and it is determined that approximation is impossible. Therefore, in this case, there is a problem that extra division is required and processing time is required.
【0018】本発明は、このような問題を解決するため
になされたものであり、比較的高速に3次ベジェ曲線の
各セグメントの線分近似の可否を的確に判定し、滑らか
な近似曲線を得ることができる3次ベジェ曲線の線分近
似方法を提供することを目的とする。The present invention has been made to solve such a problem, and it is possible to accurately determine whether or not a line segment can be approximated for each segment of a cubic Bezier curve at a relatively high speed, and to form a smooth approximated curve. It is an object of the present invention to provide a method of approximating a cubic Bezier curve that can be obtained.
【0019】[0019]
【課題を解決するための手段】前述の目的を達成するた
めに、本発明に係る3次ベジェ曲線の線分近似方法は、
始点、終点及び2つの制御点で定義された3次ベジェ曲
線を再帰的に分割し、分割後の各セグメントが平坦であ
ると判定された時点で分割を停止し、平坦と判定された
セグメントの始点及び終点の座標データを当該セグメン
トの近似線分データとして生成することにより、与えら
れた3次ベジェ曲線を近似する一連の近似線分データを
生成する3次ベジェ曲線の線分近似方法において、分割
によって得られたセグメントが、当該セグメントの始点
又は終点の外側にはみ出した突出形及び当該セグメント
の始点及び終点を結ぶ線分と交わる交叉形のいずれでも
ない標準形の3次ベジェ曲線であると判定された場合
に、当該セグメントの厚さに関する代表値を予め設定さ
れた許容値と比較し、前記代表値が前記許容値より小さ
い場合に前記セグメントが平坦であると判定することを
特徴とする。In order to achieve the above object, a method of approximating a cubic Bezier curve according to the present invention comprises:
A cubic Bezier curve defined by a start point, an end point, and two control points is recursively divided, and when each segment after the division is determined to be flat, the division is stopped. In the method of approximating a cubic Bezier curve, which generates a series of approximate line segment data approximating a given cubic Bezier curve by generating the coordinate data of the start point and the end point as approximate line segment data of the segment, The segment obtained by the division is a standard cubic Bézier curve that is neither a protruding shape protruding outside the start point or end point of the segment nor a cross shape intersecting a line segment connecting the start point and end point of the segment. If it is determined, the representative value related to the thickness of the segment is compared with a preset allowable value, and if the representative value is smaller than the allowable value, the segment Doo is and judging as flat.
【0020】ここで、セグメントが始点又は終点の外側
にはみ出すとは、3次ベジェ曲線であるセグメントの一
部が図7のごとく、線分P0 P3 の両端(すなわち始点
と終点)に立てた垂線の間の領域の外側にはみ出た状態
をいう。Here, the term "the segment protrudes outside the starting point or the ending point" means that a part of the segment which is a cubic Bezier curve is perpendicular to both ends (ie, the starting point and the ending point) of the line segment P0 P3 as shown in FIG. Means a state outside the area between the two.
【0021】前述したように、セグメントが突出形であ
る場合は、セグメントが平坦であっても、始点と終点と
を結ぶ線分で近似したのでは不都合があり、交叉形であ
る場合は、平坦でないにもかかわらず線分近似を行って
しまうおそれがある。これに対し、この構成では、セグ
メントが性質の良い標準形である場合に平坦性を判定し
て線分近似を行うことにより、誤った近似を回避するこ
とができる。As described above, when the segment has a protruding shape, even if the segment is flat, it is inconvenient if the segment is approximated by a line connecting the start point and the end point. However, there is a possibility that a line segment approximation may be performed. On the other hand, in this configuration, when the segment is a standard form having a good property, erroneous approximation can be avoided by determining flatness and performing line segment approximation.
【0022】本発明の好適な態様では、標準形のセグメ
ントの平坦性を判定する際に用いるセグメントの厚さに
関する代表値として、前記セグメントの2つの制御点の
中点と、前記セグメントの始点及び終点を結ぶ線分との
距離を用いる。In a preferred aspect of the present invention, the midpoint of the two control points of the segment, the starting point of the segment, The distance from the line connecting the end points is used.
【0023】この態様において、セグメントが標準形で
ある場合には、セグメントの各点は必ず始点及び終点を
結ぶ線分(以下「ベースライン」と呼ぶ)と2制御点の
中点との間を通る(これについての証明は後述する)。
したがって、このベースラインと中点との距離が所定の
許容値以下であれば、ベースラインからみたセグメント
の厚みも必ずこの許容値以下となるのでセグメントは平
坦であると判定できる。この態様によれば、前述の従来
技術(a)などのように平坦性の判定のために2回もの
距離演算を行う必要がなく、計算時間を短縮できる。点
と直線との距離の演算は比較的複雑な演算であり、しか
も通常作成される3次ベジェ曲線はこのような標準形が
多いことを考えれば、この演算の回数が減ることは処理
速度の観点からみて極めて効果が大きい。In this embodiment, when the segment is in the standard form, each point of the segment always goes between a line connecting the start point and the end point (hereinafter referred to as a "base line") and the midpoint of the two control points. Pass (the proof of this will be described later).
Therefore, if the distance between the baseline and the midpoint is equal to or less than a predetermined allowable value, the thickness of the segment viewed from the baseline is always equal to or less than the allowable value, and the segment can be determined to be flat. According to this aspect, it is not necessary to perform the distance calculation twice to determine the flatness as in the above-described related art (a), and the calculation time can be reduced. The calculation of the distance between a point and a straight line is a relatively complicated calculation, and considering that the cubic Bezier curve usually created has many such standard forms, the reduction in the number of times of this calculation means that the processing speed is reduced. The effect is extremely large from the viewpoint.
【0024】また、本発明に係る方法は、始点、第1制
御点、第2制御点及び終点で定義される3次ベジェ曲線
を再帰的に分割する第1ステップであって、分割結果の
3次ベジェ曲線が、当該3次ベジェ曲線の始点、第1制
御点、第2制御点、及び終点をこの順に結んで得られる
四角形が凸四角形となる標準形の3次ベジェ曲線になる
まで分割を繰り返す第1ステップと、第1ステップによ
って得られた標準形の3次ベジェ曲線に対し、当該曲線
の2つの制御点の中点と始点及び終点を結ぶ線分との距
離を求め、この距離が所定の許容値以下の場合は当該曲
線の前記始点及び終点の座標データを当該曲線の近似線
分データとして生成し、前記距離が許容値以下でない場
合は当該曲線を2つの3次ベジェ曲線に分割する第2ス
テップと、を含み、第2ステップによって標準形の3次
ベジェ曲線が分割された場合に、分割結果の3次ベジェ
曲線について前記第2ステップを繰り返し適用すること
により、与えられた3次ベジェ曲線を近似する一連の近
似線分データを生成することを特徴とする。The method according to the present invention is a first step of recursively dividing a cubic Bezier curve defined by a start point, a first control point, a second control point, and an end point. The division is performed until the next Bezier curve becomes a standard cubic Bezier curve in which a square obtained by connecting the start point, the first control point, the second control point, and the end point of the cubic Bezier curve in this order is a convex quadrangle. The first step to be repeated and the distance between the middle point of the two control points of the curve and the line segment connecting the start point and the end point are obtained for the standard cubic Bezier curve obtained by the first step. When the distance is less than a predetermined allowable value, coordinate data of the start point and the end point of the curve is generated as approximate line segment data of the curve, and when the distance is not less than the allowable value, the curve is divided into two cubic Bezier curves. A second step of When the standard cubic Bezier curve is divided by the second step, a series of approximations approximating the given cubic Bezier curve by repeatedly applying the second step to the divided cubic Bezier curve. It is characterized by generating line segment data.
【0025】この方法では、第1ステップによって得ら
れる標準形の3次ベジェ曲線は、例えば図9に示すよう
な凸形の形状となり、第2ステップにて、このような標
準形の3次ベジェ曲線に平坦性を判定し、線分近似を行
っている。平坦性の判定は、標準形の3次ベジェ曲線に
対し、ベースラインと2制御点の中点との距離を求め、
この距離が所定の許容値以下となるか否かによって行
う。元の3次ベジェ曲線が標準形であれば分割結果も標
準形となるので、分割結果のベジェ曲線については第2
ステップの処理のみを繰り返せばよい。この方法によれ
ば、標準形の3次ベジェ曲線(セグメント)に分割して
から線分近似を行うので、近似可否の誤判定を行うこと
がなく、しかも平坦性の判定では、点と直線との距離演
算は1度行うだけで済むため、処理速度が向上する。In this method, the standard cubic Bezier curve obtained in the first step has, for example, a convex shape as shown in FIG. 9, and in the second step, such a standard cubic Bezier curve is obtained. The flatness of the curve is determined, and a line segment approximation is performed. The flatness is determined by determining the distance between the baseline and the midpoint of the two control points for the standard cubic Bezier curve,
The determination is made based on whether this distance is equal to or less than a predetermined allowable value. If the original cubic Bezier curve is in the standard form, the division result is also in the standard form.
Only the process of the step needs to be repeated. According to this method, line segment approximation is performed after dividing into a standard cubic Bezier curve (segment). Therefore, erroneous determination of approximation is not performed. Is only required to be performed once, thereby improving the processing speed.
【0026】この構成の好適な態様では、前記第1ステ
ップは、与えられた3次ベジェ曲線が始点又は終点の外
側にはみ出した突出形か否かを判定し、突出形と判定さ
れた場合は当該3次ベジェ曲線を2つの3次ベジェ曲線
に分割し、分割結果の3次ベジェ曲線が突出形でないと
判定されるまで分割処理を再帰的に繰り返す突出形排除
ステップと、与えられた3次ベジェ曲線が、当該3次ベ
ジェ曲線の始点及び終点を結ぶ線分と2つの制御点を結
ぶ直線とが交わる交叉形か否かを判定し、交叉形と判定
された場合は当該3次ベジェ曲線を2つの3次ベジェ曲
線に分割し、分割結果の3次ベジェ曲線が交叉形でない
と判定されるまで分割処理を再帰的に繰り返す交叉形排
除ステップと、を所定の順序で適用する。In a preferred aspect of this configuration, the first step is to determine whether or not the given cubic Bezier curve is a protruding shape protruding outside the starting point or the ending point. A protruding shape elimination step of dividing the cubic Bezier curve into two cubic Bezier curves, and recursively repeating the dividing process until it is determined that the divided cubic Bezier curve is not a protruding shape; It is determined whether or not the Bezier curve is an intersecting shape in which a line segment connecting the start point and the end point of the cubic Bezier curve intersects with a straight line connecting the two control points. Is divided into two cubic Bezier curves, and a crossover elimination step of recursively repeating the dividing process until it is determined that the cubic Bezier curve resulting from the division is not a crossover is applied in a predetermined order.
【0027】すなわち、この態様では、標準形の3次ベ
ジェ曲線に分割するために、突出形排除ステップと交叉
形排除ステップとを所定の順序で順次適用する。突出形
排除ステップと交叉形排除ステップの適用順序は基本的
にはどちらが先でもよい。例えば、突出形排除ステップ
を先に適用する場合には、このステップで得られた突出
形でない3次ベジェ曲線が次の交叉形排除ステップに渡
される。That is, in this embodiment, in order to divide into a standard cubic Bezier curve, the protruding shape eliminating step and the cross-shaped eliminating step are sequentially applied in a predetermined order. Either of the protruding type exclusion step and the cross-type exclusion step may be applied first. For example, if the protruding shape elimination step is applied first, the non-protruding cubic Bezier curve obtained in this step is passed to the next cross-shaped exclusion step.
【0028】この構成の更に好適な態様では、前記突出
形排除ステップにおける突出形か否かの判定は、始点及
び終点を結ぶベクトルと始点及び第1制御点を結ぶベク
トルとの内積、及び始点及び終点を結ぶベクトルと第2
制御点及び終点を結ぶベクトルとの内積に基づき行う。In a further preferred aspect of this configuration, the determination as to whether or not the object is a protruding shape in the protruding shape eliminating step includes determining an inner product of a vector connecting the starting point and the ending point and a vector connecting the starting point and the first control point, and the starting point and the Vector connecting end point and second
This is performed based on the inner product of a vector connecting the control point and the end point.
【0029】3次ベジェ曲線は、始点及び終点を結ぶ直
線と始点及び第1制御点を結ぶ直線とのなす角が90°
以下で、かつ始点及び終点を結ぶ直線と第2制御点及び
終点とを結ぶ直線とのなす角が90°以下の場合には、
突出形にならない。角度が90°以下であるか否かはベ
クトルの内積の正負で判定でき、このベクトルの内積は
ベクトルの各成分の積と和の簡単な組合せで求めること
ができるので、この態様によれば、少ない処理時間で突
出形か否かの判定を行うことができる。The cubic Bezier curve has an angle of 90 ° between a straight line connecting the starting point and the ending point and a straight line connecting the starting point and the first control point.
If the angle between the straight line connecting the start point and the end point and the straight line connecting the second control point and the end point is 90 ° or less,
Does not protrude. Whether the angle is 90 ° or less can be determined by the sign of the inner product of the vector, and the inner product of this vector can be obtained by a simple combination of the product and sum of each component of the vector. It is possible to determine whether or not it is a protruding type in a short processing time.
【0030】また、別の好適な態様では、前記交叉形排
除ステップにおいて、3次ベジェ曲線が交叉形と判定さ
れた場合に、更に所定の判定基準に従って当該3次ベジ
ェ曲線が線分近似可能か否かを判定し、線分近似可能と
判定された場合は線分近似を行って当該3次ベジェ曲線
についての分割を停止し、線分近似不可能と判定された
場合にのみ当該3次ベジェ曲線を2つの3次ベジェ曲線
に分割する。In another preferred aspect, when the cubic Bezier curve is determined to be a cross shape in the cross elimination step, whether the cubic Bezier curve can be approximated by a line segment is further determined according to a predetermined criterion. It is determined whether or not the line segment approximation is possible. When the line segment approximation is determined to be possible, the division of the cubic Bezier curve is stopped, and only when the line segment approximation is determined to be impossible, the tertiary Bezier curve is determined. Divide the curve into two cubic Bezier curves.
【0031】交叉形の3次ベジェ曲線は、一般にある程
度分割すれば非交叉形の3次ベジェ曲線の組合せに分け
ることが可能だが、最悪の場合として、いくら分割して
も一方に交叉形が残ってしまうようなケースも考えられ
る。このような場合、無限ループに陥るおそれがある
が、この態様によれば、交叉形について独自に線分近似
の判定を行い、可能であれば交叉形の段階で線分近似を
してしまうので、そのような無限ループに陥ることを防
止できる。Generally, a crossed cubic Bezier curve can be divided into a combination of non-intersecting cubic Bezier curves by dividing it to some extent. In some cases, it may happen. In such a case, there is a risk of falling into an infinite loop. However, according to this aspect, the line segment approximation is independently determined for the crossing shape, and if possible, the line segment approximation is performed at the stage of the crossing shape. , Such an infinite loop can be prevented.
【0032】また、本発明は、始点、第1制御点、第2
制御点及び終点で定義される3次ベジェ曲線を再帰的に
分割する第1ステップであって、分割結果の3次ベジェ
曲線が、当該3次ベジェ曲線の始点、第1制御点、第2
制御点、及び終点をこの順に結んで得られる四角形が凸
四角形となる標準形の3次ベジェ曲線になるまで分割を
繰り返す第1ステップと、第1ステップによって得られ
た標準形の3次ベジェ曲線に対し、当該曲線の2つの制
御点の中点と始点及び終点を結ぶ線分との距離を求め、
この距離が所定の許容値以下の場合は当該曲線の前記始
点及び終点の座標データを当該曲線の近似線分データと
して生成し、前記曲線が許容値以下でない場合は当該曲
線を2つの3次ベジェ曲線に分割する第2ステップと、
第2ステップによって標準形の3次ベジェ曲線が分割さ
れた場合に、分割結果の3次ベジェ曲線について前記第
2ステップを繰り返し適用する第3ステップと、をコン
ピュータに実行させるためのプログラムを記録した記録
媒体を提供するものである。Further, according to the present invention, the starting point, the first control point, the second
A first step of recursively dividing a cubic Bezier curve defined by a control point and an end point, wherein the cubic Bezier curve resulting from the division is a start point, a first control point, and a second control point of the cubic Bezier curve.
A first step of repeating division until a quadrangle obtained by connecting the control point and the end point in this order becomes a standard cubic Bezier curve that becomes a convex quadrangle, and a standard cubic Bezier curve obtained by the first step The distance between the middle point of the two control points of the curve and the line segment connecting the start point and the end point is calculated,
If the distance is equal to or smaller than a predetermined allowable value, coordinate data of the start point and the end point of the curve is generated as approximate line segment data of the curve. If the curve is not equal to or smaller than the allowable value, the curve is divided into two cubic Bezier. A second step of dividing into curves,
When a standard form cubic Bezier curve is divided by the second step, a program for causing a computer to execute the third step of repeatedly applying the second step to the cubic Bezier curve resulting from the division is recorded. A recording medium is provided.
【0033】この記録媒体に記録されたプログラムがコ
ンピュータシステムにて実行されることにより、本発明
に係る3次ベジェ曲線の線分近似方法を実現することが
できる。なお、前記記録媒体の概念には、フレキシブル
ディスクやハードディスク、CD−ROM、光磁気ディ
スク、ROM(リードオンリーメモリ)、フラッシュメ
モリなど、プログラムを記録した機械読取り可能なすべ
ての媒体が含まれる。なお、上記プログラムを通信媒体
を経由して提供・記録する方法も本発明の態様に含まれ
る。When the program recorded on the recording medium is executed by the computer system, the method of approximating the cubic Bezier curve according to the present invention can be realized. The concept of the recording medium includes all machine-readable media on which programs are recorded, such as a flexible disk, a hard disk, a CD-ROM, a magneto-optical disk, a ROM (Read Only Memory), and a flash memory. Note that a method of providing and recording the above program via a communication medium is also included in the aspect of the present invention.
【0034】[0034]
【発明の実施の形態】以下、本発明の好適な実施形態を
図面に基づいて説明する。DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Preferred embodiments of the present invention will be described below with reference to the drawings.
【0035】[原理説明]本実施形態における3次ベジ
ェ曲線の線分近似処理の原理を説明する。本実施形態で
は、3次ベジェ曲線を再帰的に分割していき、分割結果
のセグメント(このセグメントも3次ベジェ曲線であ
る)が所定の条件を満たす場合に当該セグメントを始点
及び終点を結ぶ線分に近似し、これにより描画しようと
する3次ベジェ曲線を複数の線分の連なりとして近似す
る。ここで、本実施形態では、上記線分近似の可否の判
定において、随時セグメントの形状を判定し、近似精度
の劣化を招く性質の悪い形状のセグメントは、分割を繰
り返すことにより性質の良い形状のセグメントに還元し
ていく。[Explanation of Principle] The principle of the line segment approximation process of the cubic Bezier curve in this embodiment will be described. In the present embodiment, a cubic Bezier curve is recursively divided, and when a segment resulting from the division (this segment is also a cubic Bezier curve) satisfies a predetermined condition, a line connecting the start point and the end point of the segment And a cubic Bezier curve to be drawn is approximated as a series of a plurality of line segments. Here, in the present embodiment, in determining whether or not the line segment approximation is possible, the shape of the segment is determined at any time, and a segment having a poor shape that causes deterioration in the approximation accuracy has a good shape by repeating the division. Return to segments.
【0036】性質の悪い形状には、突出形及び交叉形が
ある。突出形とは、図7(あるいは前述の図16)に示
すように、始点P0 、終点P3 及び2つの制御点P1 ,
P2で定義される3次ベジェ曲線P0 ・P1 ・P2 ・P3
において、始点P0 及び終点P3 にて線分P0 P3 に
対してそれぞれ垂線を引いた場合に、当該3次ベジェ曲
線の一部がその両垂線で挟まれる領域の外側にはみ出し
た状態をいう。突出形の3次ベジェ曲線は、いくら平坦
であっても、始点及び終点を結ぶ線分P0 P3で線分近
似すると、はみ出した部分が描画されないため実際より
も短く描画されてしまい、近似精度の点で問題となる。
また、交叉形とは、図8に示すように、3次ベジェ曲線
が、始点P0 及び終点P3 を結ぶ直線と交わる状態をい
う。このような交叉形の3次ベジェ曲線は、平坦でない
にもかかわらず線分近似を行ってしまうおそれがある。
なお、交叉形の定義はこれに限らず、始点P0 及び終点
P3 を結ぶ線分と2つの制御点を結ぶ直線とが交わるよ
うな場合を交叉形と定義してもよい。Shapes having poor properties include a protruding shape and a crossed shape. The projecting shape is, as shown in FIG. 7 (or FIG. 16 described above), a start point P0, an end point P3, and two control points P1,
Cubic Bezier curve P0, P1, P2, P3 defined by P2
In this case, when perpendicular lines are drawn to the line segment P0 P3 at the start point P0 and the end point P3, a part of the cubic Bézier curve protrudes outside the region sandwiched by both perpendicular lines. Regardless of how flat the protruding cubic Bezier curve is, if the line segment is approximated by the line segment P0 P3 connecting the starting point and the ending point, the protruding portion is not drawn because the protruding portion is not drawn, and the approximation accuracy This is a problem.
The term "intersecting" refers to a state in which the cubic Bezier curve intersects a straight line connecting the start point P0 and the end point P3, as shown in FIG. Such an intersecting cubic Bezier curve may be subjected to line segment approximation even though it is not flat.
The definition of the cross shape is not limited to this, and a case where a line segment connecting the start point P0 and the end point P3 intersects with a straight line connecting the two control points may be defined as a cross shape.
【0037】本実施形態では、このような突出形や交叉
形の3次ベジェ曲線は、分割を繰り返すことにより、図
9に示すような性質の良い標準形のセグメントの集まり
に還元してから線分近似の可否を判定する。In the present embodiment, such a protruding or intersecting cubic Bezier curve is reduced to a group of segments of the standard type having good properties as shown in FIG. It is determined whether minute approximation is possible.
【0038】標準形のセグメントに対する線分近似可否
の判定は、制御点P1 ,P2 の中点と、始点及び終点を
結ぶ線分P0 P3 との距離に基づき行う。すなわち、図
10に示すように、制御点P1 ,P2 の中点P12と線分
P0 P3 との距離d12が、予め定めた許容値δ以下であ
るか否かを判定し、許容値δ以下である場合に線分近似
を行う。ここで、許容値δとしては、例えば、曲線の描
画先であるビットマップデバイス(ラスタ出力デバイス
ともいう。ビットマップメモリや、ディスプレイ装置、
プリンタなどを含む)における1画素(1ドット)の幅
などを設定する。The determination of the approximation of the line segment with respect to the segment of the standard form is made based on the distance between the middle point between the control points P1 and P2 and the line segment P0 P3 connecting the start point and the end point. That is, as shown in FIG. 10, it is determined whether or not the distance d12 between the midpoint P12 of the control points P1 and P2 and the line segment P0 P3 is equal to or smaller than a predetermined allowable value δ. In some cases, line segment approximation is performed. Here, as the allowable value δ, for example, a bitmap device (also referred to as a raster output device, which is a drawing destination of a curve; a bitmap memory, a display device,
(Including a printer or the like).
【0039】標準形のセグメントは、始点P0 ,終点P
3 間から外側への突出がないので、始点終点を結ぶ線分
P0 P3 で近似しても問題がなく、また線分P0 P3 と
の交叉がないので、制御点P1 ,P2 の中点P12から始
点終点を結ぶ線分P0 P3 との距離で線分近似の可否を
判定しても、従来技術(c)のような誤判定(図18参
照)は起こさない。The segment of the standard form has a starting point P0 and an ending point P
Since there is no outward projection from between the three points, there is no problem even if approximated by the line segment P0 P3 connecting the start and end points, and there is no intersection with the line segment P0 P3. Even if the approximation of the line segment is determined based on the distance from the line segment P0 P3 connecting the start point and the end point, the erroneous determination (see FIG. 18) as in the prior art (c) does not occur.
【0040】次に、制御点P1 ,P2 の中点P12から始
点終点を結ぶ線分P0 P3 までの距離に基づき線分近似
の可否を判定することの妥当性について図10を用いて
説明する。Next, the validity of judging the possibility of line segment approximation based on the distance from the midpoint P12 of the control points P1 and P2 to the line segment P0 P3 connecting the start point and the end point will be described with reference to FIG.
【0041】3次ベジェ曲線は、始点、終点及び2つの
制御点から構成されるし凸領域(四角形)の内部からは
み出ることがないこと(凸閉包性)はよく知られている
が、更に標準形の3次ベジェ曲線では、当該曲線上のい
かなる点を選んでも、その点と線分P0 P3 との距離
が、制御点P1 ,P2 の中点P12から線分P0 P3 との
距離d12を超えることはない。その証明は以下の通りで
ある。It is well known that a cubic Bezier curve is composed of a starting point, an ending point and two control points and does not protrude from the inside of a convex area (square) (convex hullness). In the cubic Bezier curve, the distance between the point and the line segment P0 P3 exceeds the distance d12 from the midpoint P12 of the control points P1 and P2 to the line segment P0 P3 regardless of the point selected on the curve. Never. The proof is as follows.
【0042】標準形の3次ベジェ曲線では、制御点P1
,P2 が直線P03に対して同じ側にある。したがっ
て、図10において、前述の図14の場合と同様に各点
P01,P12,P23,P012 ,P123 ,P0123を定義する
と、それら各点はすべて直線P03に対して制御点P1 ,
P2 と同じ側にある。ここで、制御点P1 ,P2 と線分
P03との距離をそれぞれd1 ,d2 とすると、各点P0
1,P12,P23,P012 ,P123 ,P0123と線分P03と
距離は、d1 ,d2 を用いてそれぞれ次のように表すこ
とができる。In the standard cubic Bezier curve, the control point P1
, P2 are on the same side of the straight line P03. Therefore, in FIG. 10, when the points P01, P12, P23, P012, P123, and P0123 are defined in the same manner as in the case of FIG. 14 described above, these points are all controlled points P1, P2 with respect to the straight line P03.
On the same side as P2. Here, assuming that the distances between the control points P1 and P2 and the line segment P03 are d1 and d2, respectively, each point P0
1, P12, P23, P012, P123, P0123, the line segment P03 and the distance can be expressed as follows using d1 and d2, respectively.
【0043】[0043]
【数2】 d01=d1 /2 d12=(d1 +d2 )/2 d23=d2 /2 d012 =(d01+d12)/2=(2d1 +d2 )/4 d123 =(d12+d23)/2=(d1 +2d2 )/4 d0123=(d012 +d123 )/2=(3d1 +3d2 )
/8 これらの式から、各距離d01,d23,d012 ,d123 ,
d0123は、制御点P1,P2 の中点P12と線分P03との
距離d12以下である。別言すれば、点P12は、各点P0
1,P12,P23,P012 ,P123 ,P0123の中で、直線
P0 P3 から最も離れた点であるといえる。D01 = d1 / 2 d12 = (d1 + d2) / 2 d23 = d2 / 2 d012 = (d01 + d12) / 2 = (2d1 + d2) / 4 d123 = (d12 + d23) / 2 = (d1 + 2d2) / 4 d0123 = (d012 + d123) / 2 = (3d1 + 3d2)
/ 8 From these equations, the distances d01, d23, d012, d123,
d0123 is a distance d12 or less between the midpoint P12 of the control points P1 and P2 and the line segment P03. In other words, the point P12 is the point P0
It can be said that it is a point farthest from the straight line P0 P3 among 1, P12, P23, P012, P123, and P0123.
【0044】ここで、3次ベジェ曲線P0 ・P1 ・P2
・P3 が、形状を変えずに2つの3次ベジェ曲線P0 ・
P01・P012 ・P0123及びP0123・P123 ・P23・P3
に分割できることは既に説明した通りであり、これら3
次ベジェ曲線P0 ・P01・P012 ・P0123及びP0123・
P123 ・P23・P3 が、それぞれ4点P0 ,P01,P01
2 ,P0123で形成される凸包及び4点P0123,P123 ,
P23,P3 で形成される凸包の内部を通ることは、その
凸閉包性から保証される。したがって、元の3次ベジェ
曲線P0 ・P1 ・P2 ・P3 は、点P0 ,P01,P012
,P0123,P123 ,P23,P3 から形成される凸多角
形からはみ出ることはない。Here, the cubic Bezier curve P0.P1.P2
P3 is two cubic Bezier curves P0 without changing the shape
P01 ・ P012 ・ P0123 and P0123 ・ P123 ・ P23 ・ P3
As described above, it can be divided into
Next Bezier curves P0, P01, P012, P0123 and P0123
P123, P23, and P3 are four points P0, P01, and P01, respectively.
2, the convex hull formed by P0123 and the four points P0123, P123,
Passing through the inside of the convex hull formed by P23 and P3 is guaranteed by its convex hull property. Therefore, the original cubic Bezier curves P0, P1, P2, P3 are represented by points P0, P01, P012.
, P0123, P123, P23, and P3 do not protrude from the convex polygon.
【0045】これと、点P12が各点P01,P12,P23,
P012 ,P123 ,P0123のうちで直線P0 P3 からの最
遠点であるということとを考え合わせると、3次ベジェ
曲線P0 ・P1 ・P2 ・P3 のいかなる点を選んでも、
その点と直線P0 P3 との距離は、点P12と直線P0 P
3 との距離以下となる。したがって、点P12と直線P0
P3 との距離d12が所定の許容値δ以下であれば、3次
ベジェ曲線P0 ・P1・P2 ・P3 のいかなる点を選ん
でも、その点と直線P0 P3 との距離は許容値δ以下と
なる。In addition, the point P12 is divided into points P01, P12, P23,
Considering that it is the farthest point from the straight line P0 P3 among P012, P123, and P0123, any point of the cubic Bezier curve P0, P1, P2, P3 can be selected.
The distance between that point and the straight line P0 P3 is the point P12 and the straight line P0 P
3 or less. Therefore, the point P12 and the straight line P0
If the distance d12 to P3 is equal to or less than a predetermined allowable value δ, the distance between the point and the straight line P0 P3 is equal to or less than the allowable value δ, regardless of the point selected on the cubic Bezier curve P0. .
【0046】そもそも3次ベジェ曲線の線分近似は、3
次ベジェ曲線上のすべての点が始点終点を結ぶ線分P0
P3 から許容値δ(例えば1画素)以内にあれば、当該
曲線の定義式どおりに描画を行っても、描画結果として
は線分P0 P3 を描画するのと変わらないということを
根拠としている。標準形の3次ベジェ曲線においては、
前述のように、制御点P1 ,P2 の中点P12と線分P0
P3 との距離が許容値δ以下であれば、当該曲線のすべ
ての点が、線分P0 P3 からみて許容値δ以内の距離に
あることが保証されるので、上記線分近似の考え方から
して、このような場合に線分近似を行うことは妥当であ
るといえる。In the first place, the line segment approximation of the cubic Bezier curve is 3
Line P0 connecting all points on the next Bezier curve to the start point and end point
It is based on the fact that if the drawing is performed within the allowable value δ (for example, one pixel) from P3, the drawing result is the same as that of drawing the line segment P0 P3 even if drawing is performed according to the definition formula of the curve. In the standard cubic Bezier curve,
As described above, the midpoint P12 between the control points P1 and P2 and the line segment P0
If the distance to P3 is equal to or less than the allowable value δ, it is guaranteed that all points on the curve are within the allowable value δ when viewed from the line segment P0 P3. In such a case, it can be said that performing line segment approximation is appropriate.
【0047】このように、本実施形態によれば、3次ベ
ジェ曲線を突出や交叉のない標準形のセグメントまで分
割してから線分近似の可否を判定し、線分近似を行うの
で、近似精度の劣化を招くことがない。As described above, according to the present embodiment, the cubic Bézier curve is divided into segments of a standard form without protrusions and intersections, and it is determined whether or not line segment approximation is possible. There is no deterioration in accuracy.
【0048】[具体例の説明]上記原理による方法を具
体的に実現する本実施形態の装置構成及び処理手順につ
いて説明する。[Explanation of Specific Example] An apparatus configuration and a processing procedure of the present embodiment for specifically realizing the method according to the above principle will be described.
【0049】図1は、本実施形態に係るグラフィック描
画装置の概略構成を示す図である。図1は、描画指示が
PDL(ページ記述言語)の形で入力される場合の構成
を示している。FIG. 1 is a diagram showing a schematic configuration of a graphic drawing apparatus according to the present embodiment. FIG. 1 shows a configuration in which a drawing instruction is input in the form of a PDL (page description language).
【0050】図1において、PDL解釈部10は、入力
されるPDLデータを順番に解釈していく。ここで、P
DLデータが線分の描画を指示するものである場合は、
PDL解釈部10は、その線分のデータ(始点及び終点
の座標など)を直線描画部12に渡し、直線描画部12
は、このデータに基づき描画バッファ14内に線分を描
画する。In FIG. 1, a PDL interpreter 10 interprets input PDL data in order. Where P
If the DL data instructs the drawing of a line segment,
The PDL interpretation unit 10 passes the data of the line segment (the coordinates of the start point and the end point) to the straight line drawing unit 12 and
Draws a line segment in the drawing buffer 14 based on this data.
【0051】一方、PDLデータが3次ベジェ曲線の描
画を指示するものである場合は、PDL解釈部10は、
当該PDLデータから当該3次ベジェ曲線の始点、終点
及び2つの制御点の座標データを抽出し、これら4点の
座標データを曲線処理部16に渡す。曲線処理部16で
は、近似判定部18が、これら4点の座標データをもと
に、当該3次ベジェ曲線が線分近似可能であるかを判定
する。なお、この判定処理の詳細については後で詳しく
説明する。近似判定部18にて線分近似不可能と判定さ
れた場合は、当該3次ベジェ曲線を定義する前記4点の
データが、曲線分割部20に渡される。曲線分割部20
は、これら4点のデータに基づき、当該3次ベジェ曲線
を、2つの3次ベジェ曲線(セグメント)に分割する。
この分割の方法は、従来技術で説明した方法と同様でよ
い。曲線分割部20は、これら各セグメントを定義する
始点、終点及び制御点のデータをそれぞれ近似判定部1
8に返し、近似判定部18は、これらのデータに基づ
き、各セグメントについてそれぞれ線分近似の可否を判
定する。曲線処理部16では、セグメントが線分近似可
能と判定されるまで、以上の処理が再帰的に繰り返され
る。On the other hand, if the PDL data instructs the rendering of the cubic Bezier curve, the PDL interpreter 10
From the PDL data, the coordinate data of the start point and end point of the cubic Bezier curve and two control points are extracted, and the coordinate data of these four points is passed to the curve processing unit 16. In the curve processing unit 16, the approximation determination unit 18 determines whether the cubic Bezier curve can be approximated by a line segment based on the coordinate data of these four points. The details of this determination processing will be described later in detail. If the approximation determining unit 18 determines that the line segment cannot be approximated, the data of the four points defining the cubic Bezier curve is passed to the curve dividing unit 20. Curve division unit 20
Divides the cubic Bezier curve into two cubic Bezier curves (segments) based on the data of these four points.
This dividing method may be the same as the method described in the related art. The curve division unit 20 compares the data of the start point, the end point, and the control point defining each segment with the approximation determination unit 1.
8, the approximation determination unit 18 determines whether or not line segment approximation is possible for each segment based on these data. The curve processing unit 16 repeats the above processing recursively until it is determined that the segment can be approximated by a line segment.
【0052】近似判定部18は、セグメントが線分近似
可能と判定した場合は、当該セグメントの始点及び終点
の座標を当該セグメントの近似線分を表すデータとして
直線描画部12に渡す。すると、直線描画部12は、描
画バッファ14上に、それら始点及び終点を結ぶ線分を
描画する。このようにして、再帰的に分割された各セグ
メントが、始点及び終点を結ぶ線分で描画されることに
より、3次ベジェ曲線の線分近似による描画が完了す
る。When it is determined that the segment can be approximated by a line segment, the approximation determining unit 18 passes the coordinates of the start point and the end point of the segment to the straight line drawing unit 12 as data representing an approximate line segment of the segment. Then, the straight line drawing unit 12 draws a line segment connecting the start point and the end point on the drawing buffer 14. In this way, each recursively divided segment is drawn by the line segment connecting the start point and the end point, and the drawing by the line segment approximation of the cubic Bezier curve is completed.
【0053】次に、曲線処理部16の処理手順の詳細を
フローチャートを用いて説明する。 (1)全体説明 図2は、曲線処理部16の処理のおおまかな流れを示し
ている。図2において、曲線処理部16は、PDL解釈
部10より3次ベジェ曲線の定義データ(すなわち始点
P0 、終点P3 及び制御点P1 ,P2 の座標)を取得す
ると(S10)、まず、P0 =P1 =P2 =P3 となる
ケースやP0 =P3 となるケースなどの極めてまれな例
外ケースを排除する処理を行う(S20)。S20で
は、与えられた3次ベジェ曲線がこのような例外ケース
に当たるか否かを判定し、例外ケースに当たる場合は、
当該曲線を分割し、分割によって得られた各セグメント
について同じ判定を繰り返す。S20では、このような
判定及び分割の処理が再帰的に行われ、この再帰的処理
の各段階において例外ケースに当たらないセグメントが
得られた場合には、そのセグメントの定義データが次の
突出形排除処理(S30)のステップに渡される。Next, the processing procedure of the curve processing section 16 will be described in detail with reference to a flowchart. (1) General Description FIG. 2 shows a general flow of the processing of the curve processing unit 16. In FIG. 2, when the curve processing unit 16 acquires the definition data of the cubic Bezier curve (that is, the coordinates of the start point P0, the end point P3, and the control points P1, P2) from the PDL interpretation unit 10 (S10), first, P0 = P1. An extremely rare exceptional case such as the case where P = P2 = P3 or the case where P0 = P3 is eliminated (S20). In S20, it is determined whether or not the given cubic Bezier curve corresponds to such an exceptional case.
The curve is divided, and the same determination is repeated for each segment obtained by the division. In S20, such determination and division processing is performed recursively. If a segment that does not correspond to an exceptional case is obtained at each stage of the recursive processing, the definition data of the segment is changed to the next protruding form. It is passed to the step of exclusion processing (S30).
【0054】S30では、与えられたセグメントが図7
に示したような突出形であるか否かを判定し、突出形と
判定された場合には当該セグメントを分割し、分割結果
の各セグメントについて同様の処理を再帰的に繰り返
す。このような再帰的処理の各段階において突出形でな
いセグメントが得られると、そのセグメントの定義デー
タを次の交叉形排除処理(S40)のステップに渡す。At S30, the given segment is
It is determined whether or not it is a protruding shape as shown in (1). If the protruding shape is determined, the segment is divided, and the same processing is recursively repeated for each segment as a result of the division. When a segment that is not protruding is obtained at each stage of the recursive processing, the definition data of the segment is passed to the next cross-shaped exclusion processing (S40).
【0055】S40では、与えられたセグメントが図8
に示したような交叉形であるか否かを判定し、交叉形と
判定された場合には当該セグメントを分割し、分割結果
の各セグメントについて同様の処理を再帰的に繰り返
す。このような再帰的処理の各段階において交叉形でな
いセグメントが得られると、そのセグメントの定義デー
タを次の近似処理(S50)のステップに渡す。In S40, the given segment is
It is determined whether or not it is an intersecting shape as shown in (1). If the intersecting shape is determined, the segment is divided, and the same processing is recursively repeated for each segment as a result of the division. When a segment that does not intersect is obtained at each stage of such recursive processing, the definition data of the segment is passed to the next approximation processing (S50).
【0056】S50に渡されるセグメントは、S40ま
での処理の結果、図9に示すような標準形のセグメント
となっている。S50では、このような標準形のセグメ
ントについて、2制御点の中点P12とベースラインP0
P3 との距離に基づき線分近似の可否を判定し、線分近
似不可能と判定された場合には当該セグメントを分割
し、分割結果の各セグメントについて同様の処理を再帰
的に繰り返す。このような再帰的処理の各段階において
線分近似可能なセグメントが得られると、曲線処理部1
6は、このセグメントの始点及び終点の座標データを直
線描画部12に渡し、当該セグメントを始点及び終点を
結ぶ線分(ベースライン)として近似描画させる。この
ような処理により、描画対象の3次ベジェ曲線は最終的
に線分の連なりとして近似描画される。The segment passed to S50 is a standard segment as shown in FIG. 9 as a result of the processing up to S40. In S50, for such a segment of the standard form, the midpoint P12 of the two control points and the baseline P0
Whether or not line segment approximation is possible is determined based on the distance to P3. If it is determined that line segment approximation is not possible, the segment is divided, and the same processing is recursively repeated for each segment as a result of division. When a segment that can approximate a line segment is obtained at each stage of such recursive processing, the curve processing unit 1
6 passes the coordinate data of the start point and the end point of the segment to the straight line drawing unit 12, and approximately draws the segment as a line segment (base line) connecting the start point and the end point. By such processing, the cubic Bezier curve to be drawn is finally approximated as a series of line segments.
【0057】以下、例外排除処理(S20)、突出形排
除処理(S30)、交叉形排除処理(S40)、及び近
似処理(S50)のそれぞれについて、更に具体的な処
理手順を説明する。Hereinafter, a more specific processing procedure will be described for each of the exception exclusion processing (S20), the protruding shape exclusion processing (S30), the cross-shaped exclusion processing (S40), and the approximation processing (S50).
【0058】(2)例外排除処理 図3は、例外排除処理(S20)の具体的な手順を示す
フローチャートである。まず、例外排除処理では、近似
判定部18にて、対象である3次ベジェ曲線の始点P0
、終点P3 及び制御点P1 ,P2 の座標が一致する
か、すなわちP0 =P1 =P2 =P3 となるかを判定す
る(S202)。もし、この判定結果が真の場合、始点
P0 、終点P3 及び制御点P1 ,P2 が1点に縮退した
ことになり、このような場合は、例えばその1点を描画
して処理を終了する。S202の判定結果が偽の場合
は、近似判定部18にて、更にP0 =P3 となるか否か
を判定する(S204)。この判定結果が真の場合、対
象の3次ベジェ曲線は、図11に示すように、始点P0
と終点P3 とが一致した形状となる。このような場合、
始点P0 と終点P3 とは同一点となっているので、始点
終点を結ぶ線分はできず、線分近似には適さない。した
がって、この場合、対象の3次ベジェ曲線を曲線分割部
20にて2つのセグメントに分割し(S206)、それ
ら2つのセグメントのそれぞれについて、S202以下
の処理を繰り返す(S20−1,S20−2)。すなわ
ち、曲線分割部20は、分割によって得られた2つのセ
グメントのそれぞれの始点、終点、制御点のデータを近
似判定部18に返し、近似判定部18はこれら2つのセ
グメントそれぞれについてS202及びS204の判定
処理を行う。この場合、近似判定部18は、例えば第2
セグメントのデータをスタックして第1セグメントにつ
いての処理を先行して行い、第1セグメントについての
処理が終わったところで第2セグメントの処理を行えば
よい。なお、3次ベジェ曲線は、一般に1度分割すれば
始点と終点とが一致することはないので、この例外排除
処理において行われる分割の回数は高々1回である。こ
のようにして例外ケースでないと判定されたセグメント
は、次の突出形排除処理(S30)に進む。(2) Exception Exclusion Process FIG. 3 is a flowchart showing a specific procedure of the exception exclusion process (S20). First, in the exception elimination process, the approximation determination unit 18 starts the starting point P0 of the target cubic Bezier curve.
It is determined whether the coordinates of the end point P3 and the control points P1 and P2 match, that is, whether P0 = P1 = P2 = P3 (S202). If the determination result is true, the start point P0, the end point P3, and the control points P1 and P2 have been reduced to one point. In such a case, for example, the one point is drawn and the processing ends. If the determination result in S202 is false, the approximation determination unit 18 further determines whether P0 = P3 (S204). When the result of this determination is true, the target cubic Bezier curve has a starting point P0 as shown in FIG.
And the end point P3 match. In such a case,
Since the start point P0 and the end point P3 are the same point, a line segment connecting the start point and the end point cannot be formed, which is not suitable for line segment approximation. Therefore, in this case, the target cubic Bezier curve is divided into two segments by the curve dividing unit 20 (S206), and the processing from S202 onward is repeated for each of the two segments (S20-1, S20-2). ). That is, the curve division unit 20 returns the data of the start point, the end point, and the control point of each of the two segments obtained by the division to the approximation determination unit 18, and the approximation determination unit 18 performs the processing of S202 and S204 for each of these two segments. Perform determination processing. In this case, the approximation determination unit 18
The processing of the first segment may be performed in advance by stacking the segment data, and the processing of the second segment may be performed when the processing of the first segment is completed. In general, the cubic Bezier curve is divided once, so that the start point and the end point do not coincide with each other. Therefore, the number of divisions performed in the exception exclusion process is at most one. In this manner, the segment determined not to be an exception case proceeds to the next protruding shape elimination process (S30).
【0059】(3)突出形排除処理 図4は、この突出形排除処理の具体的な手順を示すもの
である。この突出形排除処理では、近似判定部18は、
まず処理対象であるセグメントの始点P0 から終点P3
へ向かうベクトルP0 P3 と、始点P0 から第1制御点
P1 へ向かうベクトルP0 P1 との内積を計算し(S3
02)、この内積が負であるか否かを判定する(S30
4)。この内積が負となる場合はベクトルP0 P3 とベ
クトルP0 P1 とのなす角が90°より大きいというこ
とになり、対象セグメントは図7に示すような突出形と
なる。(3) Projection-type exclusion processing FIG. 4 shows a specific procedure of the projection-type exclusion processing. In this protruding shape exclusion processing, the approximation determination unit 18
First, the start point P0 to the end point P3 of the segment to be processed
Product of the vector P0 P3 going to the first control point P1 from the starting point P0 is calculated (S3
02), it is determined whether or not the inner product is negative (S30).
4). If the inner product is negative, the angle between the vector P0 P3 and the vector P0 P1 is larger than 90 °, and the target segment has a protruding shape as shown in FIG.
【0060】一方、S304において内積が0以上と判
定された場合は、ベクトルP0 P3とベクトルP0 P1
とのなす角が90°以下なので、更に終点P3 から始点
P0へ向かうベクトルP3 P0 と、終点P3 から第2制
御点P2 へ向かうベクトルP3 P2 との内積を計算し
(S306)、この内積が負であるか否かを判定する
(S308)。この内積が負となる場合はベクトルP3
P0 とベクトルP3 P2とのなす角が90°より大きい
ということになり、対象セグメントは突出形となる。こ
の処理において、2つのベクトル(x1 ,y1 )及び
(x2 ,y2 )の内積は、(x1 x2 +y1 y2 )とい
う乗算と加算との簡単な組み合わせで求めることができ
るので、この突出形の判定処理は少ない演算回数で実行
することができる。On the other hand, if it is determined in S304 that the inner product is 0 or more, the vectors P0 P3 and P0 P1
Is less than 90 °, the inner product of the vector P3 P0 from the end point P3 to the start point P0 and the vector P3 P2 from the end point P3 to the second control point P2 is further calculated (S306). Is determined (S308). If this inner product is negative, the vector P3
This means that the angle between P0 and the vector P3 P2 is greater than 90 °, and the target segment has a protruding shape. In this processing, the inner product of the two vectors (x1, y1) and (x2, y2) can be obtained by a simple combination of multiplication and addition of (x1 x2 + y1 y2). Can be executed with a small number of operations.
【0061】S304又はS308のいずれかで判定結
果が真、すなわち対象セグメントが突出形と判定された
場合は、曲線分割部20にて当該セグメントを分割し、
分割結果の2つのセグメントそれぞれについて、S30
2以下の処理を再帰的に繰り返す(S30−1,S30
−2)。ここでも、近似判定部18は、例えばスタック
を利用してそれぞれのセグメントの処理を順に行う。If the result of the determination is true in either S304 or S308, that is, if the target segment is determined to be a protruding shape, the segment is divided by the curve dividing section 20, and
S30 for each of the two segments resulting from the division
2 is recursively repeated (S30-1, S30
-2). Also here, the approximation determination unit 18 sequentially performs processing of each segment using, for example, a stack.
【0062】このような再帰的処理の途中でS304及
びS308の判定結果が共に偽となった場合、当該セグ
メントは突出形でないということになり、当該セグメン
トは交叉形排除処理(S40)に進む。すなわち、この
突出形排除処理によれば、図7のような突出形のセグメ
ントは排除できるが、まだ図8に示すような交叉形のセ
グメントは残るので、次の交叉形排除処理ではこのよう
な交叉形を排除するための処理を行う。If the judgment results in S304 and S308 both become false during such a recursive process, the segment is not a protruding type, and the segment proceeds to the crossing type elimination process (S40). That is, according to this protruding type elimination processing, a protruding segment as shown in FIG. 7 can be eliminated, but a cross-shaped segment as shown in FIG. 8 still remains. Perform processing to eliminate the crossover.
【0063】(4)交叉形排除処理 図5は、この交叉形排除処理の具体的な手順を示したも
のである。この交叉形排除処理では、近似判定部18
は、まず処理対象のセグメントの始点P0 と終点P3 を
結ぶ直線P0 P3 と、第1制御点P1 と第2制御点P2
を結ぶ直線P1 P2 との交点の座標を計算する(S40
2)。これは、例えば、直線P0 P3 及び直線P1 P2
の式を求め、これらの連立方程式を解くことによって行
うことができる。そして、この交点が始点P0 と終点P
3 とを結ぶ線分P0 P3 上にくるかどうかを判定する
(S404)。例えば、直線P0 P3 及び直線P1 P2
の式をパラメータ表示形式で表せば、それら直線の式は
極めて簡単に求められ、その交点も簡単な行列演算で求
めることができ、更にその交点が線分P0 P3 上にある
か否かの判定も容易である。(4) Crossover Elimination Process FIG. 5 shows a specific procedure of the crossover exclusion process. In this cross-shaped exclusion processing, the approximation determination unit 18
First, a straight line P0 P3 connecting the start point P0 and the end point P3 of the segment to be processed, a first control point P1 and a second control point P2
Are calculated at the intersection with the straight line P1 P2 connecting
2). This is, for example, the straight line P0 P3 and the straight line P1 P2
, And solving these simultaneous equations. And this intersection is the starting point P0 and the ending point P
Then, it is determined whether or not the line segment is located on the line segment P0 P3 connecting to the line 3 (S404). For example, a straight line P0 P3 and a straight line P1 P2
Is expressed in a parameter display format, the equations of these straight lines can be obtained very easily, and their intersections can also be obtained by simple matrix calculation. Further, it is determined whether or not the intersection is on the line segment P0 P3. Is also easy.
【0064】S404の判定結果が偽の場合、すなわ
ち、直線P0 P3 及び直線P1 P2 が線分P0 P3 の外
側にくるような場合は、当該セグメントが突出形でない
以上、制御点P1 ,P2 は直線P0 P3 から見て同じ側
にあることが保証される。したがって、この場合、当該
セグメントは交叉形ではなく、図9に示すような標準形
であることがわかり、次の近似処理(S50)に進む。
なお、直線P0 P3 と直線P1 P2 との交点がない場
合、すなわち両直線が平行である場合には、制御点P1
,P2 は直線P0 P3 から見て同じ側にあることが保
証されるので、この場合も当該セグメントは交叉形でな
い(すなわち標準形である)と判定し、近似処理(S5
0)に進む。If the result of the determination in S404 is false, that is, if the straight lines P0 P3 and P1 P2 are outside the line segment P0 P3, the control points P1 and P2 are set to straight lines as long as the segment is not protruding. It is guaranteed to be on the same side as viewed from P0 P3. Therefore, in this case, it is found that the segment is not the crossed one but the standard one as shown in FIG. 9, and the process proceeds to the next approximation processing (S50).
If there is no intersection between the straight line P0 P3 and the straight line P1 P2, that is, if both straight lines are parallel, the control point P1
, P2 are guaranteed to be on the same side as viewed from the straight line P0 P3. In this case as well, it is determined that the segment is not a crossing (that is, a standard), and the approximation processing (S5) is performed.
Go to 0).
【0065】さらに言えば、図8に示すような場合だけ
でなく、図12に示すような場合でもS404の判定結
果が真となるので、S404によれば、始点P0 、制御
点P1 ,P2 及び終点P3 が図12のような凹四角形を
形成するような場合も排除することができる。したがっ
て、近似処理(S50)に進むセグメントは、始点P0
、制御点P1 ,P2 及び終点P3 が図9に示すような
凸四角形を形成する場合に限られる。Further, not only in the case shown in FIG. 8 but also in the case shown in FIG. 12, the determination result of S404 is true, so according to S404, the starting point P0, the control points P1, P2 and The case where the end point P3 forms a concave square as shown in FIG. 12 can also be eliminated. Therefore, the segment that proceeds to the approximation processing (S50) is the start point P0
, And the control points P1, P2 and the end point P3 form a convex square as shown in FIG.
【0066】さて、S404の判定結果が真となる場
合、当該セグメントは交叉形であると判断される。ここ
で、交叉形の3次ベジェ曲線は、一般的には何回か分割
すれば非交叉形の3次ベジェ曲線の組合せに分けられる
が、いくら分割しても一方に交叉形が残り、無限ループ
に陥るようなケースも最悪のケースとして考えられる。
そこで、本実施形態では、このような無限ループを回避
するために、セグメントが交叉形と判定された場合は、
当該セグメントについて前述の従来技術(a)と同様の
判定処理を行い、可能な場合は交叉形の段階で線分近似
を行ってしまう。すなわち、図13を参照して説明する
と、近似判定部18は、まずベースラインP0 P3 と第
1制御点P1 との距離d1 を求め(S406)、この距
離d1 を所定の許容値δと比較する(S408)。ここ
で、距離d1 は、周知の点と直線の距離の公式によって
求めることができる。そして、距離d1 が許容値δより
大きい場合は線分近似不可能と判定し、当該セグメント
を曲線分割部20で2つに分割し、分割結果の各セグメ
ントに対してS402以下の処理を再帰的に適用する
(S40−1,S40−2)。一方、S408にて距離
d1 が許容値δ以下と判定された場合は、更にベースラ
インP0 P3 と第2制御点P2 との距離d2 を求め(S
410)、この距離d2 を所定の許容値δと比較する
(S412)。そして、距離d2 が許容値δより大きい
場合は、当該セグメントを2つに分割し、分割結果に対
してS402以下の処理を再帰的に適用する(S40−
1,S40−2)。S412の判定結果が真の場合、す
なわちd1 ,d2 が共に許容値δ以下の場合は、当該セ
グメントは平坦であると判定し、当該セグメントをベー
スラインP0 P3 で近似する。すなわち、近似判定部1
8は、当該セグメントの始点P0 及び終点P3 の座標を
直線描画部12に渡し、線分P0 P3 を描画させる(S
414)。When the result of the determination in S404 is true, it is determined that the segment is a cross. Here, an intersecting cubic Bezier curve is generally divided into a combination of non-intersecting cubic Bezier curves by dividing the curve several times. The worst case is considered to fall into a loop.
Therefore, in the present embodiment, in order to avoid such an infinite loop, when the segment is determined to have an intersecting shape,
The same determination processing as in the above-described conventional technique (a) is performed on the segment, and if possible, the line segment is approximated at the stage of the crossing. That is, referring to FIG. 13, the approximation determining unit 18 first obtains a distance d1 between the baseline P0 P3 and the first control point P1 (S406), and compares this distance d1 with a predetermined allowable value δ. (S408). Here, the distance d1 can be obtained by a known distance formula between a point and a straight line. If the distance d1 is larger than the allowable value δ, it is determined that the line segment cannot be approximated, the segment is divided into two by the curve dividing unit 20, and the processing of S402 and subsequent steps is performed recursively on each segment as a result of division. (S40-1, S40-2). On the other hand, if it is determined in step S408 that the distance d1 is equal to or smaller than the allowable value δ, the distance d2 between the baseline P0 P3 and the second control point P2 is further obtained (step S408).
410), and compares this distance d2 with a predetermined allowable value δ (S412). If the distance d2 is larger than the allowable value δ, the segment is divided into two, and the processing after S402 is recursively applied to the division result (S40-
1, S40-2). If the determination result in S412 is true, that is, if both d1 and d2 are equal to or smaller than the allowable value δ, the segment is determined to be flat, and the segment is approximated by the baseline P0 P3. That is, the approximation determination unit 1
8 passes the coordinates of the start point P0 and the end point P3 of the segment to the straight line drawing unit 12 to draw the line segment P0 P3 (S
414).
【0067】このような処理により、交叉形であっても
十分平坦な場合には線分近似がなされるので、無限ルー
プに陥ることを回避することができる。By such a process, even if the crossing is made, if the line is sufficiently flat, the line segment is approximated, so that it is possible to avoid falling into an infinite loop.
【0068】なお、このS406〜S414までのステ
ップは、処理が無限ループを回避するために設けられた
ものであり、対象とする3次ベジェ曲線がこのような無
限ループに陥るおそれのない性質の良いものであれば、
これらステップは省略しても良い。すなわち、この場合
は、S404で交叉形と判定されるとすぐに当該セグメ
ントを分割し(S416)、各セグメントについてそれ
ぞれ交叉形排除処理を再帰的に適用すればよい。The steps from S406 to S414 are provided in order to avoid the infinite loop in the processing, and have the property that the target cubic Bezier curve does not fall into such an infinite loop. If it ’s good,
These steps may be omitted. That is, in this case, the segment is divided as soon as it is determined to be the cross shape in S404 (S416), and the cross shape elimination process may be applied recursively to each segment.
【0069】また、以上では、d1 及びd2 (図13参
照)が共に許容値δ以下の場合に線分近似可能と判定し
たが、この判定基準の変わりに、d1 +d2 が許容値δ
以下になることを線分近似できる基準としてもよい。In the above description, it is determined that the line segment can be approximated when both d1 and d2 (see FIG. 13) are equal to or smaller than the allowable value δ. However, instead of this criterion, d1 + d2 is changed to the allowable value δ.
The following may be used as a criterion for approximating a line segment.
【0070】(5)近似処理 さて、S404の判定が偽となったセグメント(すなわ
ち標準形のセグメント)については、図6に示すような
手順の処理が行われる。(5) Approximation Processing For the segment for which the determination in S404 is false (that is, the segment of the standard form), the processing of the procedure shown in FIG. 6 is performed.
【0071】すなわち、近似判定部18は、制御点P1
,P2 の中点P12とベースラインP0 P3 との距離d1
2(図10参照)を計算し(S502)、この距離d12
と許容値δと比較する(S504)。この距離d12も周
知の点と直線との距離の公式から求めることができる。
そして、距離d12が許容値δよりも大きい場合は、近似
不可能と判断し、曲線分割部20で当該セグメントを2
つに分割する。ここで、この近似処理の対象となるセグ
メントは、前述したように、始点P0 、制御点P1 ,P
2 及び終点P3 が図9に示すような凸四角形を形成する
凸形の3次ベジェ曲線である。したがって、このような
セグメントを2つに分割した結果も、同様の凸形3次ベ
ジェ曲線となる。よって、分割結果の各セグメントも標
準形であることが保証されるので、各分割結果について
は、S502以下の処理を再帰的に適用すればよい(S
50−1,S50−2)。That is, the approximation determining unit 18 determines whether the control point P1
, P2 the distance d1 between the midpoint P12 and the baseline P0 P3
2 (see FIG. 10) (S502), and this distance d12 is calculated.
Is compared with the allowable value δ (S504). This distance d12 can also be obtained from a formula for the distance between a known point and a straight line.
If the distance d12 is larger than the allowable value δ, it is determined that the approximation is impossible, and
Divide into two. Here, the segment to be subjected to the approximation processing includes the start point P0, the control points P1, P2
2 and the end point P3 are convex cubic Bezier curves forming a convex square as shown in FIG. Therefore, the result of dividing such a segment into two is a similar convex cubic Bezier curve. Therefore, since each segment of the division result is also guaranteed to be in the standard form, the processing of S502 and subsequent steps may be applied recursively to each division result (S
50-1, S50-2).
【0072】そして、S504にて、距離d12が許容値
δ以下と判定された場合には、当該セグメントは平坦で
あると判定し、当該セグメントをベースラインP0 P3
で近似する。すなわち、近似判定部18は、当該セグメ
ントの始点P0 及び終点P3の座標を直線描画部12に
渡し、線分P0 P3 を描画させる(S508)。If it is determined in step S504 that the distance d12 is equal to or less than the allowable value δ, the segment is determined to be flat, and the segment is determined to be the baseline P0 P3.
Approximation. That is, the approximation determination unit 18 passes the coordinates of the start point P0 and the end point P3 of the segment to the straight line drawing unit 12, and draws the line segment P0 P3 (S508).
【0073】このように、近似処理(S50)において
再帰的にセグメント分割を行っていけば、各セグメント
はいずれ必ず線分近似可能となり、最初に与えられた3
次ベジェ曲線は、最終的に線分の連なりとして近似され
る。As described above, if the segment is recursively divided in the approximation processing (S50), each segment can be approximated by a line segment without fail.
The next Bezier curve is finally approximated as a series of line segments.
【0074】なお、原理説明の欄で示した制御点P1 ,
P2 の中点P12の性質(すなわちベースラインP0 P3
からの距離がセグメント上のいかなる点よりも大きいと
いう性質)は、始点P0 、制御点P1 ,P2 及び終点P
3 が図12に示すような凹四角形を形成する場合にも成
り立つので、交叉形排除処理においてこのようなセグメ
ントを排除する必要は必ずしもない。ただし、図12に
示すようなケースでは、近似処理のS506において当
該セグメントを分割すると、分割結果に交叉形が現れる
可能性もあるので、この場合は分割結果の各セグメント
について交叉形排除処理に戻って処理を行う必要があ
る。The control points P 1, P 1,
Properties of the midpoint P12 of P2 (ie, baseline P0 P3
(The property that the distance from the point is greater than any point on the segment) is the start point P0, the control points P1, P2, and the end point P
Since 3 also holds when a concave quadrangle as shown in FIG. 12 is formed, it is not always necessary to eliminate such segments in the cross-shaped exclusion processing. However, in the case as shown in FIG. 12, if the relevant segment is divided in S506 of the approximation processing, there is a possibility that a crossed form will appear in the divided result. In this case, the process returns to the crossed form elimination processing for each segment of the divided result. Must be processed.
【0075】以上説明したように、この近似処理では、
制御点P1 ,P2 の中点P12とベースラインP0 P3 と
の距離だけから線分近似の可否を判定する。点と直線と
の距離の演算は比較的複雑な計算であり、例えば従来技
術(a)では各セグメント後とにこのような複雑な演算
を2回行う必要があったが、本実施形態では、そのよう
な複雑な計算が1回だけで済む。また、本実施形態で
は、いったんセグメントを標準形(凸形)まで分割すれ
ば(すなわちS50に移行すれば)、そのセグメントを
それ以降いくら分割しても分割結果は標準形となるの
で、演算処理量の少ないS50の判定を繰り返すだけで
よい。通常作成される3次ベジェ曲線はこのような標準
形が多いことを考えれば、この本実施形態は演算処理量
の低減効果が極めて大きいといえる。As described above, in this approximation processing,
Whether or not line segment approximation is possible is determined only from the distance between the midpoint P12 of the control points P1 and P2 and the baseline P0 P3. The calculation of the distance between a point and a straight line is a relatively complicated calculation. For example, in the prior art (a), such a complicated calculation had to be performed twice after each segment, but in the present embodiment, Only one such complicated calculation is required. Further, in this embodiment, once the segment is divided into the standard form (convex) (that is, if the process proceeds to S50), the division result becomes the standard form no matter how much the segment is divided thereafter. It is only necessary to repeat the determination of S50 with a small amount. Considering that many cubic Bezier curves that are usually created have such a standard form, it can be said that this embodiment has an extremely large effect of reducing the amount of arithmetic processing.
【0076】以上、本発明の好適な実施形態について説
明した。以上説明したように、本実施形態によれば、3
次ベジェ曲線を標準形のセグメントまで分割して線分近
似可否の判定を行うことにより誤判定あるいは近似精度
の劣化を防ぐことができ、更に近似の処理に要する時間
も大幅に短縮することができる。The preferred embodiment of the present invention has been described above. As described above, according to the present embodiment, 3
By dividing the next Bezier curve into segments of the standard form and determining whether or not the line segment can be approximated, erroneous determination or deterioration of approximation accuracy can be prevented, and the time required for approximation processing can be significantly reduced. .
【0077】本実施形態は、コンピュータシステムにお
いて、上述の各処理を記述したプログラムをメモリ上に
ロードし、CPUにてそのプログラムを実行することに
より実現することができる。このようなプログラムは、
記録媒体に記録された状態で提供される。記録媒体とし
ては、例えばフレキシブルディスク、CD−ROM、メ
モリカードなどを用いることができる。記録媒体に記録
されたプログラムは、コンピュータシステムに組み込ま
れている記憶装置、例えばハードディスク装置にインス
トールされることにより、このプログラムを実行して本
実施形態に示した各処理を実現する装置の構築に寄与す
る。また、上記各処理を論理回路化し、ハードウエア的
に本実施形態を実現することも可能である。This embodiment can be realized in a computer system by loading a program describing each of the above-described processes into a memory and executing the program by a CPU. Such programs are:
It is provided in a state recorded on a recording medium. As the recording medium, for example, a flexible disk, a CD-ROM, a memory card, or the like can be used. The program recorded in the recording medium is installed in a storage device incorporated in the computer system, for example, a hard disk device, to execute the program to implement an apparatus that realizes each processing described in the present embodiment. Contribute. In addition, it is also possible to realize each of the above-described processes as a logic circuit and implement the present embodiment in hardware.
【0078】なお、上記実施形態においては、3次ベジ
ェ曲線を線分の連なりとして近似描画する処理を例にと
って説明したが、本発明の利用はこれに限られるもので
はない。本発明は、輪郭の少なくとも一部に3次ベジェ
曲線を有する領域の塗りつぶしや、点がそのような領域
の内部にあるかどうかの判定(内部性判定)、あるいは
そのような2つの領域の積の演算処理など、3次ベジェ
曲線を含んだ図形に関する様々な処理の前処理として利
用することができる。In the above embodiment, the process of approximating a cubic Bezier curve as a series of line segments has been described as an example, but the present invention is not limited to this. The present invention provides a method for filling a region having a cubic Bezier curve in at least a part of a contour, determining whether a point is inside such a region (internality determination), or multiplying such two regions. Can be used as a pre-process of various processes related to a graphic including a cubic Bezier curve, such as the calculation process of.
【0079】また、本発明において、突出形排除処理や
交叉形排除処理における突出形や交叉形の判定基準は、
上記具体例で述べたものに限られない。また、突出形排
除処理及び交叉形排除処理の適用順序は上記具体例と逆
にしてもよい。ただし、処理速度の観点からすれば、上
記具体例の順序のほうが望ましい。In the present invention, the criterion for judging the protruding shape or the cross shape in the protruding shape exclusion process or the cross shape exclusion process is
The invention is not limited to those described in the above specific examples. Further, the order of application of the protruding shape elimination process and the cross-shaped exclusion process may be reversed from that in the above specific example. However, from the viewpoint of processing speed, the order of the above specific example is more desirable.
【0080】[0080]
【発明の効果】以上説明したように、本発明によれば、
3次ベジェ曲線が突出形や交叉形などのような誤判定の
要因となる性質を持つ形状である場合は、更に分割を繰
り返し、性質の良い標準形であると判定された場合にそ
の平坦性を検査して線分近似を行うため、近似精度の劣
化を防止することができる。さらに、平坦性の判定基準
を、3次ベジェ曲線(セグメント)の2つの制御点の中
点とベースラインとの距離とが所定の許容値以下である
こととしたことにより、平坦性判定のための演算処理の
量を低減することができる。As described above, according to the present invention,
If the cubic Bezier curve has a shape that causes misjudgment, such as a protruding shape or a crossed shape, the division is further repeated. To perform line segment approximation, it is possible to prevent approximation accuracy from deteriorating. Further, the flatness determination criterion is that the distance between the midpoint of the two control points of the cubic Bezier curve (segment) and the baseline is equal to or less than a predetermined allowable value, and thus the flatness determination is performed. Can be reduced.
【図1】 本発明の実施形態に係るグラフィック描画装
置の概略構成を示す図である。FIG. 1 is a diagram showing a schematic configuration of a graphic drawing apparatus according to an embodiment of the present invention.
【図2】 実施形態における3次ベジェ曲線の線分近似
方法の全体的な流れを示すフローチャートである。FIG. 2 is a flowchart showing an overall flow of a method for approximating a cubic Bezier curve in the embodiment.
【図3】 例外排除処理の具体的な手順を示すフローチ
ャートである。FIG. 3 is a flowchart showing a specific procedure of an exception exclusion process.
【図4】 突出形排除処理の具体的な手順を示すフロー
チャートである。FIG. 4 is a flowchart showing a specific procedure of a protruding shape exclusion process.
【図5】 交叉形排除処理の具体的な手順を示すフロー
チャートである。FIG. 5 is a flowchart showing a specific procedure of crossover exclusion processing.
【図6】 近似処理の具体的な手順を示すフローチャー
トである。FIG. 6 is a flowchart illustrating a specific procedure of an approximation process.
【図7】 突出形の3次ベジェ曲線の一例を示す図であ
る。FIG. 7 is a diagram illustrating an example of a protruding cubic Bezier curve.
【図8】 交叉形の3次ベジェ曲線の一例を示す図であ
る。FIG. 8 is a diagram illustrating an example of an intersecting cubic Bezier curve.
【図9】 標準形の3次ベジェ曲線の一例を示す図であ
る。FIG. 9 is a diagram showing an example of a standard cubic Bezier curve.
【図10】 本発明における3次ベジェ曲線の平坦性の
判定基準の説明のための図である。FIG. 10 is a diagram for describing a criterion for determining the flatness of a cubic Bezier curve according to the present invention.
【図11】 始点と終点とが一致する3次ベジェ曲線の
一例を示す図である。FIG. 11 is a diagram illustrating an example of a cubic Bezier curve in which a start point and an end point match.
【図12】 交叉形排除処理で排除される3次ベジェ曲
線の1類型の始点、終点及び制御点を示す図である。FIG. 12 is a diagram showing a start point, an end point, and a control point of one type of a cubic Bezier curve eliminated by the cross-shaped exclusion process.
【図13】 交叉形の3次ベジェ曲線の線分近似の可否
判定方法を説明するための図である。FIG. 13 is a diagram for explaining a method for determining whether or not line segment approximation of an intersecting cubic Bezier curve is possible.
【図14】 3次ベジェ曲線の分割方法の説明のための
図である。FIG. 14 is a diagram for explaining a method of dividing a cubic Bezier curve.
【図15】 従来技術(a)における3次ベジェ曲線の
線分近似の判定基準を説明するための図である。FIG. 15 is a diagram for explaining a determination criterion for approximation of a line segment of a cubic Bezier curve in the related art (a).
【図16】 従来技術(a)の判定基準の問題点を説明
するための図である。FIG. 16 is a diagram for explaining a problem of a criterion in the conventional technique (a).
【図17】 従来技術(b)の判定基準の問題点を説明
するための図である。FIG. 17 is a diagram for explaining a problem of a criterion of the conventional technique (b).
【図18】 従来技術(c)の判定基準の問題点を説明
するための図である。FIG. 18 is a diagram for explaining a problem of a criterion in the conventional technique (c).
【図19】 従来技術(d)の判定基準の問題点を説明
するための図である。FIG. 19 is a diagram for explaining a problem of a criterion of the conventional technique (d).
【図20】 従来技術(e)の判定基準の問題点を説明
するための図である。FIG. 20 is a diagram for explaining a problem of a criterion in the conventional technique (e).
10 PDL解釈部、12 直線描画部、14 描画バ
ッファ、16 曲線処理部、18 近似判定部、20
曲線分割部。10 PDL interpretation unit, 12 straight line drawing unit, 14 drawing buffer, 16 curve processing unit, 18 approximation determination unit, 20
Curve division.
Claims (7)
た3次ベジェ曲線を再帰的に分割し、分割後の各セグメ
ントが平坦であると判定された時点で分割を停止し、平
坦と判定されたセグメントの始点及び終点の座標データ
を当該セグメントの近似線分データとして生成すること
により、与えられた3次ベジェ曲線を近似する一連の近
似線分データを生成する3次ベジェ曲線の線分近似方法
において、 分割によって得られたセグメントが、当該セグメントの
始点又は終点の外側にはみ出した突出形及び当該セグメ
ントの始点及び終点を結ぶ線分と交わる交叉形のいずれ
でもない標準形の3次ベジェ曲線であると判定された場
合に、当該セグメントの厚さに関する代表値を予め設定
された許容値と比較し、前記代表値が前記許容値より小
さい場合に前記セグメントが平坦であると判定すること
を特徴とする3次ベジェ曲線の線分近似方法。1. A cubic Bezier curve defined by a start point, an end point and two control points is recursively divided, and when each of the divided segments is determined to be flat, the division is stopped. A line of a cubic Bezier curve that generates a series of approximate line segment data that approximates a given cubic Bezier curve by generating coordinate data of the determined start point and end point of the segment as approximate line segment data of the segment. In the minute approximation method, the segment obtained by the division is a standard form that is neither a protruding shape protruding outside the start point or end point of the segment nor a crossed shape intersecting a line segment connecting the start point and end point of the segment. If it is determined that the segment is a Bezier curve, the representative value related to the thickness of the segment is compared with a preset allowable value, and if the representative value is smaller than the allowable value, Line approximation method of a cubic Bezier curve, characterized in that said segments are determined to be flat.
トの2つの制御点の中点と、前記セグメントの始点及び
終点を結ぶ線分との距離であることを特徴とする3次ベ
ジェ曲線の線分近似方法。2. The method according to claim 1, wherein the representative value relating to the thickness of the segment is a distance between a midpoint between two control points of the segment and a line segment connecting a start point and an end point of the segment. A line approximation method for a cubic Bezier curve.
で定義される3次ベジェ曲線を再帰的に分割する第1ス
テップであって、分割結果の3次ベジェ曲線が、当該3
次ベジェ曲線の始点、第1制御点、第2制御点、及び終
点をこの順に結んで得られる四角形が凸四角形となる標
準形の3次ベジェ曲線になるまで分割を繰り返す第1ス
テップと、 第1ステップによって得られた標準形の3次ベジェ曲線
に対し、当該曲線の2つの制御点の中点と始点及び終点
を結ぶ線分との距離を求め、この距離が所定の許容値以
下の場合は当該曲線の前記始点及び終点の座標データを
当該曲線の近似線分データとして生成し、前記距離が許
容値以下でない場合は当該曲線を2つの3次ベジェ曲線
に分割する第2ステップと、 を含み、第2ステップによって標準形の3次ベジェ曲線
が分割された場合に、分割結果の3次ベジェ曲線につい
て前記第2ステップを繰り返し適用することにより、与
えられた3次ベジェ曲線を近似する一連の近似線分デー
タを生成することを特徴とする3次ベジェ曲線の線分近
似方法。3. A first step of recursively dividing a cubic Bezier curve defined by a start point, a first control point, a second control point, and an end point, wherein the cubic Bezier curve obtained as a result of the division is the three-dimensional Bezier curve.
A first step of repeating division until a quadrangle obtained by connecting the start point, the first control point, the second control point, and the end point of the next Bezier curve in this order becomes a standard cubic Bezier curve that is a convex quadrangle; For the standard cubic Bezier curve obtained in one step, the distance between the middle point of the two control points of the curve and the line segment connecting the start point and the end point is obtained, and this distance is equal to or less than a predetermined allowable value. Generating the coordinate data of the start point and the end point of the curve as approximate line segment data of the curve, and dividing the curve into two cubic Bezier curves if the distance is not smaller than the allowable value; In the case where the standard form cubic Bezier curve is divided by the second step, the given cubic Bezier curve is approximated by repeatedly applying the second step to the divided cubic Bezier curve. Series approximation line approximation method of a cubic Bezier curve and generates a line segment data that.
出した突出形か否かを判定し、突出形と判定された場合
は当該3次ベジェ曲線を2つの3次ベジェ曲線に分割
し、分割結果の3次ベジェ曲線が突出形でないと判定さ
れるまで分割処理を再帰的に繰り返す突出形排除ステッ
プと、 与えられた3次ベジェ曲線が、当該3次ベジェ曲線の始
点及び終点を結ぶ線分と2つの制御点を結ぶ直線とが交
わる交叉形か否かを判定し、交叉形と判定された場合は
当該3次ベジェ曲線を2つの3次ベジェ曲線に分割し、
分割結果の3次ベジェ曲線が交叉形でないと判定される
まで分割処理を再帰的に繰り返す交叉形排除ステップ
と、 を所定の順序で適用することを特徴とする3次ベジェ曲
線の線分近似方法。4. The method according to claim 3, wherein in the first step, it is determined whether or not the given cubic Bezier curve has a protruding shape protruding outside a start point or an end point, and is determined to be a protruding shape. In the case, a protruding shape eliminating step of dividing the cubic Bezier curve into two cubic Bezier curves and recursively repeating the dividing process until it is determined that the resulting cubic Bezier curve is not a protruding shape, It is determined whether or not the cubic Bezier curve is an intersecting shape in which a line segment connecting the starting point and the end point of the cubic Bezier curve intersects with a straight line connecting the two control points. Divide the Bezier curve into two cubic Bezier curves,
A crossover rejection step of recursively repeating the dividing process until it is determined that the cubic Bezier curve resulting from the division is not a crossover, and applying in a predetermined order: .
は、始点及び終点を結ぶベクトルと始点及び第1制御点
を結ぶベクトルとの内積、及び始点及び終点を結ぶベク
トルと第2制御点及び終点を結ぶベクトルとの内積に基
づき行うことを特徴とする3次ベジェ曲線の線分近似方
法。5. The method according to claim 4, wherein the determination as to whether or not the object is a protruding shape in the protruding shape eliminating step includes an inner product of a vector connecting the starting point and the ending point and a vector connecting the starting point and the first control point, and the starting point. And a vector connecting the end point and a vector connecting the second control point and the end point.
叉形と判定された場合に、更に所定の判定基準に従って
当該3次ベジェ曲線が線分近似可能か否かを判定し、線
分近似可能と判定された場合は線分近似を行って当該3
次ベジェ曲線についての分割を停止し、線分近似不可能
と判定された場合にのみ当該3次ベジェ曲線を2つの3
次ベジェ曲線に分割することを特徴とする3次ベジェ曲
線の線分近似方法。6. The method according to claim 4, wherein when the cubic Bezier curve is determined to be a cross shape in the crossing elimination step, the cubic Bezier curve can be approximated to a line segment according to a predetermined criterion. And if it is determined that the line segment can be approximated, a line segment approximation is performed to
The division of the second-order Bezier curve is stopped, and the cubic Bezier curve is divided into two
A line approximation method for a cubic Bezier curve, which is divided into a second-order Bezier curve.
で定義される3次ベジェ曲線を再帰的に分割する第1ス
テップであって、分割結果の3次ベジェ曲線が、当該3
次ベジェ曲線の始点、第1制御点、第2制御点、及び終
点をこの順に結んで得られる四角形が凸四角形となる標
準形の3次ベジェ曲線になるまで分割を繰り返す第1ス
テップと、 第1ステップによって得られた標準形の3次ベジェ曲線
に対し、当該曲線の2つの制御点の中点と始点及び終点
を結ぶ線分との距離を求め、この距離が所定の許容値以
下の場合は当該曲線の前記始点及び終点の座標データを
当該曲線の近似線分データとして生成し、前記曲線が許
容値以下でない場合は当該曲線を2つの3次ベジェ曲線
に分割する第2ステップと、 第2ステップによって標準形の3次ベジェ曲線が分割さ
れた場合に、分割結果の3次ベジェ曲線について前記第
2ステップを繰り返し適用する第3ステップと、 をコンピュータに実行させるためのプログラムを記録し
た記録媒体。7. A first step of recursively dividing a cubic Bezier curve defined by a start point, a first control point, a second control point, and an end point.
A first step of repeating division until a quadrangle obtained by connecting the start point, the first control point, the second control point, and the end point of the next Bezier curve in this order becomes a standard cubic Bezier curve that becomes a convex quadrangle; For the standard cubic Bezier curve obtained in one step, the distance between the middle point of the two control points of the curve and the line segment connecting the start point and the end point is obtained, and this distance is equal to or less than a predetermined allowable value. Generating coordinate data of the start point and the end point of the curve as approximate line segment data of the curve, and dividing the curve into two cubic Bezier curves if the curve is not smaller than an allowable value; When the standard form cubic Bezier curve is divided by the two steps, a third step of repeatedly applying the second step to the cubic Bezier curve resulting from the division. Recording medium recording a gram.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP86097A JPH10198811A (en) | 1997-01-07 | 1997-01-07 | Line segment approximating method for tertiary bezier curve |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP86097A JPH10198811A (en) | 1997-01-07 | 1997-01-07 | Line segment approximating method for tertiary bezier curve |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH10198811A true JPH10198811A (en) | 1998-07-31 |
Family
ID=11485428
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP86097A Pending JPH10198811A (en) | 1997-01-07 | 1997-01-07 | Line segment approximating method for tertiary bezier curve |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH10198811A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2008143268A1 (en) * | 2007-05-15 | 2008-11-27 | Sony Corporation | Registering device, checking device, program, and data structure |
JP2011186801A (en) * | 2010-03-09 | 2011-09-22 | Fuji Xerox Co Ltd | Image processing device and image processing program |
CN112699512A (en) * | 2021-01-14 | 2021-04-23 | 四川交投建设工程股份有限公司 | Stress midpoint calculation method for multi-line segment asymmetric curve tensile stress |
CN113391597A (en) * | 2020-03-11 | 2021-09-14 | 欧姆龙株式会社 | Controller system and control method thereof |
CN113701832A (en) * | 2021-08-28 | 2021-11-26 | 上海光华仪表有限公司 | Control method and system of high-voltage union electromagnetic flowmeter |
-
1997
- 1997-01-07 JP JP86097A patent/JPH10198811A/en active Pending
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2008143268A1 (en) * | 2007-05-15 | 2008-11-27 | Sony Corporation | Registering device, checking device, program, and data structure |
JP2008287355A (en) * | 2007-05-15 | 2008-11-27 | Sony Corp | Registering device, collating device, program, and data structure |
JP2011186801A (en) * | 2010-03-09 | 2011-09-22 | Fuji Xerox Co Ltd | Image processing device and image processing program |
CN113391597A (en) * | 2020-03-11 | 2021-09-14 | 欧姆龙株式会社 | Controller system and control method thereof |
CN112699512A (en) * | 2021-01-14 | 2021-04-23 | 四川交投建设工程股份有限公司 | Stress midpoint calculation method for multi-line segment asymmetric curve tensile stress |
CN112699512B (en) * | 2021-01-14 | 2023-08-25 | 四川省交通建设集团股份有限公司 | Stress midpoint calculation method for multi-line asymmetric curve tensile stress |
CN113701832A (en) * | 2021-08-28 | 2021-11-26 | 上海光华仪表有限公司 | Control method and system of high-voltage union electromagnetic flowmeter |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3252623B2 (en) | Shape model generator | |
US5611037A (en) | Method and apparatus for generating image | |
US5613052A (en) | Method and apparatus for clipping and determining color factors for polygons | |
US5579461A (en) | Method and apparatus for filling polygons | |
JPH10198811A (en) | Line segment approximating method for tertiary bezier curve | |
JP3029878B2 (en) | Apparatus and method for processing a plurality of polygons representing an image | |
US5771035A (en) | Character generation device | |
US20210082165A1 (en) | Rendering of cubic bezier curves in a graphics processing unit (gpu) | |
CN110264546B (en) | Image synthesis method and device, computer-readable storage medium and terminal | |
JP3060761B2 (en) | Drawing equipment | |
US7015917B2 (en) | Curved surface subdivision apparatus | |
JP2008097450A (en) | Graphics drawing device and program | |
EP0378754A2 (en) | Polygon smoothing method | |
US5619626A (en) | Processing image data | |
JP2003162728A (en) | Image processor and image outputting device | |
JPH1021415A (en) | Graphic processing apparatus and graphic processing method | |
JPH09245181A (en) | Anti-aliasing | |
JP2000207576A (en) | Method and device for processing image and recording medium recording image processing program | |
JPH08287286A (en) | Plane image mapping method | |
JPH0627922A (en) | Character pattern display controller | |
JPH06168337A (en) | Paint-out processing method | |
JPS63118982A (en) | Arithmetic processing method for deciding whether points are inside or outside on polygon | |
JP2002358536A (en) | Device and method for generating polygon data and plotting system | |
JP3567727B2 (en) | Image processing method and apparatus | |
JP2613653B2 (en) | Image processing device |