Adaptive fairing of digitized point data with discrete ... - CiteSeerX

COMPUTER-AIDED DESIGN Computer-Aided Design 34 (2002) 309±320

www.elsevier.com/locate/cad

Adaptive fairing of digitized point data with discrete curvature G.H. Liu, Y.S. Wong, Y.F. Zhang*, H.T. Loh Department of Mechanical Engineering, National University of Singapore, 10 Kent Ridge Crescent, 119260, Singapore Received 8 June 2000; revised 26 January 2001; accepted 9 February 2001

Abstract An algorithm for fairing two-dimensional (2D) shape formed by digitised data points is described. The application aims to derive a fair curve from a set of dense and error-®lled data points digitised from a complex surface, such that the basic shape information recorded in the original point data is relatively unaffected. The algorithm is an adaptive process in which each cycle consists of several steps. Given a 2D point set, the bad points are identi®ed by analysing the property of their discrete curvatures (D-curvatures) and ®rst-order difference of Dcurvatures, in two consecutive fairing stages. The point set is then segmented into single bad point (SBP) segments and multiple bad point (MBP) segments. For each MBP segment, a specially designed energy function is used to identify the bad point to be modi®ed in the current cycle. Each segment is then faired by directly adjusting the geometric position of the worst point. The amount of adjustment in each cycle is kept less than a given shape tolerance. This algorithm is particularly effective in terms of shape preservation when dealing with MBP segments. Case studies are presented that illustrate the ef®cacy of the developed technique. q 2002 Elsevier Science Ltd. All rights reserved. Keywords: Fairing; Discrete curvature; Reverse engineering

1. Introduction The shape information of an object can be acquired by digitizing its surface. Although a three-dimensional (3D) digitizing device, such as coordinate measuring machine (CMM) and laser scanner, is able to achieve highly accurate measurement, measurement errors are unavoidable due to some practical reasons, e.g. re¯ective attributes and sharp areas of the surface, extraneous vibration of the system [1]. These errors affect the subsequent shape design or shape evaluation. Hence, fairing is carried out to accomplish a set of `visually pleasing' data points within the prescribed tolerance of shape error [2,3]. Fairness is primarily related to the smoothness of the shape geometry. Different fairing methods, such as leastsquare, energy and spline methods, vary in the use of different objective functions and the amount of data points. Global fairing usually fairs the data points by optimizing an integrand running through the entire parameterization interval, while local fairing only modi®es the local geometric property of the data points to achieve the required fairness. The adopted fairness criteria can be divided into two categories. The ®rst category aims to decrease the discontinuities of the curvature slope or higher derivatives * Corresponding author. Tel.: 165-874-2868; fax: 165-779-1459. E-mail address: [email protected] (Y.F. Zhang).

of the curve interpolating the data points [4±8]. The second category seeks the optimal parameterization, such that the Euclidean distance between the given points and the faired curve at the corresponding nodes is minimum [9±11]. Interactive fairing is a typical approach towards point fairing in which an expert identi®es the bad points and makes appropriate corrections to these points interactively. An interactive method proposed by Renz [2] interactively identi®es the correction areas of the data points and modi®es them so that the corresponding ®rst (second) divided differences plot is improved. The interactive approach is simple. However, since it is manual, the method is time-consuming, particularly when the point set is dense. In some cases, it may not be easy for a user to identify points that need to be modi®ed [5]. Hence, recently reported research focuses on automatic fairing algorithms to exploit the power of the computer so that complex and large cloud data could be effectively handled. Sapidis and Farin [5] developed an automatic fairing scheme, in which a cubic B-spline curve is ®rstly interpolated through the data points, and the difference of the ®rst derivative of the curvature of the curve is then used as the fairness measure. The algorithm locally modi®es the control polygon of the curve by removing an `offending' knot or inserting a `fairing' knot so that the new curve has the required fairness at the speci®ed knot. Pigounakis and Kaklis [8] also proposed an automatic fairing algorithm

0010-4485/02/$ - see front matter q 2002 Elsevier Science Ltd. All rights reserved. PII: S 0010-448 5(01)00091-4

310

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

