boundary extraction algorithm for cutting area detection

9
Boundary extraction algorithm for cutting area detection S.C. Park, B.K. Choi * CAM Laboratory, Department of Industrial Engineering, Korea Advanced Institute of Science and Technology (KAIST), 373-1 Kusong-dong, Yusong-gu, Taejon, South Korea Received 11 January 2000; revised 10 July 2000; accepted 18 July 2000 Abstract In sculptured surface machining, many machining operations require cutting areas to be expressed in terms of a boundary representation. To extract cutting areas from a sculptured surface, this paper employs a regular grid model (Z-map model) and presents a procedure extracting areas from a Z-map model. The extracted areas may correspond to various machining features, depending on what the Z-map stores, such as curvature (fillet, uncut area), slope (wall, floor) and Z-values (contour). The core of the procedure is a ‘boundary extraction algorithm’ extracting boundaries and identifying the inclusion relationships among the boundaries from a binary image. The time complexity of the boundary extraction algorithm is O(n), where n is the number of runs. In terms of its time complexity and simplicity, the proposed algorithm has advantages over the prior ones. Empirical tests show the performance of the proposed algorithm. q 2001 Elsevier Science Ltd. All rights reserved. Keywords: Cutting area; Boundary extraction; Inclusion relationship; Boundary tracing 1. Introduction NC-data generation for sculptured surface machining is usually handled by NC-programmers with commercial CAM systems. Generally, NC-data generation involves three steps: (1) process planning by NC-programmers, split- ting the sculptured surface into several cutting areas accord- ing to the machining features and assigning cutting parameters (tool, tool-path topology) to each cutting area; (2) modeling boundary curves to represent the cutting areas in terms of a boundary representation and (3) NC-data generation from a CAM system with the boundary curves and the cutting parameters. Many researchers have studied CAPP (computer-automated process planning) to replace the first and second steps of the NC-data generation; however, there remain many obstacles to be overcome for the implementation of a practical CAPP system [3]. Espe- cially, the second step, modeling boundary curves, has rarely been brought into focus even though it is essential for the implementation of a CAPP system. The fact that no proper solution has been found for the boundary curve modeling serves as a motivation of this paper. Direct extraction of cutting areas from a sculptured surface is extremely difficult, because of two major difficulties: (1) numerical search operations, computation- ally expensive and unstable, are required to extract feature curves (wall, floor, fillet, etc.) from a parametric surface and (2) the feature curves have to be merged for the boundary curves by finding sets of connected feature curves, because a sculptured surface may consist of thousands of parametric surfaces. To avoid the mentioned difficulties, we employ a regular grid model called a Z-map [3] model. This paper presents a procedure extracting cutting areas from a Z-map model, a special form of discrete non-parametric surface model. A Z- map is a 2D-array of real numbers in which Z-values of the surface, sampled at the regular grid-points, are stored. The detailed procedure obtaining a Z-map from a sculptured surface can be found in Choi and Jerard [3]. Owing to its simplicity, a Z-map model is used widely in three-axis NC machining applications [1–5]. We describe the suggested procedure informally with the input and output of the procedure (Fig. 1). The input includes a Z-map and a value range defining a machining feature, cutting areas. With the input, boundary curves enclosing the cutting areas and the inclusion relationships among the boundary curves are extracted. The machining feature, we can find, depends on what the Z-map stores, such as curvatures, slopes and Z-values. Curvatures and slopes can be calculated by pre-processing each of the grid-points Computer-Aided Design 33 (2001) 571–579 COMPUTER-AIDED DESIGN 0010-4485/01/$ - see front matter q 2001 Elsevier Science Ltd. All rights reserved. PII: S0010-4485(00)00101-9 www.elsevier.com/locate/cad * Corresponding author. Fax: 182-42-861-1692. E-mail addresses: [email protected] (S.C. Park), [email protected] (B.K. Choi).

Upload: sc-park

Post on 02-Jul-2016

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Boundary extraction algorithm for cutting area detection

Boundary extraction algorithm for cutting area detection

S.C. Park, B.K. Choi*

CAM Laboratory, Department of Industrial Engineering, Korea Advanced Institute of Science and Technology (KAIST), 373-1 Kusong-dong, Yusong-gu,

Taejon, South Korea

