Edge-edge relationships in geometric modelling

Edge-edge relationships in geometric modelling

Edge-edge relationships in geometric modelling J Flaquer, A Carbajal* and M A Mendez* Sections This paper describes some techniques for the geometric ...

468KB Sizes 0 Downloads 53 Views

Edge-edge relationships in geometric modelling J Flaquer, A Carbajal* and M A Mendez* Sections This paper describes some techniques for the geometric modelling of solids. The objects resulting from the regularized Boolean operations of union, intersection and difference are analysed. The edge-edge relationships play an important role in avoiding nonmanifold R-sets and in achieving a good edge splitting, before 'reconstructing' the new formed objects. A decision-tree is presented here to distinguish crossing, intersection and overlapping between pairs of edges, taking into account efficiency and roundoff errors. Previously, the different cases of overlapping are classified, keeping in mind the subsequent stages of selection and reconstruction. The authors have recently developed Model - a new solid modeller for tridimensional objects bounded by flat faces.

(1)

geometric modefling, shapesynthesis, polyedro

The algorithms to decide the relative spatial locations of two line segments are strongly related to the classifying problems that have already been attempted by Tilove 1, Forrest2, and others. From the geometric point of view the stated problem is relatively simple. Its solution is one of the many interesting applications of analytic geometry. However, if this problem is approached from the computational point of view, the errors arising from computation must be taken into account. In this paper, an algorithm is supplied to determine unambiguously the relative locations between any pair of line segments. It is well-known that Boolean operations may produce nonregular objects, i.e. objects containing parts of different dimensionality, such as 'dangling' faces, or even nonmanifold R-sets like an object having an edge or a vertex lying on the interior of a face3 . A way to avoid both difficulties is not to perform the Boolean operation in case of a new edge belonging to more

J

(2)

(1)

/

/

Figure I. Union not allowed Centro de Estudios e Investigaciones Tecnicas de Guiptlzcoa, Spain *Escuela Supe~or de Ingenieros Industriales de San Sebastian (Universidad de Navarra), Spain

volume 19 number 5 june 1987

<_e Figure 2. Boundaries with no points in common

Figure 3. Intersection without need to be regularized

than two distinct faces, and also to consider the edge-edge edge-face or face-face overlappings as if the geometrical entities were touching each other with no points in common (see Figures I and 2). With this approach, the resulting objects do not need to be regularized, although care must be taken of the new boundaries by using exact rules of formation (see Figure 3). Evidently, the expressions reducing intersection and difference to union and negation A n B = (~,u~)

(1)

A - B = (AUB)

(2)

remain true and all the obtaining results must agree with them. Because edge-face and face-face relationships may be easily organized when the edge-edge relationships are known. These relationships are the most important when determining what must be done with the edges belonging to the operand objects.

0010-4485/87/050237-08 $03.00 © 1987 Butterworth & Co (Publishers) Ltd

237

Figure 4). Other connections among edges, loops and faces are less outstanding. The algorithm used in Model consists of the following five stages:

Le

"//~,~¢

Right

~/7//.//////////////////:

Figure 4. Hill and valley edges

• • • • •

detection of interferences edge splitting intersection of faces edge selection object reconstruction

The first stage allows a decision to be made about the relative locations of the operand objects. The operation is avoided if the objects are badly positioned s as shown in Figure 5. The second stage deals with the partitioning of edges belonging to the operand objects. Every edge of an object is cut by the faces of another one. The obtained pieces are new edges associated with the original object. When two edges overlap, they must be split as indicated in the next section. Some edges are eliminated at this second step and the remaining ones are grouped into three classes: • Class 1 : edges associated with the first operand • Class 2: edges associated with the second operand • Class 3: edges associated with both operands

(1)

The third stage allows new edges resulting from intersection between pairs of faces to be obtained. These edges are of Class 3 and they are added (if there are any) to the later ones. Eventually, almost all the edges are completely in, out or on the boundary of only one object, excepting the edges of Class 3 which lie on both boundaries. Edges of Class 3 are intersection edges or edges arising from overlapping (see Figure 6). The fourth stage selects the edges belonging to the new objects, according to the following rule for the union:

Class 1

.J~J-~-~

Class3

/

/

Class2

'

//J

Figure 5. Badly positioned objects

HOW TO RECONSTRUCT OBJECTS USING MODEL Before beginning with the edge-edge relationships, the method used in Model to reconstruct objects will be outlined. First, Model operates on either primitive objects (cylinders, spheres, cones, etc.) or composite objects resulting from elementary operations and geometrical transformations. The objects of Model are represented by boundary representation (B-rep) and also by the binary tree containing information about how they have been constructed (constructive solid geometry). All their faces are flat and organized in loops of edges. The edges are determined by knowing their initial and final vertices, left and right faces and if they are a 'hill' or a 'valley' edge. As usual, the normals to the faces point outward from the objects 4 (see

238

edges

[--/gure 6. Different classes of edges before union

,

/

/q

Figure 7. Selected edges for the union computer-aided design

t

a

t

t

b

I

Resulting pieces

Actions

a-b

B'

b-a

a-b

a-(a-b)

b-a

b-a

b-(b-a)

a-b

a-b

a-(a-b)

a-b

b-(b-a)

aNb

b-a

b-a

Figure 8. A c t i o n s over a pair o f overlapping edges

'Eliminate edges of Class 1, if they are on the boundary of the second object, and reciprocally, eliminate edges of Class 2, if they are on the boundary of the first one, except in the case that these edges belong to a face that touches another face and their normals are opposite'. The rules for intersection and difference are similar (see Figure 7). Finally, the fifth stage constructs the new objects. The edges are connected to form loops. The loops are organized in faces, the faces in shells, and the shells in objects. The structure of the new objects is the same as that of the operand ones. In fact, the first three stages occur simultaneously, because pairs of faces are compared for greater efficiency.

HOW TO SPLIT OVERLAPPING EDGES When two edges, a and b, overlap, a decision has to be made about the pieces to be retained and their respective classes. While deciding, it is necessary to keep in mind: the Boolean operation to be performed, contacts between the associated faces, and the contact between the edges themselves. To do this, five different actions are distinguished over the two overlapping edges, denoted A, B, B', C, and D (see Figure 8). If some pieces are the empty set then they are ignored. Figure 9 shows the effects of each action, taking into account the contacts between edges, numbered from 0 to 6. The contacts among faces are classified into four groups, of thirteen classes each, according to the four possibilities for the edges: • hill-hill • valley-valley • hill-valley • valley-hill

Figure 10 shows the actions to be performed depending on

volume 19 number 5 june 1987

both contact among faces and the corresponding Boolean operation. In Figure 10, Q - a n d Q* indicate how many normals are coincident and how many are opposite, respectively. The columns in Figure 10 follow four different patterns X, Y, Z, T, as indicated at the bottom of the Figure. The symmetry between Boolean operations and the four possibilities for the edges can be observed in Figure 11. This symmetry comes from equations (1) and (2). For each group it is easy to recognize the thirteen mentioned classes. It is only necessary to know the Q-and Q+ values, and also, what is the relation among the four new vectors introduced here. A hill or a valley edge has a pair of vectors L ^ E and E ^ R (see Figure 12). There are four possible relations for a pair of edges, denoted (a) - (d) in Figure 13. Figure 14 shows how to recognize the thirteen classes for the four cases: hill-hill, valley-valley, hill-valley and valley-hill. If the two edges a and b do not overlap they have to be split at their intersection point (if any) and the pieces will be of Classes 1 and 2, respectively.

RELATIVE LOCATIONS OF THE SUPPORT LINES The relative locations of the support lines corresponding to a pair of edges are studied in the following. The edges are denoted by E1 = (P,Q) and E~ = (R,S), where P,Q and R,S are the initial and final vertices of each edge, respectively. The edges determine two 'support lines' that contain them. We shall call these support lines rl and r2, whose parametric equations are X l =Xp+~.(XQ-Xp)

rl ~ Yt =YP + X (go - y p ) z~ = zp + X (z e - zp)

x2 =xR +~ (Xs-XR) r2 =- Y2 = YR + I~ (Ys - YR

(3)

)

z2 =zR +~ (zs - z R )

referred to a Cartesian reference system. If we identify the lefthand members of the above equations, the following linear system of three equations with two unknowns X and/a is obtained. (XQ - xp) ~, + (x R - x s ) 11 = x R - x p

(Yo - Y P ) ~k + (YR - Y S ) IJ =YR - Y P

(4)

(ZQ- Zp) • + (Z R - ZS ) /.I = Z R - Zp

An elementary analysis through the ranks of this system will decide if the support lines: • cross without intersection • are parallel lines • intersect on a point • are coincident lines Now, a certain quantity e is introduced, it is fixed beforehand (the error margin) and is strictly positive and sufficiently small. For this paper, two vertices will be coincident when its Euclidean distance is less than or equal to e. Taking into account this error margin e, and because the 239

J //2 Actions

x,x5

'

,/

I i

I

¢/

'

i

/

/

2

I

/



2/

[3'

C

/

¢

2/

/

1/2"

V

Figure 9. Effects of each action indicating the c/asses of the obtained pieces final purpose is to analyse the spatial relationships between the two edges, it is not helpful to follow the mentioned mathematical analysis, because the only cases of interest for this paper's purposes are the last two in the list. We shall proceed in the following way: defining two infinite cylinders Ci and C2 with radius e associated with the support lines r, and r2 (see Figure 15). Then we study if both vertices of E I fall inside C2, and vice versa. This study follows the decision-tree diagram of Figure 16, in which the nodes correspond to the question of whether a particular vertex is inside the other cylinder. For example, the branch at the far left that ends at case ] signifies that P and Q are inside C2 and R and S are inside CI too: the support lines are 'coincident'. Another example is the path that ends at case 6: this means that P and Q are outside C2, R is inside Ci and S is outside CI, so it can be concluded that the vertex R is the intersection point R*. An exhaustive study of the decision-tree diagram leads to ten cases that can be classified in three different groups:

• The support lines are coincident. (Case no. I) (see Figure 19). The following sections discuss the three groups separately.

• The support lines have an intersection point which is a vertex. (Cases no. 2, 3, 6, 7, 9, 10) (see Figure 17). • The support lines can have an intersection point which is not a vertex. (Cases no. 4, 5, 8) (see Figure 18).

With this value /a*, the coordinates of P* are obtained directly from equation (3) (it must be realised that the denominator in equation (5) never vanishes). Thus, it can be said that the two edges intersect at P*

240

INTERSECTION POINT IS A VERTEX In this group, the intersection point of the support line is a vertex of one of the edges. We want to know if the vertex belong to the other edge. Suppose that vertex P falls inside the cylinder C2 defined by the support line r2 (case no. 9). (The remaining cases would be treated analoguously.) Then, substitute P by its orthogonal projection P* onto the line r2 (see Figure 20). The value of/a in equation (3) for the point P* is given by the expression

~*

(Xp- XR)(X S - X R) + (yp- yR) (yS-YR) + (Zp-ZR)(Z S-ZR) =

(5)

(Xs -XR) 2 + (YS -YR) 2 + (Z5 -ZR)2

computer-aided design

Classes

Actions

H-H

Q-Q+I U

N

V-V -

Actions Q- Q+ U

H-V

F'I --

Actions Q- Q+ u

f3

ctions A

-

;B'

A

I

A

A

B

A

A

B'

B'

B

A

A A

D

A D

B'

B

A

B'

Ac~'

B'

B

A

B' C

A

B'

B

A

B'!C

B'

B

A

B'

1-V A

O O A

PT~ ,



i C

~7~

A

B

A

B

cA

.... - ~ 2

7~

B

A

C

--.•

B'

C

B'

C

..1 C

A

~A~

B

D

J•- - ~ "

A C B'

~

D

A

D

D

D

D

D A

D

D

D

D

D

D

D D

A

D

B'

B'

B

A

A~ .

A~

C

Fr~ D

D

D

F~D

A

B

7"r~ 10

B

D

D

~:,

Fq~ D

B A

B'

D

A

13

A ..,~.", ~ ' ..~..

f ~

~

B

D

C

D

B

A

~

B'

D

A

D

B'

C

-•

Y

X

Z

X

Y

Patterns

I °

111o

~

D A

OA

D

B

B'

Ns-

~N~Patterns

D

B'

N-r

~

B"D

Fq~ 12

Ao N-r

D

B

•"~

~

rq~ 11

---r ....

N-r

AC D ~

~A

c

A

D

A

C

Z

T

Y

T

Z X

% 0 0

B

B'

iO--I-6Patterns

Patterns

Figure 10, Actions to be performed volume 19 number 5 june 1987

241

H-H

V-V

H-V

V-H

Q 7

Y

E1

/

C~ Y

C/

X

/

T ~" rl

Z

E2

J5

/

Y

Figure 11. Boolean operations and groups of contact /

/

r2

L

E

R

z

Figure 15. Cylinders and support lines

if ,u* satisfies

(6)

-e/A2 ~< /~* ~< 1 + e/A 2 EnR

where A 2 is the length of the edge E:.

Figure 12. Associated vectors

(1)

INTERSECTION POINT IS NOT A V E R T E X In this group, the support lines can have a point in common that is not a vertex. Case no. 8 requires checking a parallelism condition such as I sine I =

a

II P-Q II. II R-S II

b

~< ~

(7)

where ~ is a very small positive quantity. If the above condition is true, the lines will be parallel and then the process is stopped with the conclusion that the edges have no points in common. For cases no. 4, 5 and 8 (if the parallelism condition is not true) we continue solving the system of linear equations (4), that can be expressed in matrices by

c

kQ-XXR-X-I] YQ-YP

d

YR - Y S [

Q -zp

Figure 13. Relations between the two pairs of associated

ZR - z s A

=

YR -YP

(8)

R -zP

or, in s h o r t e n e d f o r m ,

vectors

[A] {w}

=

{h}

(9)

H-H or V-V

VI-q VI-~-I I - ~ 1

2

3

~ 4

7

~ 10

11

5

VI-¢I 9

6

8

12

13

H-V or V-H

vm r~-~ ~ 1

2

r~q 3

ED3

F¢~

(d) ] (C)

(b)

(a)

(d)

(c)

(d)

(c) I (b)

(a)

4 [ 7

10

11

5

9

6

8 I 12

13

Figure 14. Classification o f the thirteen classes

242

where [A] is the system matrix of rank two, {w} is the column vector of unknowns, and {h} is the column vector of the independent terms. The system of equations (8) always has a solution in the least square sense, since the matrix [A] is full-rank. Premultiplying the two sides of expression (9) by the transpose of [A] gives ( [ A ] T[A] ) {w} = [A] T{h)

(10)

This system can be solved because [A] T[A] is a nonsingular matrix, giving

computer-aided design

yes M

yes ~"

yes

yes ~1¢

• no

yes ¥

~i no

9

10

yes

no

3

• no

yes

yes

no

Intersecting support lines

Coincident support lines 2

• no

no

Intersecting support lines

I

s*

I

Support lines can

I

-

I

i rsect

4

* - Intersection point

7

no

8

Are they parallel?~

~

yes

Intersection point (if any) is obtained

Study of I overlapping

No points in common

Figure 16. Decision-tree diagram

"


Figure 19. Support lines are coincident

rl

Figure 17. Intersection point is a vertex

E2

rl

Figure 18. Intersection point is not a vertex

volume 19 number 5 june 1987

{w*}~:

I'J

: ([A] T[A] )-' [A] T{h}

(11)

/I

The QR decomposition of [A] T[A] provides a more reliable method than the direct inversion of such a matrix 6. Substituting the encountered values of X* and/~* in the corresponding expressions of equations (3) gives the points P~' and P~', one on each support line. Suppose that the support lines 'intersect' if P~ and P~' are coincident points; in this case, the middle point P* is taken as the intersection point. To make sure P* lies on the edges El and E2, (as a consequence it is possible to say that the edges intersect) the following conditions must hold -e/A1 ~< X* ~< 1 + e/A1 -e/~2 ~< /~* ~< I + e/A 2

(12)

243

Q

/ P ( p*

R

E2

S

Figure 20. Orthogonal projection o f P onto r2

where AI and A2 are the lengths of E1 and E2, respectively.

Figure 21. Constructing the line r

SUPPORT LINES COINCIDING In this third group, a line r is constructed from the support lines that verifies: • it lies on the geometric centre G of the four vertices, P, Q, R,S • its direction is the same as the vector W defined, by the expressions

1

PQ RS __ + _ ) W= ~ ( IIPQII IIRSII

ifPQ.RS~>0

(14)

1 PQ W= - ( - 2 II ~ II

ifPQ.RS<0

(15)

RS - - ) It ~ II

See Figure 21. The parametric equations of the line r are X = X G +

17a

(16)

r= -- y = y G + ~ b Z = Z G +17C

If the orthogonal projections of P, Q, R, S are found on the line r, denoted by P*, Q*, R*, S*, (see Figure 22), they can be arranged in ascending values for r/from equations (16). It can be concluded that the edges will not overlap if,

(17)

+e
or

and that the edges will have only one point in common if e

(18)

or

I n 1 * - n 4 * l ~< e Otherwise the edges will overlap.

CONCLUSIONS The cases of crossing, intersection and overlapping of two edges have been analysed, and a decision-tree has been

244

R*

O*

W

S*

Figure 22. Orthogonal projections onto the line r

supplied, taking into account the splitting that arises when the Boolean operations of union, intersection or difference are used. The special case of overlapping has been studied separately, and the method which is used in Model has been explained in this paper.

ACKNOWLEDGEMENTS The authors thank the Comisi6n Asesora de Investigaci6n Cientifica y T6cnica (CAICYT) of the Spanish Government whose funds have made possible the development of the educational-research CAD program. This article is part of a Doctoral Thesis that is being carried out at the Escuela Superior de Ingenieros Industriales de San Sebastian, Universidad de Navarra, Spain.

I Tilove, R B 'Set membership classification: a unified approach to geometric intersection problems' IEE Trans. Comput. C-29 No I 0 (October 1980) pp 874-883 2 Forrest, A R 'Computational geometric in practice' NA TO ASI Series Vol F] 7 Springer-Verlag (1985) 3 Requicha, A A G 'Representation for rigid solids: theory, methods and systems' ACM Comput. Surveys Vol 12 No 4 (December ]980) pp 4 3 7 - 4 6 4 4 Braid, I C 'The synthesis of solids bounded by many faces' Communications o f the ACM Vol 18 No 4 (April 1975)

n* + e
In*-na*l~

G

REFERENCES

(a,b,c) being the components of the normalized vector W.

n*

P*

5 Arbab, F 'RSC: a calculus of shapes' Prec. CAD-84 Butterworth (1984) 6 Lawson, C L and Hanson, R ] Solving least squares problems Englewood Cliffs, Prentice Hall, New York (1974) 7 Requicha, A A G 'Mathematical models of rigid solid objects' Production Automation Proje.ct TM-28 University of Rochester (November ] 977) 8 Flaquer, ], Mendez, M A and Idarreta, J 'Model: un nuevo programa para el modelado geom6trico de escenas tridimensionales' Automatizaci6n de la Producci6n (May/June ]986) pp 59 62

computer-aided design