based on the convexity-preserving property of the curve. The former approach is a local fairing method, and the data points are faired mathematically. The latter employs a hybrid fairing method, which consists of a global procedure and a local ®ne fairing stage. By utilizing the convexitypreserving property of the interpolatory curve, the latter algorithm emphasizes more on the fairing of a curve that can satisfy the requirements imposed by the designer such as local convexity, end constraint, and tolerance constraint. While such automatic fairing methods are ef®cient and effective, a potential disadvantage is the possibility of large de¯ections arising from the use of the interpolatory curve [2,12]. There are cases where only undesirable or bad points are allowed to be modi®ed in order to keep the original shape information recorded in the data points. For example, in the reverse engineering of complex surfaces, we need to replicate a fair shape that is capable of depicting the original shape of the data points as much as possible. The captured data points are often dense and error-®lled. The problem is not just to modify the bad points to make the ®tting curve fair, but also to keep the differences between the modi®ed data points and the original points as small as possible, so as to ensure that the original basic shape information is relatively unaffected [1,12]. It is dif®cult to accomplish a satisfactory result for such cases by using the above-mentioned fairing methods. Therefore, in this paper, we have proposed a discrete curvature (D-curvature) fairing method and developed a corresponding adaptive fairing algorithm to solve this problem. On the other hand, our fairing algorithm focuses on two-dimensional (2D) discrete points. However, it is applicable to problems involving 3D cloud data and this will be presented in the case study.

using circular curvature as: Ki ˆ

2DPi21 Pi Pi11 2sinai ˆ sgn…DPi21 Pi Pi11 † Li Li11 Qi Qi

where Li ˆk Pi 2 Pi21 k; Qi ˆk Pi11 2 Pi21 k and DPi21 Pi Pi11 is the signed triangular area. When Pi21, Pi, and Pi11 run counter-clockwise, Ki is de®ned as positive to indicate that Pi is a convex point, and vice versa. For the two end points P0, PN, the corresponding D-curvature is calculated as follows: 1. If the end tangent vector is unknown, circular end condition is applied to estimate the two end tangent vectors ^ N . Points P0 ! P1 ! P2 are selected to estimate ^ 0,m m ^ N . Take m ^ 0 as an ^ 0 while PN ! PN21 ! PN22 for m m example, denote a0 ˆ P1 2 P0 ; b0 ˆ P2 2 P0 and ^ 0 is calculated by [14]: c 0 ˆ a 0 £ b0 , m ^ 0 ˆ r0 £ c 0 = k r0 £ c 0 k m

with

r0 ˆ { k a0 k2 …b0 £ c0 †1 k b0 k2 …c0 £ a0 †}=…2 k c0 k2 † …2† 1 2. As shown in Fig. 1(b), two additional points P2 0 , PN are ^ 0 , 2m ^ N , satisfying added along the direction of 2m k P1 2 P0 k$k P02 2 P0 k, k PN21 2 PN k$k PN 1 2 PN k. 3. D-curvatures at P0, PN, are calculated using Eq. (1) with P02 ! P0 ! P1 and PN21 ! PN ! PN 1 , respectively.