Received 11 January 2000; revised 10 July 2000; accepted 18 July 2000

Abstract

In sculptured surface machining, many machining operations require cutting areas to be expressed in terms of a boundary representation.

To extract cutting areas from a sculptured surface, this paper employs a regular grid model (Z-map model) and presents a procedure

extracting areas from a Z-map model. The extracted areas may correspond to various machining features, depending on what the Z-map

stores, such as curvature (®llet, uncut area), slope (wall, ¯oor) and Z-values (contour). The core of the procedure is a `boundary extraction

algorithm' extracting boundaries and identifying the inclusion relationships among the boundaries from a binary image. The time complexity

of the boundary extraction algorithm is O(n), where n is the number of runs. In terms of its time complexity and simplicity, the proposed

algorithm has advantages over the prior ones. Empirical tests show the performance of the proposed algorithm. q 2001 Elsevier Science Ltd.

All rights reserved.

Keywords: Cutting area; Boundary extraction; Inclusion relationship; Boundary tracing

1. Introduction

NC-data generation for sculptured surface machining is

usually handled by NC-programmers with commercial

CAM systems. Generally, NC-data generation involves

three steps: (1) process planning by NC-programmers, split-

ting the sculptured surface into several cutting areas accord-

ing to the machining features and assigning cutting

parameters (tool, tool-path topology) to each cutting area;

(2) modeling boundary curves to represent the cutting areas

in terms of a boundary representation and (3) NC-data

generation from a CAM system with the boundary curves

and the cutting parameters. Many researchers have studied

CAPP (computer-automated process planning) to replace

the ®rst and second steps of the NC-data generation;

however, there remain many obstacles to be overcome for

the implementation of a practical CAPP system [3]. Espe-

cially, the second step, modeling boundary curves, has

rarely been brought into focus even though it is essential

for the implementation of a CAPP system. The fact that no

proper solution has been found for the boundary curve

modeling serves as a motivation of this paper.

Direct extraction of cutting areas from a sculptured

surface is extremely dif®cult, because of two major

dif®culties: (1) numerical search operations, computation-

ally expensive and unstable, are required to extract feature

curves (wall, ¯oor, ®llet, etc.) from a parametric surface and

(2) the feature curves have to be merged for the boundary

curves by ®nding sets of connected feature curves, because a

sculptured surface may consist of thousands of parametric

surfaces.

To avoid the mentioned dif®culties, we employ a regular

grid model called a Z-map [3] model. This paper presents a

procedure extracting cutting areas from a Z-map model, a

special form of discrete non-parametric surface model. A Z-

map is a 2D-array of real numbers in which Z-values of the

surface, sampled at the regular grid-points, are stored. The

detailed procedure obtaining a Z-map from a sculptured

surface can be found in Choi and Jerard [3]. Owing to its

simplicity, a Z-map model is used widely in three-axis NC

machining applications [1±5].

We describe the suggested procedure informally with the

input and output of the procedure (Fig. 1). The input

includes a Z-map and a value range de®ning a machining

feature, cutting areas. With the input, boundary curves

enclosing the cutting areas and the inclusion relationships

among the boundary curves are extracted. The machining

feature, we can ®nd, depends on what the Z-map stores, such

as curvatures, slopes and Z-values. Curvatures and slopes

can be calculated by pre-processing each of the grid-points

Computer-Aided Design 33 (2001) 571±579

COMPUTER-AIDEDDESIGN

0010-4485/01/$ - see front matter q 2001 Elsevier Science Ltd. All rights reserved.

PII: S0010-4485(00)00101-9

www.elsevier.com/locate/cad

* Corresponding author. Fax: 182-42-861-1692.

E-mail addresses: [email protected] (S.C. Park),

[email protected] (B.K. Choi).

Page 2: Boundary extraction algorithm for cutting area detection

in a Z-map storing Z-values. Consequently, we can obtain

cutting areas corresponding to a speci®c slope range (wall,

¯oor) or curvature range (®llet, uncut area), which may be

considered as machining features. If the Z-map represents a

CL-surface [1,3], Z-constant contouring tool-path can be

obtained by specifying the height with the value-range

(VLow� height, VHigh� in®nite).

Most of the prior results [6±8] are found in computer

vision and several algorithms have been suggested for the

boundary extraction problem from a binary image.

Although those algorithms are not designed to extract

cutting areas from a Z-map, they can be applied to the

problem, because a Z-map can be easily transformed to a

binary image with a value-range. Fig. 2 shows an example

of a binary image obtained from a Z-map. If a grid-point

belongs to the value-range (VLow, VHigh), then the grid-point

is classi®ed as an object-point (black), otherwise a back-

ground-point (white).

Freeman [6] proposed the concept of a chain code which

is a data structure representing the boundaries by means of

eight direction vectors (Fig. 3a). The basic idea of the

conventional chain-coding algorithm is to trace the bound-

ary pixels counterclockwise or clockwise and to sequen-

tially generate codes considering the neighborhood

relationship between adjacent boundary pixels. Kim et al.

[7] proposed a two-step algorithm to compute chain codes

from a particular run-length coded representation (Fig. 3b)

that preserves connectivity information between runs. They

also suggested an algorithm to detect the inclusion relation-

ships between external and internal boundaries. More

recently, Zingaretti et al. [8] presented an algorithm to

extract boundaries from multi-valued images.

We propose a procedure to extract cutting areas from a Z-

map for sculptured surface machining, and the core of the

procedure is a `boundary extraction algorithm' to extract

