s := fj0 2 f1;:::;M1g: f2 s (v1 j0) = minff2 s (v1 j ) : j = 1;:::;M1gg: If card(J1 s ) = 1 then case 4 is present, and if card(J1 s ) = 2 then case 5 occurs. In case of card(J1.
Als Manuskript gedruckt
Technische Universitat Dresden Herausgeber: Der Rektor
Construction of a -function for two convex polytopes Y. Stoyan, M. Gil, T. Romanova, J. Terno y, G. Scheithauer MATH-NM-13-2000 September 2000
In the nal stage of this work, Prof. Dr. Johannes Terno passed away after a long serious illness. He will stay in our mind for ever.
Contents 1 Introduction
3
2 Examples of -functions for 2D objects
7
2.1 -function of two circles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 -function of two rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3 -function of a rectangle and a circle . . . . . . . . . . . . . . . . . . . . . 10
3 0-level surface of a -function for convex polytopes
11
4 ?function of two convex polytopes
16
5 Algorithm for constructing 12
18
6 Considering two parallel faces
20
7 Final remarks
21
Supported by Germany Scienti c Society
2
Construction of a -function for two convex polytopes Y. Stoyan, M. Gil, T. Romanova, J. Terno, G. Scheithauer September 2000 Abstract In this paper, the analytical description of -functions for two convex polytopes is investigated. These -functions can be used for mathematical modelling of packing problems in the three-dimensional space. Only translations of the polytopes are considered. The approach consists of two stages. At rst the 0-level surface of a -function is constructed, and secondly, the surface is extended to get the -function. The method for constructing the 0-level surface is described in detail, and therefore also for computing a -function.
1 Introduction Cutting and Packing problems are of wide interest in practical application as well as in scienti c investigations. There is a long stream of publications concerning various variants of cutting and packing problems. But only a little part of them is devoted to three-dimensional (3D) placement problems of irregular (but convex) polytopes. For an annotated review we refer the reader to [1]. One of the most important topics when 3D placement problems have to be modelled (cf. [1], [8], [9]), is the construction of such a function that describes the interaction between a pair of objects T1 and T2 which have to be placed within a lager region. Here an object is understood to be a '-object de ned in [11], i.e. represents a model of a real object in IR2 or IR3. From a set theoretical view point the values of such a function have to dierentiate the following three situations: the two polytopes T1 and T2 intersect each other, i. e. intT1 \ intT2 6= ; where intT is the interior of T ; they do not have common points, i. e. T1 \T2 = ;; or they are tangent, i. e. intT1 \ intT2 = ; and frT1 \ frT2 6= ; where frT denotes the frontier of a set T . In a more packing and cutting oriented formulations, it is necessary to construct such a function which depends on the mutual location of two polytopes T1 and T2 and its values give a numerical evaluation for the following three cases: 1. T1 and T2 are intersected, i. e. T1 and T2 have common interior points; 3
2. T1 and T2 are disjunctive, i. e. T1 and T2 do not have common points; 3. T1 and T2 are in contact, i. e. T1 and T2 have only common frontier points. Moreover, it is desirable, the required function values shall be a measure of intersection of T1 and T2 in the rst case, and as well as should de ne or at least estimate the shortest distance between the polytopes in the second case. Within this paper, only congruent transformations of the objects in form of translations are considered. The objects Ti are given with respect to their eigen coordinate system, and the translated object can be described by
Ti(ui) := fX 2 IR3 : X = ui + Y; Y 2 Tig where ui = (xi; yi; zi) is the vector of placement parameters xi; yi; zi of Ti (i = 1; 2). As usual, ui speci es the location of the origin of the eigen coordinate system of Ti with respect to the coordinate system of the region where the objects have to be placed. The origin is also said to be the pole of Ti. In [11] -functions are introduced in order to formalize the interaction of a pair of polytopes T1 and T2. De nition 1 A continuous function : IR6 ! IR is called -function of T1(u1) and T2(u2) if it possesses the following characteristic properties:
> 0, if T1(u1) \ T2(u2) = ;, (u1; u2) = 0, if intT1(u1) \ intT2(u2) = ;, frT1(u1) \ frT2(u2) 6= ;, < 0, if intT1(u1) \ intT2(u2) 6= ;. 8 > > > < > > > :
(1)
Let := f(u1; u2) 2 IR6 : (u1; u2) = 0g. is called the 0-level surface of -function. Furthermore, let G = f(u1; u2) : intT1(u1) \ intT2(u2) = ;g:
De nition 2 A -function (u1; u2) is said to be normalized if its values are equal to the shortest Euclidean distances between T1(u1) and T2(u2) subject to (u1; u2) 2 G. A -function of T1 and T2 can be obtained by a natural approach. To this end the following optimization problem has to be solved for any (u1; u2) 2 G: (u1; u2) = min 3 fkX1 ? X2k : f1(X1 ? u1) 0; f2(X2 ? u2) 0g ; X1 ;X2 2IR
(2)
where fi(X ) = 0 is the equation of frTi provided that
fi (X ) = > 00;; ifif XXi 22= TTi; i = 1; 2: i i (
kk denotes the Euclidean norm. 4
(3)
The solving of problem (2) can be signi cantly simpli ed if either u1 = 0 or u2 = 0 is assumed, i.e. either T1 or T2 is considered to be xed. Then one of the two problems has to be solved: 1(u1) = min 3 fkX1 ? X2k : f1(X1 ? u1) = 0; f2(X2) = 0g 8(u1; 0) 2 G; (4) X1 ;X2 2IR
or the problem 2(u2) = min 3 fkX1 ? X2k : f1(X1 ) = 0; f2(X2 ? u2) = 0g 8(0; u2) 2 G: X1 ;X2 2IR
(5)
Then the function (u1; u2), (u1; u2) 2 G, is built either by (u1; u2) := 1 (u1 ? u2) or by (u1; u2) := 2 (u2 ? u1), respectively. The function (u1; u2) speci es the shortest distance between T1(u1) and T2(u2), i. e. between T1 translated by vector u1 and T2 translated by vector u2. Hence, (u1; u2) 0 for all (u1; u2) 2 G. We construct a function (u1; u2) as a continuous extension of (u1; u2) on the entire space IR6 so that (u1; u2) jG = (u1; u2) and (u1; u2) < 0 for all (u1; u2) 2 IR6nG. It is evident, the extension of (u1; u2) may be realized by an in nite number of ways. However the extension should be natural, simple and as a rule, they should satisfy some additional requirements. For example, a -function should be such that jr(u1; 0)j = 1 for (almost) all (u1; 0) 2 IR6 n G, or such that it is smooth (almost) everywhere on IR6 n G. In addition, the complexity of constructing a -function should not be larger as the complexity of the construction of a -function. Thus, the function (u1; u2) is constructed in the following by means of solving one of problems (2), (4) or (5) and an extension of (u1; u2) in such a way that almost everywhere r(0; u2) R6nG = 1 (or r(u1; 0) R6nG = 1) is realized. A function (u1; u2) constructed in this manner, possesses some certain properties which will be required later. 1. Because of de nition, (u1; u2) = (u1 ? u2; 0) = (0; u2 ? u1) 8 (u1; u2) 2 G:
2. The surface 12 = fu2 2 IR3 : (0; u2) = 0g is congruent to the frontier of the Minkovsky sum T12 = T1(0)+(?1)T2(u2) provided that T1 and T2 do not have precise entrances ([7]), i.e.
12 = fr(T12) = fr(fX2 ? X1 : X1 2 T1(0); X2 2 T2(u2)g): Analogously, using T21 = T2(0) + (?1)T1(u1); 21 := fu1 2 IR3 : (u1; 0) = 0g; then
21 = fr((T21) = fr(fX1 ? X2 : X1 2 T1(u1); X2 2 T2(0)g): It should be noted, the sets 12 and 21 are known as hodographs of functions for dense placement of objects ([10]). 5
3. The surfaces
fu 2 IR3 : (u; 0) = g and are central symmetric for any 0, i.e v 2 fu 2 IR3 : (u; 0) = g ()
fu 2 IR3 : (0; u) = g ?v 2 fu 2 IR3 : (0; u) = g:
4. In particular, for = 0 we have
12 = fu 2 IR3 : (0; u) = 0g = ?fu 2 IR3 : (u; 0) = 0g = ? 21; i. e. surfaces 12 and 21 are central symmetric, 5. If both T1 and T2 are central symmetric sets then there exists a -function such that (u; 0) = (0; u) for all (u; 0) 2 G. 6. If T1 and T2 are polytopes then their -function can always be speci ed by a piecewise linear function. 7. If T1 and T2 are nonempty convex polytopes then 12 and 21 are the frontier of nonempty convex polytope T12 and T21, respectively. In order to compute as a result of solving one of problems (2), (4) or (5), in general a Lagrangian approach, complete dierential method or other methods for nonlinear optimization problems with restrictions can be used. But in some special cases the problems can be solved in explicit form. For example, q
(u1; u2) = ku2 ? u1k? (R1 + R2) = (x2 ? x1)2 + (y2 ? y1)2 + (z2 ? z1)2 ? (R1 + R2) (6) is a normalized -function of two solid spheres with radii R1 and R2 and center points u1 and u2. However it should be noted, if the functions f1; f2 in (3) are not smooth or they are curves of order greater than two, then problems (2), (4) and (5) are solved as a rule by means of iterative methods. Furthermore, the solution obtained is in general an approximate one. In dierence to the general case, there is a straightforward possibility to construct a -function of two convex polytopes T1 and T2 which is based on properties of -functions. The approach considered below is reduced to the following algorithm: 1. The polytope T1 is considered to be xed, i.e. u1 = 0 is used. 2. Facettes of the polytope T12 are constructed, i. e. 12 is calculated. 3. Equations of all planes which contain these facettes are constructed taking into account a suitable orientation of their normal vectors. 4. Based on the equations obtained in step 3, a collection of functions is formed which speci es (0; u2). After that a -function 12(u1; u2) is constructed. 6
2 Examples of -functions for 2D objects In order to illustrate the construction strategy for obtaining -functions three examples with simple geometric objects in IR2 are considered next.
2.1 -function of two circles Let C1 and C2 be two circles of radii r1 and r2, respectively. When a circle Ci (i 2 f1; 2g) is placed with his center (pole) at (xi; yi), then the notation Ci(xi; yi) is used. Without loss of generality (x1; y1) = (0; 0) is assumed during the construction of a function. Then it is evident if the pole (x2; y2) of C2 moves along the curve
'(x2; y2) = 0; where '(x; y) = (r1 + r2)2 ? x2 ? y2; then the circles C1(0; 0) and C2(x2; y2) are tangent. It means, the equation may be taken to determine the 0-level surface of a -function of two circles. Obviously, the function '(x; y) is everywhere de ned in IR2. Therefore, for an extension of the function on the whole space IR2 to obtain the corresponding -function, it is sucient to realize only an appropriate orientation of '(x; y). It is easy to verify, if the placement parameters (x2; y2) are such that C1(0; 0) \ C2(x2; y2) = ; then ?'(x2; y2) > 0, and if intC1(0; 0) \ intC2(x2; y2) 6= ; then ?'(x2; y2) < 0. Hence, 12(0; 0; x2; y2) := ?'(x2; y2) = ?(r1 + r2)2 + x22 + y22; Φ (0,0, x 2 , y 2 )
0 x2
r1+ r2
y2 –(r1+ r2)2
Figure 1: -function of two circles
7
12 (0; 0; x2; y2) speci es a paraboloid of rotation with vertex coordinates (0; 0; ?(r1 + r2)2) (Fig. 1). Because of general properties of -functions, a -function of two circles C1 and C2 is as follows: 12 (u1; u2) = (x2 ? x1)2 + (y2 ? y1)2 ? (r1 + r2)2: Another possibility for constructing a -function of two circles arises when instead of ' the following function ' is used: '(x; y) = r1 + r2 ? x2 + y2: It is easy to see, equations '(x; y) = 0 and '(x; y) = 0 de ne the same circumference of radius r1 + r2 whose center is at the point (0; 0). Therefore ' can also be used to construct a -function. Regarding an appropriate orientation of ' one obtains 12 (x1; y1; x2; y2) = (x2 ? x1)2 + (y2 ? y1)2 ? r1 ? r2: 12(0; 0; x2; y2) speci es a cone with vertex coordinates (0; 0; ?(r1 + r2)) (Fig. 2). The functions 12 and 12 dier for example by their modulus of gradients, namely p p jj 5 12jj = 2 2 (x2 ? x1)2 + (y2 ? y1)2; jj 5 12jj = 2: e
q
e
e
e
e
q
e
e
e
q
e
Φ (0,0, x 2 , y 2 )
0 x2
r1+ r2
y2 –(r1+ r2)
Figure 2: -function of two circles The function value 12 (x1; y1; x2; y2) is equal to the shortest distance between C1(x1; y1) and C2(x2; y2) if C1(x1; y1) \ C2(x2; y2) = ;; i.e. this function is a normalized -function according to de nition 2. Furthermore, min12 (x1; y1; x2; y2) = ?(r1 + r2)2 and min 12 (x1; y1; x2; y2) = ?(r1 + r2), i. e. the "measure" of maximal overlapping of C1(x1; y1) and C2(x2; y2) is equal to ?(r1 + r2)2 or to ?(r1 + r2), respectively. e
e
8
2.2 -function of two rectangles Let R1 and R2 be rectangles with size parameters 2a1; 2b1 and 2a2; 2b2, respectively. It is assumed that their poles coincide with their symmetry centers. Again the placement parameters are denoted with (x1; y1) and (x2; y2), respectively. As above, (x1; y1) = (0; 0) is considered rst. As it is known [10], [6] if the pole (x2; y2) of R2 moves along the frontier of the rectangle R12 (Fig.3) which is determined by the four vertices (A; B ), (?A; B ), (?A; ?B ), (A; ?B ), where A = a1 + a2, B = b1 + b2, then the rectangles R1(0; 0) and R2(x2; y2) are tangent. Hence, R12 = f(x; y) 2 R2 : ?A x A; ?B y B g; 12 = frR12: It means that frR12 is the 0-level surface of 12(0; 0; x2; y2) de ned for R1(0; 0) and R2(x2; y2). Hence, a representation of frR12 by means of equations is needed. Let 1(x; y ) = x ? A; 2 (x; y ) = y ? B; 3 (x; y ) = ?x ? A; 4 (x; y ) = ?y ? B: Then, R12 = f(x; y) 2 R2 : i(x; y) 0; i = 1; : : : ; 4g and hence, frR12 = f(x; y) 2 R12 : (x; y) = 0g; where (x; y) := maxf 1(x; y); 2(x; y); 3(x; y); 4(x; y)g: In these de nitions an appropriate orientation is regarded so that (x2; y2) < 0 if intR1(0; 0) \ intR2(x2; y2) 6= ;: Since additionally (x2; y2) > 0 if R1(0; 0) \ R2(x2; y2) = ;; a -function is obtained as follows: 12(x1; y1; x2; y2) := (x2 ? x1; y2 ? y1): Note, min12(x1; y1; x2; y2) = maxf?A; ?B g. Thus, if A = B then 12(0; 0; x2; y2) speci es an inverted pyramid whose vertex has coordinates (0; 0; ?A). It means, the maximal intersection "measure" of R1(x1; y1) and R2(x2; y2) is equal to ?A. (In case of A 6= B then instead of the vertex an edge occurs .) It should be noted that the function 12(u1; u2) is not normalized since the value 12(u1; u2) is not equal to the shortest distance between R1(u1) and R2(u2) in the general case. This happens when (u1; u2) satisfy one of the following inequality systems 1(u2 ? u1 ) > 0 ; 1(u2 ? u1) > 0 ; 2 (u2 ? u1 ) > 0 ; 4(u2 ? u1 ) > 0 : 4(u2 ? u1 ) > 0 2(u2 ? u1) > 0 3 (u2 ? u1 ) > 0 3(u2 ? u1 ) > 0 (
(
(
(
A normalized -function of two rectangles R1 and R2 is considered in the next subsection as a particular case of a -function of a rectangle and a circle. 9
Φ(0,0, x2 , y 2 )
0 x2
–(a1+ a2)= –(b1+ b2) y2
Figure 3: -function of two rectangles
2.3 -function of a rectangle and a circle Let R be a rectangle with sizes 2a and 2b, and let C be a circle of radius r. The poles of R and C are at their symmetry centers. The placement parameters of R and C are denoted by (x1; y1) and (x2; y2), respectively. Again, in order to construct a -function, (x1; y1) = (0; 0) is assumed. Let A = a + r, B = b + r. It is easy to see, the rectangle and the circle are tangent if the pole (x2; y2) of C moves along the following curve which consists of straight-line segments and circular arcs alternatively: line((A;?b); (A; b)); arc((A; b); (a; B )); line((a; B ); (?a; B )); arc((?a; B ); (?A;b)); line((?A; b); (?A;?b)); arc((?A;?b); (?a;?B)); line((?a;?B ); (a;?B)); arc((a;?B ); (A;?b)): Let 1(x; y ) = x ? A; 2 (x; y ) = y ? B; 3 (x; y ) = ?x ? A; 4 (x; y ) = ?y ? B; and let '1(x; y) = (x ? a)2 + (y ? b)2 ? r; '2(x; y) = (x + a)2 + (y ? b)2 ? r; q
q
q
q
'3(x; y) = (x + a)2 + (y + b)2 ? r; '4(x; y) = (x ? a)2 + (y + b)2 ? r: The corresponding -function of R(0; 0) and C (x2; y2) can be described in the following form '1(x2; y2); if x2 a; y2 b; '2(x2; y2); if x2 ?a; y2 b; (7) 12(0; 0; x2; y2) := '3(x2; y2); if x2 ?a; y2 ?b; '4(x2; y2); if x2 a; y2 ?b; '(x2; y2); otherwise 8 > > > > > > < > > > > > > :
10
where '(x; y) := maxf 1(x; y); 2(x; y); 3(x; y); 4(x; y)g. However, such a representation of this -function 12 (0; 0; x2; y2) may be not suitable when an feasible region of an optimization placement problem has to be described since any word information must be excluded. Therefore we give additionally another representation of 12 (0; 0; x2; y2). In order to obtain this let us consider the rst quadrant, i. e. x 0 and y 0. If x > a and y > b then minf 1(x; y); 2(x; y)g < '1(x; y) but '1(x; y) gives the minimal distance. Therefore an additional function 12(x; y) = x + y ? a ? b ? r is used. Since 12(x; y) '1(x; y) for x a and y b, 12(x; y) 1(x; y) for x a and ?b y b, and 12(x; y) 2(x; y) for ?a x a and y b, we have for x 0 and y 0, 12(0; 0; x2; y2) = minf'1(x2; y2); maxf 1(x2; y2); 2(x2; y2); 12(x2; y2)gg. Summarizing, the following representation results: 12 (0; 0; x2; y2) = minf'0(x2; y2); '1(x2; y2); '2(x2; y2); '3(x2; y2); '4(x2; y2)g where
'0(x; y) := maxf'(x; y); 12(x; y); 23(x; y); 34(x; y); 41(x; y)g and 12(x; y) = x+y ?c; 23(x; y) = ?x+y ?c; 34(x; y) = ?x?y ?c; 41(x; y) = x?y ?c with c := a + b + r. Hence we have the following representation of a normalized -function of a rectangle and a circle: 12(u1; u2) = i=0 min ' (x ? x1; y2 ? y1): (8) ;:::;4 i 2 In order to construct a normalized -function of two rectangles R1 and R2 (as considered in example 2) now we have only to de ne r, a and b in a suitable manner. If
r := 0; a := a1 + a2 and b := b1 + b2 then 12 de ned in (7) or (8) is a normalized -function of the two rectangles R1 and R2.
3 0-level surface of a -function for convex polytopes Three-dimensional objects will be considered in the following. The description is restricted to the case of (full-dimensional) convex closed polytopes. In this section, one of the possibilities to construct the 0-level surface of a -function of two polytopes T1 and T2 is discussed. The description of an arbitrary closed polytope in IR3 can be done in various ways (see for example [2], [5], [3], [4]). In particular, any convex polytope is entirely determined by its vertices. In many cases, a convex polytope is considered as the intersection of a nite number of half spaces. Strongly related to these possibilities, a polytope can also be described by its faces (facettes). The latter variant seems to be most suitable for that case when non-convex polytopes have to be regarded. So the following investigations uses a face-oriented characterization of the polytopes as well as other opportunities. 11
z v13 v16 z
v14 v12
v32
v15 T1
v11
v42 v22 T2 O2
O1
v12
y
y
x
x
Figure 4: Example Let vjk = (xkj ; yjk ; zjk ); j = 1; 2; :::; Mk , denote the vertices of polytope Tk , k = 1; 2. Since Tk is assumed to be convex there exists a representation by means of half spaces. Let
Tk := f(x; y; z) 2 IR3 : fik (x; y; z) = Akix + Bik y + Cik z + Dik 0; i = 1; : : : ; Nk g For abbreviation, let Hik := f(x; y; z) 2 IR3 : fik (x; y; z) = 0g: Corresponding to formula (9), the polytope Tk can be described by its faces. Let D
k hki vik1; vik2; :::; vim i
(9)
E
denote the face determined by f(x; y; z) : (x; y; z) 2 Tk \ Hik g. Here the face hki is speci ed k of vertices of Tk , i. e. fv k ; v k ; :::; v k g fv k : j = 1; : : :; Mk g by a sequence vik1; vik2; :::; vim j i1 i2 imi i k k g. Since Tk is assumed and hi is the convex hull of fvik1; vik2; :::; vim to be full-dimensional, i a face is two-dimensional and therefore, has at least three vertices, i. e. mi 3 for any k of i. In addition, without loss of generality, it is assumed that the vertices vik1; vik2; :::; vim i each face form a counter clockwise circuit when looking from outside on Tk . In order to illustrate the notations, an example depicted in Fig. 4 is considered. The vertex coordinates of T1 and T2 are given in Table 1. The faces hki , i = 1; : : :; Nk , of Tk , k = 1; 2, are speci ed by appropriate sequences of vertices: D
E
D
E
D
E
D
E
D
E
h11 v111 ; v121 ; v131 ; v141 = h11 v11; v21; v31; v41 ; h12 v211 ; v221 ; v231 ; v241 = h12 v11; v41; v61; v51 ; D
E
D
E
D
E
h13 v311 ; v321 ; v331 ; v341 = h13 v21; v51; v61; v31 ; h14 v411 ; v421 ; v431 = h14 v31; v61; v41 ; 12
T1 v11 v21 v31 v41 v51 v61 x 4:0 0:0 0:0 4:0 2:0 2:0 y 10:0 10:0 10:0 10:0 4:0 4:0 z 11:0 11:0 19:0 19:0 11:0 19:0
T2 v12 v22 v32 x 5:0 2:0 3:0 y 15:0 15:0 14:0 z 4:0 4:0 10:0
v42 0:0 9:0 4:0
Table 1: Vertex coordinates of T1 and T2 D
E
D
E
h21 v112 ; v122 ; v132 h23 v312 ; v322 ; v332
D
E
D
E
h15 v511 ; v521 ; v531 = h15 v11; v51; v21 ; = h21 v12; v22; v32 ; h22 v212 ; v222 ; v232 = h22 v12; v32; v42 ; = h23 v22; v42; v32 ; h24 v412 ; v422 ; v432 = h24 v12; v42; v22 : D
E
D
E
D
E
D
E
D
E
D
E
The plane Hik , corresponding to hki , is determined by the equations Aki xkij + Bik yijk + Cik zijk + Dik = 0; j = 1; : : : ; mi; where vijk = (xkij ; yijk ; zijk ), is said to be oriented if fik (vjk) 0 for all j = 1; : : : ; Mk . In the following only oriented planes are considered. It is assumed that T1 is xed with u1 = (x1; y1; z1) = (0; 0; 0): Due to the properties of -functions cited in Section 1, the equation (0; 0; 0; x2; y2; z2) = 0 speci es the frontier of the convex polytope T12 := fu 2 IR3 : T1 \ T2(u) 6= ;g. Let 12 := fr(T12). By de nition, if u2 = (x2; y2; z2) 2 12 then T1(0) and T2(u2) are in contact or tangent, i.e. intT1 \ intT2(u2) = ; and fr(T1) \ fr(T2(u2)) 6= ;. This property implies that for any point u2 2 12 there exists a pair t, t of frontier points with t 2 frT1(0): and t 2 frT2(0) such that t = u2 + t. On the other hand, if T1(0) and T2(u2) are in contact (tangent) then u2 2 12 and u2 = t ? t. In order to construct 12 for two convex polytopes only the following six kinds to be in contact are of interest since the remaining do not lead to (two-dimensional) faces: a vertex or an edge or a face of T2 is in contact to a face of T1, a vertex or an edge of T1 is in contact to a face of T2, or an edge of T2 is in contact to an edge of T1. The approach of constructing 12, suggested below, consists of a successive generation of all faces of the surface 12 and the foundation of a set of corresponding half-spaces whose intersection represents the polytope T12. In more detail, under certain conditions any kind to be in contact may lead to a face of 12. Taking into account that T2 is movable and T1 is xed, successively any of the six kinds is considered and corresponding rules for constructing of appropriate faces of 12 are discussed. Furthermore sucient conditions are formulated when the face built is a face of 12. 1. A vertex of T2 is in contact to a face of T1. 1 be some face of T1. The plane Hi1 = f(x; y; z) : More precisely, let h1i vi11; vi12; :::; vim i D
E
13
fi1(x; y; z) = 0g, determined by h1i , is a separating plane of T1(0) and T2(u) for any u 2 IR3 with minffi1(v + u) : v 2 T2(u)g 0: Since T2 is assumed to be convex, Hi1 is a separating plane of T1(0) and T2(u) for any u 2 IR3 with minffi1(vj2 + u) : j = 1; : : : ; M2g 0: Let Ji2 := fj 0 2 f1; : : :; M2g : fi1(vj2 ) = minffi1(vj2) : j = 1; : : : ; M2gg: 1 determines a face of 12 congruent to h1i if Then it holds, the face h1i vi11; vi12; :::; vim i card(Ji2) = 1. Let Ji2 = fg. Then exactly one point of T2(u) may be in contact with T1 in case Hi1 is a separating plane. The set of translation vectors u of T2 is given by 0
E
D
fu 2 IR3 : u := u0 ? v2 ; u0 2 Hi1 \ T1(0)g: Hence, the corresponding face of 12, denoted by q, can be characterized by its vertices in form of 1 ? v2 : q = vi11 ? v2 ; vi12 ? v2 ; :::; vim i E
D
2. An edge of T2 is in contact to a face of T1. This situation occurs when card(Ji2) = 2. Let Ji2 = f; g, i. e. v2 and v 2 de ne an edge
e2 := fv : v = v2 + (1 ? )v 2 ; 2 [0; 1]g of T2(0). It is known, the edge e2 and the face h1i determine a face q of T12 as follows:
q = h1i + (?1)e2 := fv1 ? v2 : v1 2 h1i ; v2 2 e2g:
(10)
q is the Minkovski sum of h1i and (?e2). Hence the vertices of q are contained in the set Q = f(vij1 ? v2 ); (vij1 ? v 2 ); j = 1; 2; :::mig: In order to identify points in Q which are vertices of q, algorithms which work in two-dimensional space can be used. Therefore a projection of h1i and of e2 into a suitable plane (xy-, xz- or yz-plane) is carried out. If, e. g., the projection is done into the xy-plane, then a polygon prxy (h1i ) with vertices (x1ij ; yij1 ), j = 1; 2; :::ni; and a closed interval prxy (e2) with vertices (x2; y2 ) and (x2 ; y 2 ) are obtained. Using one of the algorithms to construct the 0-level surface of a -function in IR2 (see below), the vertices of the projection of q can be identi ed, and hence, the vertices of q. For example, if v1ij (x1ij ; yij1 ) and v2(x2; y2 ) form a vertex of polygon prxy (q) then (x1ij ? x2; yij1 ? y2 ; zij1 ? z2 ) are the coordinates of the appropriate vertex of q. The choice of the projection plane is dependent on the angle between Hi1 and the coordinate axises (cf. below). 3. A face of T2 is in contact to a face of T1: This means, the faces lie in parallel planes. As a consequence of the two rst situations, if card(Ji2) = 3 then a face of T2 may be in contact with T1. Let Ji2 = fj ; = 1; : : : ; g. Since vj2 are vertices of T2 there exists an index s with Hs2 is parallel to Hi1. 14
Similar to above, the face h2s and the face h1i determine a face q of T12 as follows: q = h1i + (?1)h2s := fv1 ? v2 : v1 2 h1i ; v2 2 h2s g: (11) Now, q is the Minkovski sum of h1i and (?h2s ). Hence the vertices of q are contained in the set Q = f(vij1 ? vj2 ); j = 1; 2; :::mi; = 1; : : :; g: Again, using a suitable projection and by means of algorithms for constructing twodimensional 0-level surfaces of -functions, the vertices of the projection of q, and hence also for q, can be calculated (see below). In similarity to 1. and 2., the cases 4. A vertex of T1 is in contact to a face of T2 and 5. 2 be An edge of T1 is in contact to a face of T2 can be handled. Let h2s vs21; vs22 ; :::; vsm s any face of T2. And let Js1 := fj 0 2 f1; : : :; M1g : fs2(vj1 ) = minffs2(vj1) : j = 1; : : : ; M1gg: If card(Js1) = 1 then case 4 is present, and if card(Js1) = 2 then case 5 occurs. In case of card(Js1) 3 no new situation arises. 6. An edge of T1 is in contact to an edge of T2: Let e2 be an edge of T2 connecting vertices vt2 and vh2, i. e. e2 = fv : v = vt2 +(1?)vh2 ; 2 [0; 1]g, and let e1 be an edge of T1 connecting vertices vt1 and vh1 (Fig. 5). These two edges determine a face q of 12 if and only if they are not parallel and the plane H = fv : v = vt1 + (vh1 ? vt1) + (vh2 ? vt2); ; 2 IR1g =: fv : f (v) = 0g separates T1(0) and T2(u2) with u2 = vt1 ? vt2, i. e. f (vj1) 0 for j = 1; : : : ; M1, and 0 f (vj2 + u2) for j = 1; : : : ; M2, and f (vj1) < 0 for j 6= t; h and f (vj2 + u2) > 0 for j 6= t; h. D
0
z
v1h
T2 (u 2 )
p3
T1(0)
p2 v1t
qi p4 p1
T2(0) ν t2 y
0 v h2
x
Figure 5: Two edges form a facette 15
E
The face q 12, determined by e1 and e2 may be represented as q = e1 + (?1)e2 = fv1 ? v2 : v1 2 e1; v2 2 e2g: Hence, the face q has the form of a parallelogram parallel to H . This parallelogram has the vertices p1 = vt1 ? vt2, p2 = vh1 ? vt2, p3 = vh1 ? vh2, and p4 = vt1 ? vh2. Note, when calculating such an parallelogram one has to take care with respect to numerical stability since in case of nearly parallel edges the resulting face q becomes very thin. Summarizing, the faces of surface 12 can be obtained as follows: 1. combine each face of T1 with an appropriate element (vertex, edge or face) of T2, 2. combine each face of T2 with an appropriate element (vertex or edge) of T1, and 3. consider any pair of edges of T1 and T2 which de ne a separating plane. The set of faces q computed in this way, describes the surface of 12.
4 ?function of two convex polytopes As a result of the investigations in the previous section, all faces qi = hvi1; : : :; vimi i ; i = 1; : : : ; N12; of 12 are obtained. Let fvj : j 2 J g denote the set of vertices of 12. It remains the task to nd a suitable representation of a corresponding -function. For that reason, for each face qi of 12 a (hyper) plane Hi = fu : fi(u) = 0g determined by fi(u) = fi(x; y; z) = 0 8 u 2 qi is constructed. The orientation of the plane is realized such that fi(vj ) 0 for all j 2 J . Obviously, fi can be calculated by solving the linear equation system fi(vij ) = 0; j = 1; 2; :::; mi; (12) and choosing of one suitable (with respect to orientation) solution. Since polytopes T1 and T2 are convex, using fi, i = 1; : : : ; N12, now T12 can be represented as T12 = fu 2 IR3 : fi (u) 0g = fu 2 IR3 : maxffi(u) : i = 1; : : : ; N12g 0g: Hence, if T2 is placed at u2 and u2 2 T12 then T1(0) and T2(u2) are in contact or they are overlapping. Consequently, 12 (0; u2) = maxff1(u2); f2(u2); : : :; fN12 (u2)g: Therefore, 12 (u1; u2) = maxff1(u2 ? u1); f2(u2 ? y1); : : :; fN12 (u2 ? u1)g: 16
is a -function of two polytopes T1(u1) and T2(u2). Example continued. For the convex polytopes T1 and T2 (Fig. 4) given in Table 1, the following 0-level surface 12 results, characterized by its 12 faces: q1 hv1;v2;v3;v4i, q2 hv5;v6;v1;v4i, q3 hv7;v8;v9;v10i, q4 hv10;v9;v5;v4; v3i, q5 hv11;v12;v13i, q6 hv12;v6;v8i, q7 hv2;v13;v7i, q8 hv1;v6;v12;v11i, q9 hv11;v13;v2;v1i, q10 hv2;v7;v10;v3i, q11 hv9;v8;v6;v5i, q12 hv13;v12;v8;v7i, where the coordinates of the vertices of 12 are given in Table 2. 12 is depicted in Fig. 7.
v1 v2 x 4:0 0:0 y 1:0 1:0 z 7:0 7:0
v3 0:0 1:0 15:0
v4 v5 4:0 0:0 1:0 ?11:0 15:0 15:0
Table 2 v6 v7 v8 v9 0:0 ?5:0 ?3:0 ?3:0 ?11:0 ?5:0 ?11:0 ?11:0 7:0 7:0 7:0 15:0
v10 v11
v12 v13
15:0 1:0
1:0 1:0
?5:0 1:0 ?1:0 ?3:0 ?5:0 ?4:0 ?10:0 ?4:0
z v10 v9 v5
v3 v4 v7 v8
v6
v2 v1 v13 v12 v11
0
y
x
Figure 6: -function of two circles The following linear functions result for 12: f1(u) = y ? 1, f2(u) = 3x ? y ? 11, f3(u) = ?3x ? y ? 20, f4(u) = z ? 15, f5(u) = ?z +1, f6(u) = ?6y ? z ? 59, f7(u) = ?36x + 30y ? 7z + 19, f8(u) = 9x ? 3y ? 2z ? 19, f9(u) = 6y ?5z +39, f10(u) = ?6x+5y ?5, f11(u) = ?y ?11, f12(u) = ?18x?6y ?7z ?71. Then 12 (u1; u2) = maxff1(u2 ? u1); f2(u2 ? u1); : : : ; f12(u2 ? u1)g:
17
5 Algorithm for constructing 12 Within this section a detailed algorithm is presented to compute the surface 12 of two convex polytopes which are given in face representation. k , i = 1; 2; ::; Nk , denote the faces of Tk , k = 1; 2, and let denote Let hki vik1; vik2; : : : ; vim i the set of vertices of 12. is a given tolerance. D
E
Algorithm
Considering the faces of T1 and a vertex, edge or face of T2 1. Let i = 0, = ;. 2. i = i + 1. If i > N1 turn to step 10. 3. Calculate the coecients of fi1 as follows: n1i = (A1i ; Bi1; Ci1)T = (vi12 ? vi11) (vi13 ? vi11), Di1 = ?(n1i )T vi11 where 00 denotes the vector product. 4. Compute Ji2 = fj 0 2 f1; : : : ; M2g : fi1(vj2 ) = minffi1(vj2) : j = 1; : : :; M2gg and let Ji2 = fj1; : : :; jg: If = 1 then go to step 5, else go to step 7. 0
D
E
1 ? v2 . 5. Compute the corresponding face q of 12, i. e. q = vi11 ? vj21 ; : : :; vim j1 i 6. Update the vertex set of 12 and save a representation of q with respect to . Return to step 2. 7. Select a projection coordinate plane as follows: the xy-plane if jCi1j = maxfjA1i j ; jBi1j ; jCi1jg, the zx-plane if jBi1j = maxfjA1i j ; jBi1j ; jCi1jg, the yz-plane if jA1i j = maxfjA1i j ; jBi1j ; jCi1jg. If = 2 then go to step 8, else go to step 9. 8. Project face h1i of T1 and edge e2 of T2 with endpoints vj21 and vj22 on the selected plane and construct the sequence of vertices of q in accordance with item 2 of Section 3. Return to step 6. 9. Project face h1i of T1 and face h2j of T2 (determined by Ji2) on the selected coordinate plane. Construct face q of 12 in accordance with item 3 of Section 3. Return to step 6. Considering the faces h2j of T2 and a vertex or edge of T1 10. Let j = 0. 11. j = j + 1: If j > N2 then go to step 18. 12. Calculate the coecients of fj2 in analogy to step 3.
18
13. Compute Jj1 = fi0 2 f1; : : :; M1g : fj2(vi1 ) = minffj2(vi1) : i = 1; : : : ; M1gg and let Jj1 = fi1; : : : ; ig. If 3 then return to step 11. If > 1 then go to step 16. 0
D
E
2 ? v1 ; : : : ; v2 ? v1 . 14. Compute the corresponding face q of 12 as follows: q = vjm i1 j1 i1 j Note, the circuit direction of vertices in q has to be opposite to that in h2j . 15. Update the vertex set of 12 and save a representation of q with respect to . Return to step 11. 16. Project face h2j of T2 and edge e1 of T1 with endpoints vi11 and vi12 on a coordinate plane selected in analogy to step 7. 17. Construct the face q = hp1; : : : ; pr i of 12 in accordance with item 5 of Section 3. If the direction of the normal n = (p2 ? p1 ) (p3 ? p1) is not opposite to that of n2j , then change the circuit orientation of q. Return to step 15. Considering the edges e1i of T1 and the edges e2j of T2 18. Form a list of edges e1i of T1 being speci ed by their end-vertices vi11 and vi12 , i = 1; 2; : : : ; K1; and a list of edges e2j of T2 with end-vertices vj21 and vj22 , j = 1; 2; : : : ; K2. Set i = 0. 19. i = i + 1. If i > K1 then the surface 12 is built - stop, otherwise set j = 0. 20. j = j + 1: If j > K2 then return to step 19. 21. If jje1i jj2 jje2j jj2 ? ((e1i )T e2j )2 < then return to step 20; the two edges are parallel. Otherwise calculate the normal vector n = e1i e2j of the plane H which is determined by e1i and e2j . 22. Veri cation whether H is a separating plane Compute J1 = fr 2 f1; :::; M1g : nT vr1 = nT vi11 g, 1 = maxfnT vr1 : r = 1; :::; M1g, 1 = minfnT vr1 : r = 1; :::; M1g. If 1 < nT vi11 < 1 or card(J1) > 2 then go to step 20. Compute J2 = fs 2 f1; :::; M2g : nT vs2 = nT vj21 g, 2 = maxfnT vs2 : s = 1; :::; M2g, 2 = minfnT vs2 : s = 1; :::; M2g. If 2 < nT vj21 < 2 or card(J2) > 2 then go to step 20. If 1 = nT vi11 and 2 = nT vj21 or if 1 = nT vi11 and 2 = nT vj21 then go to step 20. 23. Calculate the face q of 12 in accordance with item 6 in Section 3, i. e. q has the vertices p1 = vi11 ? vj21 , p2 = vi12 ? vj21 , p3 = vi12 ? vj22, and p4 = vi11 ? vj22. Let vt1 be any vertex of T1 not belonging to e1i , and let n0 = (p2 ? p1) (p3 ? p1 ) be a normal vector of q. If (n0)T vt1 > (n0)T vi11 then change the circuit orientation of q. 24. Update the vertex set of 12 and save a representation of q with respect to . Return to step 20.
19
6 Considering two parallel faces For the sake of completeness, we describe in this section one possibility to compute a face q = qpt of 12 which is determined by two parallel faces h1p T1 and h2t T2 in detail. Here the projection on the x; y-plane is considered; the other two cases are similar. 1 and h2 hv 2 ; v 2 ; : : : ; v 2 i be faces of T1 (considered to be xed) Let h1p vp11,vp12; : : :; vpn t t1 t2 tm and of T2 (which is movable), respectively. The faces are assumed to be parallel, and the vertices vpi1 = (x1pi; ypi1 ; zpi1 ), i = 1; 2; : : : n, and vtj2 = (x2tj ; ytj2 ; ztj2 ), j = 1; 2; : : : m; are given in the eigen coordinate systems. Projection of the faces into the x; y-plane yields polygons prxy h1p = u1p1; u1p2; : : : ; u1pn i and prxy h2t = hu2t1; u2t2; : : : ; u2tm i; where simply u1pi = prxy vpi1 = (x1pi; ypi1 ), i = 1; 2; : : : ; n, and u2tj = prxy vtj2 = (x2tj ; ytj2 ), j = 1; 2; : : : ; m. It is assumed that the eigen coordinate systems coincide and that the circuit directions of the two polygons are counterclockwise. Then the construction of the face q which is formed by parallel faces h1p and h2t can be realized as follows: 1. In order to obtain a rst vertex of q, an initial pair of vertices u1pk and u2tr is chosen such that D
E
D
and
x1pk = minfx1p1; x1p2; : : :; x1png
and
fypi1 : x1pi = x1pk g ypk1 = max i
x2tr = maxfx2t1; x2t2; : : : ; x2tmg
and
fx2tj : x2tj = x2tr g: ytr2 = min j
This choice guarantees the non-overlapping of polygons prxy h1p and prxy h2t when prxy h2t is translated by the vector u1pk ? u2tr. As result, the translated vertex u2tr coincides with vertex u1pk and the translated origin of the eigen coordinate system of polygon prxy h2t speci es the projection of the rst vertex of face q on the x; y-plane. As consequence, the rst vertex v1 of q, determined by vpk1 and vtr2 , results as follows:
v1 = vpk1 ? vtr2 : 2. The second and all subsequent vertices vl, l = 2; 3; :::; L (with L m + n) of face q can be computed step by step based on analysing the current geometrical situation. In detail, let the current constructed vertex vl of q be formed by u1pi and u2tj . Then the next vertex vl+1 of q is determined in analogy to the two-dimensional case by a pair of vertices: either by u1p;i+1, u2tj (shifting of T2 along an edge of T1), or by u1pi, u2t;j+1 (shifting of T2 along an edge of T2), or by u1p;i+1, u2t;j+1 (shifting of T2 along parallel edges). More formally, let 1 2 1 2 #j (x1pi; ypi1 ) = xx2 pi ??xxtj2 y2ypi ??ytjy2 :
t;j +1
tj
t;j +1
1 ) then vl+1 = v 1 ? v 2 . If #j (x1pi; ypi1 ) = #j (x1p;i+1; yp;i +1 p;i+1 t;j +1 1 ) then vl+1 = v 1 ? v 2 . If #j (x1pi; ypi1 ) < #j (x1p;i+1; yp;i +1 pi t;j +1
20
tj
1 ) then vl+1 = v 1 ? v 2 . If #j (x1pi; ypi1 ) > #j (x1p;i+1; yp;i +1 p;i+1 tj Finally, when vertex vl+1 coincide with vertex v1 then the construction of face q for 12 is terminated. It is to remark, in the case where an edge of T2 is parallel to a face of T1, the proposed algorithm is also applicable, now with m = 2. The algorithm does not change signi cantly when faces h1p and h2t are projected on the y; z-plane or the z; x-plane. However the de nition of u1pi and u2tj changes.
7 Final remarks When dealing with 3D packing problems, tools like -functions are needed to describe or characterize the mutual position of two objects. The proposed method for computing a -function of two convex polytopes, based on a face oriented description, involves some opportunities to generalize it to the non-convex case. But this is still an open problem.
References [1] H. Dyckho, G. Scheithauer, and J. Terno. Cutting and packing. In M. Dell'Amico, F. Maoli, and S. Martello, editors, Annotated Bibliographies in Combinatorial Optimization, chapter 22, pages 393{412. John Wiley & Sons, Chichester, 1997. [2] J. Edmonds. A combinatorial representation for polyhedral surfaces. Amer. Math. Soc. Notices, 7, 1960. [3] B. Grubaum. Convex Polytopes. Interscience Publisher, London, 1967. [4] A. Hartwig. Algebraic 3-D Modelling. A.K.Peters,, Wellesley, Massachusetts, 1996. [5] J.W. Roach L.S. Health, P.K. Paripati. Representing polyhedra: Faces are better than vertices. In Computational Geometry: Theory and Applications. 1993. [6] G. Scheithauer and J. Terno. Modelling of packing problems. Optimization, 28:63{84, 1993. [7] Y. G. Stoyan. Mathematical methods for geometric design. In T. M. R. Ellis and O. J. Semenkoc, editors, Advances in CAD/CAM, Proceedings of PROLAMAT 82, Leningrad, pages 67{86. Amsterdam, 1983. [8] Y. G. Stoyan and A. F. Loyko. Automation of arrangement design of engineering system of block design. I mathematical model. Engineering Simulation, 15, 1998. [9] Y. G. Stoyan and A. F. Loyko. Automation of arrangement design of engineering system of block design. II computer aided layout design. Engineering Simulation, 16, 1998. 21
[10] Y. G. Stoyan and L. D. Ponomarenko. Minkowski's sum and the hodograph of the dense allocation vector function (in russian). Reports of the Ukrainian SSR Academy of Science, Ser. A, No. 10, 1977. [11] Yu. G. Stoyan. On one generalization of the dense allocation function. Reports of the Ukrainian SSR Academy of Science, Ser. A, No. 8, 1979.
22