2. Discrete curvature of discrete data points In difference geometry, a polygon …Pi †Niˆ0 ˆ …P0 ; P1 ; ¼; PN † represents the polygonal connection with straight-line segments of the N 1 1 vertices or discrete points Pi [ Rd (d ˆ 2 is a planer discrete curve and d ˆ 3 a spatial discrete curve). The polygon is called closed when condition P0 ˆ PN is satis®ed and the other vertices are inner vertices. Otherwise it is called open and possesses N 2 1 inner vertices P1,¼,PN21. If we parameterize the vertices of the polygon using chord-length parameterization, the polygon can be associated with a regular parametric curve in Rd . Hence, in this paper, we call polygon …Pi †Niˆ0 to be a discrete curve [13] in Rd and curvature at vertex Pi as discrete curvature(D-curvature) of Pi. Assuming that an open discrete curve …Pi †Niˆ0 is given in 2 R , we de®ne the D-curvature at Pi, Ki, as the relative curvature of a curve that passes through three adjacent points Pi21, Pi, and Pi11. As illustrated in Fig. 1(a), Ki can be expressed

…1†

Fig. 1. Estimation of D-curvature.

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

The ®rst-order difference of D-curvature for each point is, therefore calculated by:

DK0 ˆ 0;

DKi ˆ Ki 2 Ki21 ;

i ˆ 1; ¼; N:

…3†

3. Fairness of discrete data points Mathematically, the shape of a curve (its fairness) can be completely characterized by the curvature [2]. For a parametric spatial curve s(t) ˆ s(x(t), y(t),z(t)), the curvature of a point corresponding to the parameter t is calculated by:

k…t† ˆ

s_…t† £ s…t† js_…t†j3

…4†

For a planar curve s(t) ˆ s(x(t),y(t)), Eq. (4) can be rewritten as:

k…t† ˆ

 y…t† _ 2 y…t†  x…t† _ x…t† 2 _ 2 Š3=2 _ 1 …y…t†† ‰…x…t††

…5†

The signed curvature intrinsically exhibits the shape of a curve. If a negative curvature represents a concave region of the curve, then a positive curvature indicates a convex region. The absolute value of the curvature re¯ects the convexity or concavity of the curve. There exist several de®nitions for the fairness of a curve. A widely accepted de®nition states that a curve is fair if its curvature is continuous and consists of only a few monotone pieces [4,12]. More speci®cally, the criteria for a fair curve are given as follows [12]: 1. The curve has no unwanted in¯ection points. 2. The curve is of at least C 2 continuity. Likewise, the fairness of the discrete data points can be intuitively evaluated by analysing the property of its relevant D-curvature and the corresponding ®rst-order difference. Fig. 2 shows the behavior of the signed D-curvature and the corresponding ®rst-order difference of D-curvature for an open discrete curve. The discrete curve has some in¯ected points [circled in Fig. 2(a)] and their D-curvatures exhibit either zero crossing or peak/valley [Fig. 2(b)]. On the other hand, the ®rst-order differences of D-curvature of these in¯ected points [Fig. 2(c)] act in a similar way. Moreover, some not-so-in¯ected points [13, 18, and 24, as circled in Fig. 2(c)] as suggested by their D-curvatures, have ®rstorder differences of D-curvature that indicate shape discontinuity. Although the in¯ected points identi®ed by these two measures are partially overlapping, both measures will be used in our fairing algorithm, as the in¯ected points identi®ed separately will be used in two fairing stages, respectively. In summary, given a set of discrete data points and their corresponding signed D-curvatures, the following fairness criteria can be employed: 1. The D-curvature has no unwanted successive sign changes.

311

2. The ®rst-order difference of D-curvature has no successive sign changes. 4. Discrete curve fairing A fairing method based on D-curvature is a pointselection modi®cation method [12,13]. A distinct characteristic of this type of fairing is that only the bad points are identi®ed for modi®cation by directly adjusting their geometric positions, which makes it simple yet powerful in modifying the undesirable points without incurring a large de¯ection. Accordingly, the fairing process proposed in this paper consists mainly of two steps: identi®cation of the bad points and geometric modi®cation of their positions. 4.1. Identi®cation of the bad points Based on the aforementioned fairness criteria for the discrete points, the bad points are detected in two steps, i.e. rough checking and ®ne checking. In rough checking, bad points are identi®ed by checking the successive change in the signs of the D-curvatures derived from the data points. Given point Pi and its two neighbor points Pi21, Pi11, Pi is termed as a `bad' point when the following criterion is satis®ed: ( Ki21 ´Ki , 0 …6† Ki ´Ki11 , 0 For example, as illustrated in Fig. 3(a), the D-curvature signs of the given points are: ` 2 2 2 2 1 2 2 2 2 '. The 5th point is identi®ed as a bad point. There are cases where the neighboring point of a bad point is also a bad point, e.g. the D-curvature signs of the points in Fig. 3(b) are: ` 2 2 2 2 1 2 1 2 1 1 1 1 1 '. At this stage, since it is dif®cult to accurately pick out the true bad point from these bad points, they are termed as multi-bad-points (MBP) and kept for further processing. In the former case the outstanding bad point is termed as single-bad-point (SBP). Different fairing strategies will be employed to handle SBPs and MBPs. In ®ne checking, point Pi is termed as a bad point when the following criterion is satis®ed: ( DKi21 ´DKi , 0 …7† DKi ´DKi11 , 0 Similar to the rough checking, the bad points found in ®ne checking are also categorised into two groups, i.e. SBPs and MBPs. In general, the fairing process of selecting and modifying the bad points only may ful®l the fairing requirement. In some cases, however, we found that modifying the neighbourhood of the bad points could achieve a better result, which is mainly caused by the fact that some bad points may not be revealed due to the error in estimating the Dcurvature. Moreover, the neighbourhoods of the determined

312

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

Fig. 2. Behavior of D-curvatures and their ®rst-order differences.

`bad' point may also become bad points during modi®cation. Therefore, for each of the SBPs and MBPs ……Pi †m iˆk ˆ …Pk ; Pk11 ; ¼; Pm ††; four adjacent points (Pk22, Pk21, Pm11, Pm12) are added to form a SBP segment or MBP segment ……Pi †m12 iˆk22 ˆ …Pk22 ; ¼; Pm12 ††. The overall fairing approach includes two consecutive stages: fairing the segments and then the entire point set. For easy processing, when fairing the segments, the D-curvatures of the two end points of a segment are assumed as zero, while for fairing the entire point set, the original D-curvatures of these segment end points are restored. 4.2. Modi®cation direction Modi®cation of a bad point in a segment involves moving

the bad point to a new position so that the segment becomes fairer. Referring the example shown in Fig. 4, the bad point needs to be modi®ed is Pi(xi,yi), the modi®cation amount (distance from the current position to the new position) and direction are speci®ed by r i and f i, respectively. It was found that the determination of the most appropriate f i is a hard issue as many directions could lead to a fairer segment. This is further complicated by the fact that the original shape is unknown and the modi®cation of the bad point will affect the D-curvatures of its neighbourhood in addition of its own. On the other hand, in order to preserve the original shape as much as possible, the new position should be restricted to the neighbourhood of Pi. Based on a trial-and-error investigation, it was found that good and consistent results were obtained by moving the bad point to

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

313

Fig. 3. Forming MBP and SBP segment.

Fig. 4. Modi®cation amount and direction of the bad point.

a new position in the positive or negative gravity direction of Pi ! Pc (G-direction), where Pc is the gravity center of DPi21 Pi Pi11 (see Fig. 4) and given as: Pc ˆ

1 3

…Pi21 1 Pi 1 Pi11 †

…8†

For the bad points identi®ed in rough checking, modi®cation (rough fairing) will always follow the positive Gdirection. To illustrate, the two possible cases of a bad point in a SBP segment (Ki , 0 and Ki . 0) are given in Fig. 5(a) and (b), respectively. It can be easily seen that moving Pi along the positive G-direction will make the segment fairer with respect to the rough checking criterion. For a bad point in a MBP segment, take Fig. 6(a) as an example, where points 4 and 5 are two continuous bad points in the segment …Pk †7kˆ2 . It is obvious that moving either point 4 [Fig. 6(b)] or point 5 [Fig. 6(c)] along the positive G-direction can make the segment fairer. For the bad points identi®ed in ®ne checking, there are four possible cases of a bad point in a SBP segment, shown in Fig. 5(c)±(f), respectively. Note that it is assumed that the segment already satis®es the rough checking criterion. The modi®cation direction in ®ne fairing is determined as follows: 1. If j Ki j . j Ki21 j and j Ki j . j Ki11 j

[Fig. 5(c) and (d)], the modi®cation direction is along the positive G-direction. Take the case in Fig. 5(c) as an example, moving Pi along the positive G-direction will increase Ki and decrease Ki21 and Ki11. At a certain stage, (Ki 2 Ki21) and (Ki11 2 Ki) will have the same sign, thus satisfying the ®ne checking criterion. Similarly, it can be proven that this is the case for Fig. 5(d). 2. If j Ki j , j Ki21 j and j Ki j , j Ki11 j [Fig. 5(e) and (f)], the modi®cation direction is along the negative Gdirection. Take the case in Fig. 5(e) as an example, moving Pi along the negative G-direction will decrease Ki and increase Ki21 and Ki11. At a certain stage, (Ki 2 Ki21) and (Ki11 2 Ki) will have the same sign, thus satisfying the ®ne checking criterion. Similarly, it can be proved that this is the case for Fig. 5(f). 4.3. Modi®cation heuristics With the modi®cation direction determined for each of the identi®ed SBP segments and MBP segments, a simple modi®cation approach is to move the bad point, each time with a small amount, until it satis®es the respective fairing criterion (rough and ®ne). However, we found that very often, the resultant shape of points differ substantially from its original shape, in particular for the MBP segments where it is dif®cult to decide the

314

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

Fig. 5. Modi®cation directions in rough and ®ne fairing.

bad point that needs to be modi®ed ®rst. An example is given in Fig. 6 in which the original point set [Fig. 6(a)] includes two bad points (P4 and P5). By changing the position of either P4 or P5 alone, the resultant shapes, shown in Fig. 6(b) and (c), respectively, show some signi®cant change from the original shape. This is due mainly to the fact that this approach will keep modifying the bad point at hand without considering the other bad points in a MBP segment. We also found that modifying different bad points in a MBP segment at different stages may produce some better results, i.e. the change to the original shape is kept to a smaller amount. Therefore, the modi®cation needs to be carried out on a bad point such that a fair shape can be achieved in a most effective manner. This identi®ed bad point is termed as the `worst' point. In our approach, to evaluate the quality of the bad points in a MBP segment, the energy function proposed by Su and Liu [12] is adopted here for the discrete points given in …Pi †Niˆ0 ˆ …P0 ; P1 ; ¼; PN †: D0 ˆ DN ˆ 0; i ˆ 1; 2; ¼; N 2 1:

Di ˆ li K i21 1 …1 2 li †K i11 2 K i ;

…9†

where

li ˆ

Li11 ; Li 1 Li11

Li ˆk Pi 2 Pi21 k :

On the other hand, we also assume that Di remains the same if there is no change to Ki during a modi®cation. The energy at point Pi, Di, re¯ects the variation of Ki21, Ki and Ki11. A smaller j Di j implies a more linear relationship among Ki21, Ki and Ki11, i.e. point Pi and its two neighbor points Pi21, Pi11, are more geometrically correlated. Otherwise, when j Di j reaches an extreme in the neighborhood of Pi, which means a high ªenergyº is stored at Pi, the shape position among points Pi21, Pi and Pi11 is the least correlated, or Pi is a discontinuous joint for Pi21 and Pi11. Hence, j Di j can be used to measure the local fairness of Pi, and S j Di j can serve as an indicator of global fairness for all the points involved. The essence of our method is to improve the geometric correlation among the `bad' point Pi and its neighbor points by decreasing the `energy' j Di j and S j Di j . Therefore, two heuristics are proposed: 1. If point set …P i 0 † is the result of modifying one point in point set (Pi) and j Di 0 jis the new value of j Di j after the

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

315

dominance of K3 and K4. After the change, K4 increases and both K3 and K5 decrease, which leads to the decrease of D4 and increase of D3 and D5. If D3 is negative, j D3 j , j D4 j , and j D5 j are all decreased. Even if D3 is positive, the decrease of j D4 j , and j D5 j would be more than the increase of j D3 j . Similarly, the energy at P5 and the overall energy, S j D j , can be proved to be decreasing when modi®cation is applied to P5. For ®ne fairing, we look at the energy change under two situations, i.e. positive G-direction and negative G-direction. For modi®cation along the positive G-direction, we take Fig. 5(d) as an example. Since Ki . Ki21 and Ki . Ki11, Di is negative. At the same time, the modi®cation leads to the decrease of Ki and increase of Ki21 and Ki11. Therefore, Di is increased and j D1 j is decreased. However, there is no guarantee that j Di21 j and j Di11 j are decreased. For modi®cation along the negative G-direction, take Fig. 5(f) as an example, in which Ki , Ki21 and Ki , Ki11 and Di is, therefore, positive. The modi®cation leads to an increase of Ki and a decrease of Ki21 and Ki11. Therefore, Di is decreased and so is j Di j . Similarly, there is no guarantee that j Di21 j and j Di11 j are decreased. Therefore, for ®ne fairing, only the heuristic concerning individual energy is adopted. Another interesting characteristic of the energy function is when a bad point, Pi, is moved to a new position P i 0 satisfying D 0i ˆ 0, we have K 0i 2 K 0i21 DK 0i 1 2 li ˆ ˆ .0 0 0 0 K i11 2 K i DK i11 li

Fig. 6. Different fairing strategies for a MBP segment.

modi®cation, …Pi 0 † is fairer than (Pi) if j Di 0 j,j Di j. 2. …Pi 0 † is fairer than (Pi) if S j D i j, S j D i 0 j. Here, it is necessary to check whether the modi®cation along the determined direction will lead to a decrease in the energy in both rough and ®ne fairing, as illustrated in the following examples. In rough fairing, take Fig. 5(a) as an example, Di is positive according to Eq. (9). Since Ki22 ˆ Ki12 ˆ 0, both Di21 and Di11 are negative. When Pi is moved in the G-direction by a very small distance, both Li21 and Li11 can be considered to have changed little. Both Ki21 and Ki11 are decreased (but still positive), while Ki is increased (but still negative). Therefore, j Di21 j , j Di j , and j Di11 j are decreased, so is S j D i j. For the case of a MBP segment, we take the case shown in Fig. 6(a) as an example. Here, we consider the case when P4 is moved along its G-direction, there will be no change to the energy of P1, P2, P6, P7, and P8. We only consider the energy change at P3, P4, and P5, i.e. D3 ˆ l3 K2 1 …1 2 l3 †K4 2 K3 , D4 ˆ l4 K3 1 …1 2 l4 †K5 2 K4 , and D5 ˆ l5 K4 1 …1 2 l5 †K6 2 K5 ). D4 is positive and D5 is negative, while D3 tends to be negative due to the

…10†

Thus, the resultant position automatically satis®es the ®ne checking criterion. In summary, modifying the bad points in the determined directions tends to reduce the energy level of the bad points as well as the global energy level. Therefore, we propose to use the energy level of the bad points to decide which bad point needs to be modi®ed ®rst in the case of MBP segments and two kinds of `worst' points can be identi®ed as follows: 1. Local worst point (LWP): the LWP is the one that has the highest energy among all the bad points. 2. Global worst point (GWP): although the GWP's energy is not necessarily the maximum, modifying it would result in a larger decrease of global `energy' of the points than modifying any other point. Modifying the GWP controls the fairing process by smoothing out the worst point that affects the global continuity of the point set, while modifying the LWP adjusts the worst point that is most discontinuous to its neighbours in the point set. The details of the fairing algorithm are introduced next. 5. The fairing algorithm The developed fairing algorithm consists of two stages,

316

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

i.e. rough faring and ®ne fairing. The SBP and MBP segments identi®ed in rough checking are faired in rough fairing whilst the SBP and MBP segments identi®ed in ®ne checking are faired in ®ne fairing. By running these two stages sequentially, i.e. rough fairing ! ®ne fairing, it is expected that the modi®cation done in the second stage would be rather minimal and therefore the fairing algorithm would converge well. On the other hand, there are also two major steps in each fairing stage. In the ®rst step, the modi®cation is carried out for each of the SBP or MBP segments separately; whereas in the second step, fairing is carried out on the entire point set. Compared with fairing on the entire point set directly, this fairing approach converges faster. Moreover, it could also achieve global fairness in addition to minimizing the shape divergence from the original curve by adjusting the bad points in a small amount in each step. The details of the two fairing stages are given as follows: 5.1. Rough fairing algorithm Input: A discrete point set …Pi †N iˆ0 ˆ …P0 ; P1 ; ¼; PN †, a modi®cation amount r 0 0 0 Output: A discrete point set …Pi 0 †N iˆ0 ˆ …P0 ; P1 ; ¼; PN † 1. Identify all the bad points from …Pi †Niˆ0 through rough checking and form all the SBP and MBP segments. 2. For each MBP segment Identify the GWP and modify it by r . If there is no more bad point in this segment, go to the next step; else, continue. 3. For each SBP segment Modify the bad point by r . If there is no more bad point in this segment, go to the next step; else, continue. 4. Identify all the bad points from the whole point set after step (3) through rough checking. If there is no more bad point, go to next step; else, identify the GWP and modify it by r , continue. 5. Output …Pi 0 †Niˆ0 . End of rough fairing algorithm. 5.2. Fine fairing algorithm

Fig. 7. The faired discrete curve and their characteristics.

…Pi †Niˆ0

Input: The output point set from rough fairing, ˆ …P0 ; P1 ; ¼; PN † Output: A discrete point set …Pi 0 †Niˆ0 ˆ …P0 0 ; P1 0 ; ¼; PN 0 † 1. Identify all the bad points from …Pi †Niˆ0 through ®ne checking and form all the SBP and MBP segments. 2. For each MBP segment Identify the LWP and modify it by r . If there is no more bad point in this segment, go to the next step; else, continue. 3. For each SBP segment

Modify the bad point by r . If there is no more bad point in this segment, go to the next step; else, continue. 4. Identify all the bad points from the whole point set after step (3) through ®ne checking If there is no more bad point, go to next step; else, identify the LWP and modify it by r , continue. 5. Output …Pi 0 †Niˆ0 . End of ®ne fairing algorithm

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

317

Fig. 8. Example 1.

In the above algorithms, the value of r plays an important role in both fairing and preserving the original shape of the points. First, r should be reasonably large so that fairing can be completed ef®ciently. However, r should be kept under certain limit so the bad points are not over modi®ed. On the other hand, r should also be kept small so that the original shape of the points can be preserved as much as possible. An example is given in Fig. 6 in which the original point set

[Fig. 5(a)] includes two bad points (P4 and P5). By either changing the position of P4 or P5 alone by a relatively large amount, the resultant fair shapes, shown in Fig. 6(b) and (c), respectively, show some signi®cant change from the original shape. If r is set relatively small, our fairing algorithm will search and modify the worst point in each cycle. This makes all the bad points be involved in the fairing process, instead of modifying one point only. In this way, it is

318

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

Fig. 9. Example 2.

expected that the resultant shape resembles more of the original shape. The effect of this strategy can be seen in Fig. 6(d) in which both P4 and P5 are modi®ed with amounts much less than the amounts in Fig. 5(b) and (c). In practice, r can be set at a value less than the given shape tolerance. Fig. 7(a) shows the resultant point set after the aforementioned fairing algorithm has been applied to the original point set shown in Fig. 2(a), in which r is 0.05 mm. Apparently, the resultant shape is much fairer than the original one while overall, it still resembles the latter very well. The sign changes of the D-curvatures [Fig. 7(b)] and the corresponding ®rst-order differences of D-curvature [Fig. 7(c)] become successive. Besides, the energy of the faired points [Fig. 7(e)] shows a signi®cant drop compared with that of the original [Fig. 7(d)], particularly among the heavily in¯ected points [Fig. 2(a)], which is also in accordance with the modi®cations plot [Fig. 7(f)] where modi®cations are mostly carried

out to these points. From Fig. 7(f), it is also noted that a point can be modi®ed more than once and its accumulated modi®cation amount could exceed the given shape tolerance. However, using the shape tolerance to control the overall modi®cation amount is not adopted in our fairing algorithm as often, the bad points having a modi®cation amount larger than the shape tolerance could be the `noisy' points. 6. Comparison with some related work The D-curvature based fairing method was proposed by Su and Liu [12] and successfully applied to fair point sets in ship design. In their proposed algorithm, the bad points are identi®ed in a single run and all the bad points are then directly adjusted. Their fairing algorithm is therefore a deterministic process and the resultant shape, although fair, could diverge very much from the original shape. In

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

319

Fig. 10. An application example.

contrast, the algorithm proposed in this paper is progressive and with controlled modi®cation of the amount and the fairing of the worst point in each fairing cycle, which helps to limit the divergence from the original shape. Eck and Jaspert [13] also proposed a D-curvature based fairing algorithm for discrete point sets in which the fairing

criterion is to minimize the square of the second derivatives of D-curvature (K 00 2) of the points that are estimated by interpolating a quadratic polynomial to the D-curvatures. The entire point set is faired by iteratively searching and changing only the point with the largest K 00 2. In our approach, the entire point set is segmented into SBP and

320

G.H. Liu et al. / Computer-Aided Design 34 (2002) 309±320

MBP segments. These segments then go through two faring stages, rough and ®ne fairing. For the MBP segment, a specially designed energy function is used to select the bad point to be modi®ed in each cycle. Finally, fairing is carried out over the entire point set. We believe that in such a way, it could be relatively easy for the fairing process to converge and be effective in preserving the original shape information stored in the data points. It is worth mentioning that there is no benchmark case such that the comparison can be carried out directly. 7. Application examples The following two examples are taken from a cloud data digitized from a cartoon toy of which the original topological relationship is unknown. One data set is open and the other closed. The aim is to reverse engineer a fair shape for these data points. In order to test the algorithm, some error points are randomly added, as shown in Figs. 8(a) and 9(a), respectively. All the ®gures are accompanied with the corresponding modi®cation plots to show the position variation of the points. In the fairing, the modi®cation amount is chosen as r ˆ 0.01 mm. Figs. 8(c) and 9(c) are the faired shape of the two examples, respectively. Compared with the shape prior to the fairing, as shown in Figs. 8(b) and 9(b), it is noted that the fairness has been improved signi®cantly while the basic shape is not affected. From the modi®cation plot, as shown in Figs. 8(d) and 9(d), we noticed that all the bad points have been adjusted to the faired positions. Fig. 10 is an application example in which the developed algorithm was applied to fair the cross-sections generated from cloud data taken from a cartoon toy. The total number of data points is 22,181, which was sliced into 146 crosssections and all the points were projected to their nearest planes. The algorithm was then run to fair the 2D shapes in each plane, the modi®cation amount is chosen as r ˆ 0.01 mm. The program was run on an HP-C200 workstation and took approximately 12 min. Fig. 10(b) shows the average accumulated modi®cation amount of each crosssection. The resultant cross-sectioned model can be directly input to a Stereo-Lithography (SLA) machine to build a prototype. 8. Conclusions In this paper, a fairing method based on D-curvature has been developed in fairing dense and error-®lled data points obtained by digitization of a complex surface. The algorithm is adaptive in nature has two fairing stages, i.e.

rough and ®ne fairing. In each cycle, the bad points are identi®ed with respect to a given criterion and the point set is segmented into SBP and MBP segments, which are then faired individually. A specially designed energy function is used to select the worst point to modify for the MBP segments. At the same time, the modi®cation amount in each cycle is kept within a certain limit. These two measures help to preserve the original shape information recorded in the point set. A satisfactory fairness of the original data points can then be achieved by improving the local linear relationship of the D-curvatures of the points. Application examples indicate that the proposed algorithm is effective. The proposed algorithm can also be applied to reverse engineer a smooth shape for error-®lled discrete point data. However, if the original shape in the point set contains feature where there is lack of suf®cient number of points for an accurate de®nition (e.g. a sharp corner with only one point), the proposed algorithm could not perform satisfactorily because all these feature points would be smoothed out.

References [1] Varady T, Martin RR, Coxt J. Reverse engineering of geometric modelsÐan introduction. Computer Aided Design 1997;29(4):255± 68. [2] Renz W. Interactive smoothing of digitized point data. Computer Aided Design 1982;14(5):267±9. [3] Lott NJ, Pullin DI. Method for fairing B-spline surfaces. Computer Aided Design 1988;20(10):597±604. [4] Farin G, Sapidis N. Curvature and fairness of curves and surface. IEEE, Computer Graphics & Application 1989;5:52±7. [5] Sapidis N, Farin G. Automatic fairing algorithm for B-spline curves. Computer Aided Design 1990;22(2):121±9. [6] Kjellander JA. Smoothing of cubic parametric splines. Computer Aided Design 1983;15(3):175±9. [7] Hahmann S, Konz S. Knot-removal surface fairing using search strategies. Computer Aided Design 1998;30(2):131±8. [8] Pigounakis KG, Kaklis PD. Convexity-preserving fairing. CAD 1996;28(12):981±4. [9] Hoscheck J. Intrinsic parametrization for approximation. Computer Aided Geometric Design 1988;21:27±31. [10] Rogers DF, Fog NG. Constrained B-spline curve and surface ®tting. Computer Aided Design 1989;21:641±8. [11] Sarkar B, Menq CH. Parameter optimization in approximating curves and surfaces to measurement data. Computer Aided Geometric Design 1991;8:267±90. [12] Su BQ, Liu DY. Computational geometryÐcurve and surface modeling. New York: Academic Press, 1989. [13] Eck M, Jaspert R. Design fair curves and surfaces. In: Sapidis NS, editor. Philadelphia SIAM, 1994. p. 45±60. [14] Choi BK. Surface modeling for CAD/CAM. New York Elsevier Science Publishers BV, 1991.