boundaries and identify the inclusion relationships among

the boundaries from a run-length coded binary image. The

main features of the proposed algorithm are as follows: (1) a

connectivity-net is devised to store the connectivity infor-

mation between runs; (2) a recursive function is designed

for the ef®cient construction of the connectivity-net; and (3)

a hierarchical boundary extraction scheme is employed to

identify inclusion relationships among the boundaries from

the connectivity-net. The time complexity of the boundary

extraction algorithm is O(n), where n is the number of runs.

The overall structure of the `boundary extraction algo-

rithm' is given in Section 2, followed by the connectivity-

net construction in Section 3. Empirical performance tests

S.C. Park, B.K. Choi / Computer-Aided Design 33 (2001) 571±579572

Fig. 1. Input and output of the procedure, (a) Input: Z-map, Value range (VLow, VHigh); (b) Output: Boundary curves and the inclusion relationships.

Fig. 2. A binary image from a Z-map, (a) Z-map; Value-Range (VLow: 30.0, VHigh: 40.0); (b) Binary Image.

Page 3: Boundary extraction algorithm for cutting area detection

are given in Section 4. Finally, concluding remarks are

given in Section 5.

2. Outline of the boundary extraction algorithm

This section gives an outline of the suggested boundary

extraction algorithm, together with some preliminary de®-

nitions. The boundary extraction algorithm can be infor-

mally speci®ed as follows:

Boundary extraction algorithm

² Input: A run-length coded binary image.

² Output: Boundaries and the inclusion relationships

among the boundaries.

The proposed algorithm consists of three steps: (1) initi-

alize a connectivity-net with a run-length coded binary

image; (2) complete the connectivity-net by extracting

connectivity between runs; and (3) extract boundaries

from the connectivity-net and identify the inclusion rela-

tionships among the boundaries. Fig. 4 shows an example

of a binary image and its run-length code to help illustrate

the explanation throughout this section.

2.1. Initial connectivity-net from a run-length coded binary

image

The term initial connectivity-net refers to a connectivity-net

having no connectivity information between runs. An initial

connectivity-net, representing the run-length coded binary

image in Fig. 4, is shown in Fig. 5. Each run is expressed in

two nodes, a left-node and a right-node. A left-node (right-

node) represents the left end (right end) of a run. Each node

(N) has several data ®elds; a row-index, a column-index, a

pointer (N.link) to indicate a connected node and two pointers

(N.prev, N.next) used for maintaining previous and next nodes

in the same row. As an example, Fig. 5 shows the data ®elds

stored in the node Nd. We should observe that all data ®elds

are ®lled with proper values except a pointer �Nd:link �NULL� indicating a connected node, because an initial

connectivity-net has no connectivity information. The

next step is to complete an initial connectivity-net.

2.2. Completion of an initial connectivity-net

To complete an initial connectivity-net, it is needed to

extract the connectivity information (N.link) of all nodes.

Fig. 6 shows the complete connectivity-net of the initial

connectivity net in Fig. 5. Arrows (links) between nodes

represent the connectivity information (N.link) of nodes.

The links may be classi®ed into two types, a horizontal

link between two nodes on the same row and a vertical

link between two nodes on different rows. For this step,

we propose an algorithm completing an initial connectiv-

ity-net with O(n) time complexity, where n is the number of

runs (nodes). The detailed description of the algorithm will

be given in Section 3.

In Fig. 6, we can observe that the orientations of the

external and internal boundaries are CCW (counterclock-

wise) and CW (clockwise), respectively. This property

may be useful for some applications requiring different

orientations of external and internal boundaries. The prop-

erty can be achieved by restricting the direction of vertical

links, i.e. the direction of vertical links of left-nodes (right-

nodes) should be downward (upward).

2.3. Boundaries and the inclusion relationships

From a complete connectivity-net, boundaries are

extracted in a hierarchical manner for the inclusion

relationships among the boundaries. With the help of the

example in Fig. 7, the extraction procedure can be infor-

mally described as follows: (1) select arbitrarily a starting

node (Na) for a boundary; (2) identify a set of connected

S.C. Park, B.K. Choi / Computer-Aided Design 33 (2001) 571±579 573

Fig. 3. Chain code and run-length code, (a) Chain Code; (b) Run-Length Code.

Fig. 4. An example of a binary image and its run-length code, (a) Binary

Image; (b) Run-Lengh Code.

Page 4: Boundary extraction algorithm for cutting area detection

nodes (Boundary-A) by tracing the links (arrows); (3) detach

the shaded nodes and its inner nodes from the connectivity-

net (Fig. 7b); and (4) if the detached sub-net has a node

which does not belong to the boundary then start another

trace for inner boundaries. Each set of connected nodes

represents a boundary and the corresponding curve can be

obtained by calculating the coordinates (x, y) of each node

with its indices of row and column.

3. Connectivity-net construction

This section gives a detailed explanation of the algorithm

completing an initial connectivity-net by extracting the

connectivity information (N.link) of all the nodes. Before

the formal description of the algorithm, some de®nitions are

addressed.

De®nition 1 (Connectivity relation between two nodes). -

Let two nodes, N1 and N2, belong to two different runs, R1

and R2, respectively. Then, the connectivity relation

between the two nodes becomes CONNECTED (Fig. 8a)

if there is a sharing column-index between R1 and R2.

Otherwise N2 may be BEFORE N1 (Fig. 8b) or AFTER N1

(Fig. 8c).

Fig. 9 shows two connectivity-nets in the making; some

nodes have their connectivity information (the tail of an

arrow) and others do not. In a connectivity-net in the

making, a node having the tail of an arrow (Na;Nc;Ne;¼

in Fig. 9a) is called a linked node, otherwise an unlinked

node (Nb;Ng;¼ in Fig. 9a).

De®nition 2 (Front/rear left-node of a row). In a row of a

connectivity-net in the making, the front left-node of the

row refers to the left-most node among unlinked left-

nodes, and the rear left-node of the row refers to the

right-most node among linked left-nodes in the row (see

Fig. 9a).

De®nition 3 (Front/rear right-node of a row). In a row of a

connectivity-net in the making, the front right-node of the

row refers to the right-most node among unlinked right-

nodes, and the rear right-node of the row refers to the

left-most node among linked right-nodes in the row (see

Fig. 9b).

Fig. 9 shows the front/rear left-nodes (right-nodes) of

each row in the two connectivity-nets in the making.

For example, in the second row (R2) in Fig. 9a, the

front left-node is Ng and the rear left-node is Ne, because

Ng is the left-most node among unlinked left-nodes (Ng)

and Ne is the right-most node among linked left-nodes

(Nc, Ne).

Based on the de®nitions, we present a recursive function

to extract links of left-nodes from a given start-node, and

S.C. Park, B.K. Choi / Computer-Aided Design 33 (2001) 571±579574

Fig. 5. The initial connectivity-net from the run-length code in Fig. 4.

Fig. 6. The complete connectivity-net.

Page 5: Boundary extraction algorithm for cutting area detection

then provide additional explanations.

Recur_Connect_Left (Start-Node)

Begin(1) C-node� Start-Node;

Repeat {

k� The index of the row containing C-node;

(2) F-node� Get the `front left-node' of

