摘 要: 提出一種簡單而有效的直線逼近自由曲線算法。自由曲線輪廓采用Freeman鏈碼描述,提出快速分割鏈碼算法,得出逼近節點,從而準確地實現對曲線的逼近。此外,該方法不僅適用于直線、圓弧和非圓曲線,而且還適用于形狀復雜,不能用初等解析函數直接表示的自由曲線。實驗結果表明,該算法簡單、快速、準確,并對自由曲線具有較好的逼近效果。
關鍵詞: Freeman鏈碼; 逼近節點; 自由曲線; 邊界描述; 直線逼近
中圖分類號:TP391.72 文獻標志碼:A 文章編號:1006-8228(2013)12-57-03
Linear approximation algorithm of free curves based on Freeman chain code
Yang Bin
(Dept. of Information center, Wuxi AIC, Wuxi, Jiangshu 214023, China)
Abstract: A simple and efficient algorithm of the linear approximation of free curves is proposed. In the paper, the contour of a free curve is described by Freeman chain code. A rapid segmentation algorithm of chain code is proposed so as to get the approximation nodes. Thus, a more accurate approximation of the curve can be achieved. In addition, this method can not only be applied to straight lines, arcs and non-circular curves, but also curves which have complex shape and can not be described by an explicit function. The experiment results show that the algorithm is simple, rapid, accurate, and free curves have good approximation.
Key words: Freeman chain code; approximation node; free curve; contour description; line approximation
0 引言
在數控系統中,非圓曲線是指除直線與圓弧之外,可以用數學方程式表達的平面輪廓曲線。而數控系統一般只能做直線插補和圓弧插補,對于輪廓為非圓曲線的零件,數學處理的方法是用直線段或圓弧段去逼近曲線輪廓[1]。直線段逼近輪廓曲線的關鍵在于計算出節點。節點是在用直線段或圓弧段去近似曲線時,相鄰直線段或圓弧段之間的交點。其中,直線逼近非圓曲線常用的計算節點方法有:等間距法、等弦長法、等誤差法等。等間距法就是將曲線沿著某一坐標軸分割,分割點在坐標軸上的投影等間距,根據曲線方程得到分割點的坐標,即根據已知曲線方程y=f(x),可由xi求得yi,xi+1=xi+Δx,yi+1=f(xi+Δx)(其中Δx為間距)。這種方法是通過調整分割點個數來調整逼近誤差。但節點越多,程序運行耗時越多。等弦長法是用各段長度相同的弦來逼近曲線,誤差是通過以最小曲率半徑處的加精度確定弦長。這種方法在曲線曲率半徑變化較大時,節點將增多,所以此種方法適用于曲線曲率變化不大的情況。……