(k 1 1)-th row;

Identify the connectivity relation between

C-node & F-node;

(3) If (`F-node is BEFORE C-node')

then Recur_Connect_Left (F-node);

(4) Else If (`F-node & C-node are CONNECTED')

then {C-node.link� F-node, C-node� F-node}

(5) } Until (`F-node is AFTER C-node' or

F-node� � NULL);

(6) R-node� Get the `rear left-node' of (k 1 1)-th row;

Identify the connectivity relation between C-node &

R-node;

(7) If (`R-node is BEFORE C-node' or

R-node� � NULL)

then C-node.link� C-node.next;

(8) Else If (`R-node & C-node are CONNECTED')

then C-node.link� C-node.prev;

End.

The recursive function, Recur_Connect_Left ( ), mainly

consists of two parts: (1) the repeat-loop (Steps 1±5) for

vertical links and (2) other part after the repeat-loop

(Steps 6±8) for horizontal links. The function will be

explained with the help of the example shown in Fig. 10.

Let us assume that the initial start-node of the recursive

function is the node Na, the front left-node having the lowest

row index. In Step 1 of the recursive function (Recur_Connec-

t_Left (Na)), the C-node becomes Na and the F-node becomes

Nc in Step 2. Then in Step 3, it calls another recursive function,

Recur_Connect_Left (Nc), because the F-node (Nc) is

BEFORE the C-node (Na).

In the newly called recursive function,

Recur_Connect_Left (Nc), three left-nodes (Nc, Ni, Nm)

are linked (Fig. 10b) as follows. Initially, the C-node is

the start-node Nc and the F-node becomes Ni in Step 2.

Because the F-node (Ni) and the C-node (Nc) are

CONNECTED, Nc is linked to Ni �Nc:link � Ni� and the

C-node becomes Ni in Step 4. Then, the C-node is Ni and

the F-node becomes Nm in Step 2. Because Nm and Ni are

CONNECTED, Ni is linked to Nm and Nm is assigned to the

C-node in Step 4. Again in Step 2, the F-node becomes Ns.

This time, Ns is AFTER Nm (Step 5), which brings the end of

the repeat-loop. In Step 6, the R-node (rear left-node of the

®fth row) becomes NULL and the C-node (Nm) is linked to

the next node (Nm.next), in Step 7.

As the function (Recur_Connect_Left (Nc)) ®nishes

(returns), it goes back to after Step 3 in the ®rst recursive

function, Recur_Connect_Left (Na). This time, the F-node is

Ne in Step 2 (remember Nc is already linked in the recursive

function, Recur_Connect_Left (Nc)). Because the F-node

(Ne) is BEFORE the C-node (Na), it calls another recursive

function, Recur_Connect_Left (Ne), in Step 3. In the

function (Recur_Connect_Left (Ne)), four left-nodes

(Ne, Nk, No, Ns) are linked as shown in Fig. 10c. Then

it goes back to after Step 3 in the ®rst recursive

S.C. Park, B.K. Choi / Computer-Aided Design 33 (2001) 571±579 575

Fig. 7. Hierarchical boundaries extraction, (a) Boundary-A Starting From Na; (b) Detached Boundary-A and Inner Nodes.

Fig. 8. Connectivity between nodes, (a) N1 and N2 are CONNECTED; (b) N2 is BEFORE N1; (c) N2 is AFTER N1.

Page 6: Boundary extraction algorithm for cutting area detection

function, Recur_Connect_Left (Na). Still the C-node is

Na and the F-node becomes Ng in Step 2. Without

calling other recursive function, it links two left-nodes

(Na, Ng), as shown in Fig. 10d.

The recursive function extracting connectivity

information (links) of the left-nodes can be applied to the

case of right-nodes, because 1808 rotation of a binary image

changes the type (left or right) of the nodes. Based on

this observation, the recursive function for right-nodes,

`Recur_Connect_Right ( )', can be easily described as follows:

Recur_Connect_Right (Start-Node)

BeginC-node� Start-Node;

Repeat {

k� The index of the row containing C-node;

F-node�Get the `front right-node' of (k 2 1)-th row;

Identify the connectivity relation between C-node &

F-node;

If (`F-node is AFTER C-node')

then Recur_Connect_Right (F-node);

Else If (`F-node & C-node are CONNECTED')

then {C-node.link� F-node, C-node� F-node}

} Until (`F-node is BEFORE C-node' or

S.C. Park, B.K. Choi / Computer-Aided Design 33 (2001) 571±579576

Fig. 9. Connectivity-nets in the making, (a) Extraction of links of left-nodes; (b) Extraction of links of right-nodes.

Fig. 10. Recursive function, `Recur_Connect_Left ( )'.

Page 7: Boundary extraction algorithm for cutting area detection

F-node� �NULL);

R-node�Get the `rear right-node' of (k 2 1)-th row;

Identify the connectivity relation between C-node &

R-node;

If (`R-node is AFTER C-node' or R-node�NULL)

then C-node.link� C-node.prev;

Else If (`R-node & C-node are CONNECTED')

then C-node.link� C-node.next;

End.

Based on the two recursive functions (Recur_Connec-

t_Left/Right), an algorithm completing an initial

connectivity-net is described as follows. The input to

the algorithm is an initial connectivity-net having no

connectivity information between nodes:

Construct_Connectivity_Net (connectivity-net)

BeginRepeat { //± Extract links of Left-Nodes

(1) start-node� Get a node having the lowest row

index among the front left-nodes in the connectivity-

net;

(2) if (start-node!� NULL) Recur_Connect_Left(start-node);

} Until (start-node � � NULL);

Repeat { //± Extract links of Right-Nodes

(3) start-node� Get a node having the highest

row index among the front right-nodes in the connec-

tivity-net;

S.C. Park, B.K. Choi / Computer-Aided Design 33 (2001) 571±579 577

Fig. 11. Progress of the connectivity-net construction, (a) Initial connectivity net; (b) After Recur_Connect_Left (Na); (c) After Recur_Connect_Left (Np);

(d) After Recur_Connect_Right (Nt); (e) After Recur_Connect_Right (Np); (f) After Recur_Connect_Right (Nn).

Page 8: Boundary extraction algorithm for cutting area detection

(4) if (start-node!� NULL) Recur_Connect_-Right (start-node);

} Until (start-node� � NULL);

End.

The function Construct_Connectivity_Net will be

explained with the help of the example shown in Fig.

11. Fig. 11a shows an initial connectivity-net, input of

the function Construct_Connectivity_Net. In Step 1, the

start-node becomes node Na, by selecting a node having

the lowest row index among the front left-nodes in the

connectivity-net. As explained in the previous ®gure,

Recur_Connect_Left (Na) extracts links of left-nodes

as shown in Fig. 11b. Then, it selects node Nq as the

start-node in Step 1. By linking node Nq, there is no

more unlinked left-node (Fig. 11c).

In the case of right-nodes, the ®rst start-node is Nt (in Step

3), a node having the highest row index among the front

right-nodes in the connectivity-net. Fig. 11d shows the

connectivity-net after `Recur_Connect_Right (Nt)'. The

next start-node becomes node Np and the link of Np is

extracted in Fig. 11e. Then, it selects node Nn as the start-

node. With the recursive function `Recur_Connect_Right

(Nn)', we obtain the complete connectivity-net, as shown

in Fig. 11f.

The time complexity of the suggested algorithm is O(n),

where n is the number of runs. In Step 1, getting a start-node

from the connectivity-net can be done in constant time by

maintaining the list of rows having valid front left-nodes

(not NULL). The recursive function (Recur_Connect_Left)

works with O(j), where j is the number of linked left-nodes

in Step 2. Each node is linked just one time and the number

of left-nodes (right-nodes) is equal to the number of runs.

4. Empirical performance tests

The proposed algorithm was implemented in C language

and test runs were made on an engineering workstation. Fig.

12a shows an injection molding-die for the front mask of a

TV monitor. The boundary curves of the wall areas are

extracted from the model as shown in Fig. 12b.

Another example shown in Fig. 13a is a stamping-die for the

fuel tank of a passenger car. At 10 different heights, contour

curves are extracted from the model as shown in Fig. 13b.

Fig. 14 shows the execution times plotted against the

number of the runs for the contour curves in Fig. 13. We

observe that the algorithm more or less behaves linearly

with respect to the number (n) of runs.

5. Discussion and conclusions

This paper presents a procedure to extract cutting areas

from a Z-map for sculptured surface machining. Cutting

areas, corresponding to machining features (®llet/uncut

area, wall/¯oor, contour curve), can be extracted from a

Z-map storing a speci®c attribute of a sculptured surface,

such as curvature, slope and Z-values. The core of the proce-

dure is a `boundary extraction algorithm' to extract bound-

aries and identify the inclusion relationships among the

boundaries from a run-length coded binary image. The

time complexity of the boundary extraction algorithm is

O(n), where n is the number of runs.

In computer vision, there are two prior algorithms [7,8]

that can be applied to the boundary extraction problem. The

time complexity of Kim's algorithm [7] is worse than O(n),

where n is the number of runs, because the algorithm needs

S.C. Park, B.K. Choi / Computer-Aided Design 33 (2001) 571±579578

Fig. 12. Wall area extraction, (a) Monitor Model; (b) Boundaries De®ning Wall.

Fig. 13. Contour curve generation, (a) Fuel Tank Model; (b) Countour Curves.

Page 9: Boundary extraction algorithm for cutting area detection

search operations when it ®nds connectivity between runs.

Zingaretti's paper [8] employs the concept of a `minimal

run' and the time complexity is O(m), where m is the

number of `minimal runs' which is always larger than n

(the number of runs). Besides, both algorithms work with

a set of templates (3 £ 3 or 3 £ 2 window) to match pixel

patterns, which may complicate the algorithms. Based on

these facts, the proposed algorithm has advantages over the

prior algorithms in terms of ef®ciency and simplicity: (1) the

time complexity is O(n), where n is the number of runs and (2)

it does not require a set of templates to match pixel patterns.

Some applications may have additional requirements

about the boundary curves, output of the suggested algo-

rithm. Two of the possible requirements are addressed: (1)

The extracted boundary curves may seem smooth, however,

they are bumpy in a magni®ed view Ð they are extracted

from a regular grid model. Fairing process may be used to

get smooth boundary curves for applications where smooth

boundary curves are required. (2) The precision of the

boundary curves is bounded by the precision of the regular

grid model (grid size). To achieve high precision of the

boundary curves, we can use a binary search method on

parametric surfaces (sculptured surface).

Acknowledgements

This research was supported by the Ministry of Science

and Technology of Korea, through a `National Research

Lab Project' grant to KAIST VMS Laboratory.

References

[1] Choi BK, Kim DH, Jerard RB. C-space approach to tool-path genera-

tion for die and mould machining. Computer Aided Design

1997;29(9):657±69.

[2] Choi BK, Kim BH. Die-cavity pocketing via cutting simulation.

Computer Aided Design 1997;29(12):837±46.

[3] Choi BK, Jerard RB. Sculptured surface machining. Dordrecht:

Kluwer, 1998.

[4] Choi BK. Surface modeling for CAD/CAM. Amsterdam: Elsevier,

1991.

[5] Lin AC, Liu HT. Automatic generation of NC cutter path from massive

data points. Computer Aided Design 1998;30(1):77±90.

[6] Freeman H. Computer processing of line-drawing image. Computer

Surveys 1974;6:57±97.

[7] Kim SD, Lee JH, Kim JK. A new chain-coding algorithm for binary

images using run-length codes. Computer Vision Graphics and Image

Processing 1988;41:114±28.

[8] Zingaretti P, Gasparroni M, Vecci L. Fast chain coding of region

boundaries. IEEE Transactions on Pattern Analysis and Machine

Intelligence 1998;20(4):407±15.

S.C. Park, B.K. Choi / Computer-Aided Design 33 (2001) 571±579 579

Fig. 14. Plotting of the test results.

Sang C. Park is a PhD student in the Depart-ment of Industrial Engineering at KAIST. Hereceived his BS and MS degrees from KAISTin 1994 and 1996, respectively. His researchinterests include geometric algorithms inCAD/CAM, sculptured surface NC machining,simulation, and virtual manufacturing system.

Byoung K. Choi is a professor of manufactur-ing systems engineering in the Department ofIndustrial Engineering at KAIST, which hejoined in 1983. He received a BS from SeoulNational University, an MS from KAIST, and aPhD from Purdue University, all in IndustrialEngineering. His research interests are in thearea of sculptured-surface modeling andmachining, CAPP for die-cavity machining,discrete event system modeling and simulation,and virtual manufacturing system.