Phi-functions for 2D objects formed by line segments and circular arcs

,


Introduction
We study the cutting and packing (C&P) problems.Its basic goal is to place given objects into a container in an optimal manner.For example, in garment industry one cuts figures of specified shapes from a strip of textile, and one naturally wants to minimize waste.Similar tasks arise in metal cutting, furniture making, glass industry, shoe manufacturing, etc.In shipping works one commonly needs to place given objects into a container of a smallest size or volume to reduce the space used or increase the number of objects transported.
The C&P problem can be formally stated as follows: place a set of given objects A 1 , . . ., A n into a container Ω so that a certain objective function (measuring the "quality" of placement) will reach its extreme value.
In some applications (as in garment industry) objects must be specifically oriented respecting the structure of the textile, i.e., they can only be translated without turnings (or only slightly rotated within given limits).In other applications objects can be freely rotated.Some applications involve additional restrictions on the minimal or maximal distances between certain objects or from objects to the walls of the container Ω (one example is packing of radioactive waste).
While most researchers use heuristics for solving C&P problems, some develop systematic approaches based on mathematical modeling and general optimization procedures.; see, e.g., [3,7,10].We refer the reader to recent tutorials [1,18] presenting the history of the C&P problem and basic techniques for its solution.
Standard existing algorithms are restricted to 2D objects of polygonal shapes; other shapes are simply approximated by polygons (a notable exception is [4] which also treats circular objects).The most popular and most frequently cited tools in the modern literature on the C&P problem are Minkowski sum [11] and the so called No-Fit Polygon [1], which works with polygons only and does not support rotations.Rotations of polygons were considered in [8,9], and in a very recent paper [5] the concept of No-Fit Polygon was extended to objects bounded by circular arcs.
In this paper we develop tools that handle any 2D objects whose boundary is formed by linear segments and/or circular arcs (the latter may be convex or concave).All objects we had to deal with in real applications, without exception, belong to this category.Our tools support free translations and rotations of objects and can respect any restrictions on the distances between objects.
We describe the layout of objects relative to each other by the so-called phi-functions.For any placement of two objects A i and A j on the plane R 2 , the corresponding phi-function Φ A i A j shows how far these objects are from each other, whether they touch each other, or whether they overlap (in the latter case it shows how large the overlap is).Phi-functions were introduced in [2, 15,16] and fully described in our recent survey [6].Phi-functions are also used for solving 3D packing problems [14] and covering problems [13].
The arguments of the phi-function Φ A i A j are the translation and rotation parameters of the objects A i and A j ; those parameters specify the exact position and orientation of the objects in the xy plane (or in the xyz space).All these parameters together, for all the given objects, constitute the solution space.Solving the cutting and packing problem then consists of minimization of a certain objective function defined on the solution space.
Thus the solution of the C&P problem reduces to minimization of an objective function on a certain (multidimensional) space, which can be done by mathematical programming.A detailed description of the solution strategy is given in [6].We emphasize that the minimization is performed with respect to all of the underlying variables, i.e., all the objects can move and rotate simultaneously.In this respect our approach differs from many others that optimize the position of one object at a time.Illustrations and animated demonstrations of the performance of our methods can be found on our web page [19].
The solution space consists of all admissible (non-overlapping) positions of our objects, which correspond to inequalities Φ A i A j ≥ 0 for all i = j.Our phi-functions Φ A i A j are defined by a combination of minima and maxima of various basic functions that represent mutual position of various elements of the underlying objects (their edges, their corner points, etc.)As a result, the solution space is described by a complicated tree in which each terminal node consists of a system of inequalities involving translation and rotation parameters of certain objects.This description is very complex, and one of our goals is to simplify it.
The above mentioned inequalities may be expressed via distances between various points, segments, and arcs on the boundaries of our objects.The resulting formulas often involve square roots, which may cause unpleasant complications -formulas describing the solution space develops singularities, and the minimization process becomes prohibitively slow.
To remedy the situation, we redefine the phi-functions so that the solution space will be described by simpler formulas without radicals (thus avoiding related singularities), This speeds up the optimization process.By our rules, phi-functions only need to satisfy certain flexible requirements, they are not rigidly determined by the shapes of the given objects.In fact, one can often define phi-functions for fairly complicated objects by simple formulas that avoid square roots and other irrational functions.
This strategy was employed in our previous works [6], but here we implement it to an utmost extent.We will show that for any objects bounded by linear segments and circular arcs phi-functions can be defined by algebraic formulas without radicals.This is the principal goal of our paper.It was announced in [6] without much details.Here we give explicit practical formulas for computing the phi-functions in all possible cases.Our radical-free phifunctions also incorporate additional constraints on the distances between objects (see Section 4).
We demonstrate the efficiency of our new phi-functions by model examples.For the description of the solution space via phi-functions we refer the reader to [6].For further details of local optimization algorithms used in our programs we refer the reader to [17].

Phi-functions and decomposition of objects
Recall that a 2D object is a subset A ⊂ R 2 ; it is usually specified by some equations or inequalities in the canonical coordinates x, y.Placing the object in R 2 means moving it without changing its shape or size.Rigid motions in R 2 consist of rotations and translations.If we rotate A by angle θ A (say, clockwise) and translate it by vector ν A = (ν Ax , ν Ay ), then the resulting set (placed object) can be described by equation ( 1) where R θ = cos θ sin θ − sin θ cos θ denotes the standard rotation matrix.We call ν A and θ A the placement parameters for the object A. Now let A, B ⊂ R 2 be two objects.We denote the corresponding placed objects by describes the mutual position ("interaction") of the pair of sets A and B .
It must satisfy three basic requirements: (2) Here int(A ) denotes the interior of A and ∂A the boundary (frontier) of A .We always assume that our objects are canonically closed sets, i.e., each object is the closure of its interior.Also, the boundary ∂A should not have self-intersections [2,6].
Note that Φ AB is a function of six real variables ν Ax , ν Ay , θ A , ν Bx , ν By , θ B .An important requirement is that Φ AB be continuous in all these six variables [6].We will also assume that Φ AB is "symmetric" in the sense that and translation invariant, i.e., for any vector ν Our phi-functions are also rotation invariant in a natural sense.In our formulas, the superscripts of Φ will always refer to given objects, while the arguments of Φ (the placement parameters) will be often omitted for brevity.
The general meaning of (2) is that when the placed objects are disjoint, i.e., a positive distance apart, then Φ > 0. When those objects just touch each other (on their boundaries), but do not overlap, then Φ = 0.When they overlap, then Φ < 0.
We emphasize that the exact value of the phi-function is not subject to any rigid constraints.If two placed objects A and B are disjoint, then Φ should just roughly approximate the distance between them.If they overlap, then the absolute value |Φ| should just roughly measure the extent of overlap.This flexibility allows us to construct relatively simple phi-functions for rather complex objects, which is the main goal of our paper.
For example, let C 1 and C 2 be two circles (disks) of radii r 1 and r 2 , respectively, defined by Now by translating C 1 and C 2 through some vectors ν 1 and ν 2 we get two placed circles C 1 and C 2 with centers (ν 1x , ν 1y ) and (ν 2x , ν 2y ), respectively, and the same radii r 1 and r 2 (rotations are redundant for circles).Now the distance between C 1 and C 2 is d = max{φ, 0}, where Note that φ > 0 if the circles are disjoint and φ < 0 if they overlap, thus we could set Note that the sign of Φ C 1 C 2 coincides with that of φ (and Φ C 1 C 2 = 0 whenever φ = 0).But the formula (3) allows us to avoid radicals, thus improving the performance of our optimization algorithms.
Next suppose are two objects, each of which is a union of some smaller (and simpler) components A i and B j , respectively.Those do not have to be disjoint, i.e., some A i 's may overlap, and so may some of the B j 's.When the object A is rotated and translated, all its parts are rotated by the same angle and translated through the same vector, so the placement parameters for A and for all its parts A i are the same.This applies to B and its parts, too.Now we can define (4) This simple fact can be verified by direct inspection, see also [2,6].
In this paper we consider objects whose boundary is formed by linear segments and/or circular arcs (the latter may be convex or concave); see an example in Fig. 1.Such objects can be partitioned into simpler components of four basic types: (a) convex polygons, (b) circular segments, (c) "hats", and (d) "horns"; see Fig. 2.
A convex polygon is an intersection of m ≥ 3 half-planes.More generally, an intersection of m ≥ 1 half-planes will be called a generalized convex polygon, or phi-polygon.It may be a regular (bounded) polygon, or an unbounded region, such as a region between two rays (half-lines) emanating from a common vertex (see illustrations in [2]).A circular segment is a region bounded by a circular arc (smaller than a semicircle) and the respective chord.One can also describe a circular segment as the convex hull of a circular arc.A hat is formed by a circular arc (smaller than a semicircle) and two tangent lines at its endpoints (Fig. 2c).A horn is made by two circular arcs (one convex and one concave) that are tangent to each other at the point of contact and a line crossing both arcs and tangent to the concave one (Fig. 2d).We will denote these four types by K, D, H, and V , as in Fig. 2.
Fig. 1 shows a division of an object into basic sub-objects.It consists of 8 convex polygons, 3 circular segments, 3 hats and one horn.
Decomposition of a given object into basic sub-objects can be done by a computer algorithm based on the following steps: 1. Locate "beaks", i.e., points on the boundary of A where two arcs (one concave and one convex) terminate with a common tangent line.At each beak, cut off a small piece that is shaped as a horn (by a line tangent to the concave arc).After the detachment of horns, the resulting object will have no beaks.2. Locate all concave arcs and carve out hats so that each concave arc will be replaced with a polygonal line.After the detachment of hats, the resulting object will have no concave arcs.
3. Locate all convex arcs and cut off circular segments so that each convex arc will be replaced with one or more chords.After the detachment of segments, the resulting object will have no convex arcs.
4. If the resulting phi-polygon is convex, keep it.If not, decompose it into two or more convex ones.
We note that if the given object A is simple enough, it may not be necessary to divide it into basic objects.For example, if A is a circle (or a ring), there is no need to cut it artificially into some polygons and circular segments, as phi-functions for circles (and rings) are quite simple; see (3) and other formulas below, as well as [2,15,16].
Next, recall that our basic goal is to place given objects A 1 , . . ., A n into a container Ω with respect to a given objective.To ensure that the placed objects is the closure of the complement to the container Ω.This is a part of our optimization algorithm; see [6].
The necessity of treating Ω * = cl(R 2 \Ω) as a (rather special) object leads us to considering unbounded objects, too.Given a bounded object B, we denote by B * = cl(R 2 \ B) the unbounded complementary object.If B * is delimited by line segments and circular arcs, then it can be decomposed into basic objects of the same four types, except one or more basic objects are unbounded phi-polygons as described above.

Basic phi-functions
Due to the decomposition principle (4) our problem reduces the construction of phi-functions for all pairs of basic objects.As there are four types of basic objects, there are a total of 4 + 4 2 = 10 possible pairs of types of basic objects to treat.These will form a complete class of basic phi-functions.

Two convex polygons.
A convex polygon is an intersection of several halfplanes.A half-plane can be defined by αx + βy + γ ≤ 0 so it is completely specified by three parameters (α, β, γ).Without loss of generality we assume in what follows that α 2 + β 2 = 1.A convex polygon (phi-polygon) K that is the intersection of m half-planes can be specified by Alternatively, K can be specified by a sequence of vertices K = (x 1 , y 1 ), . . ., (x m , y m ) listed in the counterclockwise direction.If the polygon K is moved (rotated and translated), its parameters α i , β i , γ i and x i , y i can be recomputed in terms of the rotation angle θ K and translation vector ν K , according to (1).Thus the placement parameters of K can be incorporated into α i , β i , γ i and x i , y i .Now let K be a convex m-gon and K another convex m -gon whose parameters we denote by (α i , β i , γ i ) and whose vertices by (x i , y i ) for 1 ≤ i ≤ m .Denote Now we define the "polygon-polygon" phi-function as (5) Φ KK = max{ max see [6] for a detailed analysis of this formula.We note that Φ KK does not involve quadratic functions.It is defined by linear expressions only if rotational angles are not used.
In particular, if P is a half-plane defined by αx + βy + γ ≤ 0 and K a polygon with vertices (x i , y i ), then (5) takes a much simpler form (6) Φ P K = min 1≤j≤m αx j + βy j + γ.
Convex polygon and circle.Let K be a convex polygon with sides E i and vertices (x i , y i ) for 1 ≤ i ≤ m.Let α i x + β i y + γ i = 0 be the equation of the line containing the side E i .We assume that α 2 i + β 2 i = 1 and the vertices and sides are numbered counterclockwise and the ith side joins the ith and (i + 1)st vertices (if i = m, then we set i + 1 = 1).Let C be a circle with center (x C , y C ) and radius r C .Then we define (7) Φ KC = max where C (see Fig. 3, right), and 3, right).See [6] for more details.
In particular, if P is a half-plane αx + βy + γ ≤ 0 and C a circle with center (x C , y C ) and radius r C , then (7) takes a much simpler form (8) Φ Convex polygon and circular segment.Let K be again a convex polygon.Let D be a circular segment D = C ∩ T , where C is a circle and T a triangle made by the chord (the base of the segment) and the two tangents drawn at its endpoints.Now we define where Φ KC was defined by (7) and Φ KT by (5).
where Φ CC was defined by (3), Φ T C and Φ T C by (7), and Φ T T by ( 5).This takes care of all possible pairs of convex basic objects, i.e., types (a) and (b).It remains to deal with concave objects, i.e., 'hats' and 'horns'.We first consider a simple object with a concave arc -the complement to a circle.This case is practically important because in many applications one places objects into a circular container.
Convex objects inside a circular container.Let C * denote the (closure of the) complement to a circle C with center (x C , y C ) and radius r C .Now let C be a circular object with center (x C , y C ) and radius r C ≤ r C that we want to place inside the circle C. Then we define (10) Φ Next let K be a polygon (not necessarily convex) with vertices (x 1 , y 1 ), . . ., (x m , y m ) that we want to place in our circle C. Then we set (11) Φ If H = T ∩ C * 1 is a 'hat', i.e., the intersection of a triangle T and the complement to a circle C 1 (see Fig. 6), we simply put Φ C * H = Φ C * T , where Φ C * T is given by (11).
We call ϕ 1 and ϕ 2 "switch" functions.Note that max{Φ C * C , ϕ 1 , ϕ 2 } < 0 if Φ C * C < 0 and ϕ 1 < 0 and ϕ 2 < 0, see Fig. 5a.However, there exist tree cases where Φ C * C < 0 but max{Φ C * C , ϕ 1 , ϕ 2 } ≥ 0. First, ϕ 1 ≥ 0 and ϕ 2 < 0 (see Fig. 5b).Second, ϕ 2 ≥ 0 and ϕ 1 < 0 (Fig. 5c).Lastly, ϕ 1 ≥ 0 and ϕ 2 ≥ 0 (Fig. 5d).Polygon and hat.Let H = T ∩ C * be a hat, i.e., the intersection of the complement to a circle C and a triangle T as shown in Fig. 6.Let G denote the domain lying above the circle C and above the line L containing the chord forming the base of the triangle T ; see the grey area in Fig. 6.Note that H = G ∩ T .Now if B is any convex object, then it overlaps with H if and only if it overlaps with both T and G, hence we can define the phi-function as (14) Φ HB = max{Φ T B , Φ GB } provided we have properly defined Φ T B and Φ GB .This formula applies when B is either a convex polygon or a circular segment.In these two cases Φ T B is given by either ( 5) or (9), respectively.Thus it remains to define function Φ GB .Here we assume that B is a convex polygon.
Let T 1 and T 2 denote two triangles adjacent to T ; one side of each is a tangent to the circle C, and another side of each is a segment of the line L adjacent to the chord; see Fig. 6 (the choice of the third side is not important).Let the circle C have center (x C , y C ) and radius r C .Let the half-plane P below the line L be defined by inequality α P x + β P y + γ P ≥ 0. Note that G = (C ∪ P ) * = C * ∩ P * .Now let K be any polygon (not necessarily convex) with vertices (x 1 , y 1 ), . .., (x m , y m ).Note that K does not overlap with G if and only if two conditions are met: (i) every vertex (x i , y i ) lies either in the circle C or below the line L; (ii) the polygon K does not overlap with T 1 and T 2 .Accordingly, we define (15) Φ GK = min{Φ T 1 K , Φ T 2 K , Ψ}, where Φ HK = max{Φ T K , Φ GK }, which completes the analysis of the "polygon-hat" pair.
Circular segment and hat.Let H = T ∩ C * = T ∩ G be a hat as before and D a circular segment.The above analysis applies, up to the formula ( 14), because D is a convex object.It remains to define Φ GD .We again use the notations P, C, etc., for objects associated with the hat H, as defined above.We denote by p 1 = (x 1 , y 1 ) and p 2 = (x 2 , y 2 ) the endpoints of the arc bounding H, as shown in Fig. 8 i.e., the points of intersection of ∂C with ∂P = L.The point p i = (x i , y i ) is a vertex of the triangle T i for i = 1, 2.
The circular segment D = C ∩ T is the intersection of a circle C and a triangle T , as before.Let r C denote the radius of the circle C and (x C , y C ) its center.Let q 1 = (x 1 , y 1 ) and q 2 = (x 2 , y 2 ) denote the endpoints of the chord bounding D (as shown in Fig. 4) and L the line passing through these points.Let the half-plane P below the line L (away from D) be defined by inequality α x + β y + γ ≥ 0. Note that D = C ∩ (P ) * .
If r C > r C , then we set where Φ P * T is defined by ( 6), Φ C * D by ( 13), and for i = 1, 2 we set Thus, Φ GD ≥ 0 if Φ P * T ≥ 0 (see Fig. 7a) or Φ C * D ≥ 0 (see Fig. 7b) or Φ GC ≥ 0 (see Fig. 7c), ϕ 1 ≥ 0 (see Fig. 7d) or ϕ 2 ≥ 0 (see Fig. 7e).The function Φ GC in ( 18) is defined as follows: where Φ C * C was defined by (10) and Φ P * C by (8).We also denote for i = 1, 2, and the functions ψ 1 , ψ 2 are defined so that ψ i = 0 is the equation of the line L i (see Fig. 8), and ψ i ≥ 0 is the half-plane below that line in Fig. 8.The line L i passes through points p i1 and p i2 .The line segment p i p i1 , i = 1, 2, is perpendicular to the line p 1 p 2 , the line segment p i p i2 is perpendicular to the line p i p 3 , and we have p i p ij = r C for all i, j = 1, 2. The functions ψ i , i = 1, 2, come from the application of ( 7) to T i and C .If r C ≤ r C , we need to replace ϕ i , i = 1, 2, in (18) with ϕ i defined by Finally, combining ( 14) and (18) gives Indeed, Φ HD ≥ 0 if Φ T D ≥ 0 (see Fig. 9a) or Φ GD ≥ 0 (see Fig. 9b).
Two hats.Let H = G T be a hat and H = G T another hat.Equivalently, H = (C ) * T and H = (C ) * T .For the hat H we use notation G , C , T , etc., as defined above, and for the hat H the respective notation G , C , T , etc. Now our phi-function is defined by Figure 9: A hat H and a circular segment D.
where Φ T H , Φ G T are given by ( 14), ( 15) respectively, and we denote here (x i , y i ) are the coordinates of the vertices and α i x+β i y +γ i = 0, i = 1, 2, are the equations of lines containing the two straight sides of H , respectively; (x C , y C ) and r C are the coordinates of the center and the radius of the arc bounding H . Similar notation apply to the hat H .
Horns.A horn V = H ∩ (D ∪ T ) is the intersection of a hat H and the union of a circular segment D and a triangle T ; see Fig. 11, where the triangle T has vertices p 1 , p 2 , p 3 , and the hat H has vertices p 1 , p 2 , p 4 .Now for any convex polygon K we define Similarly, for any circular segment D Some formulas for the phi-functions may appear quite complex.Note, however, that they all can be programmed off-line and stored in a computer library.In practical applications, one can just call the respective functions, and their evaluation proves to be fast and efficient.

Adjusted phi-functions
Some applications involve restrictions on the distances between certain pairs of objects, or between objects and the walls of the container.For example, when one is packing radioactive waste, discarded pieces cannot be placed too close together.On the other hand, when one designs a printed circuit board (PCB), then certain electronic components cannot be placed too far apart.Cutting mechanical parts out of a metal sheet is another example where minimal distances have to be maintained, because one has to take into account the physical size of the cutter.In other words, some upper and/or lower limits on the distances between certain placed objects may be set, i.e., given two objects A, B, the corresponding placed objects Here ρ − AB denotes the minimal allowable distance and ρ + AB the maximal allowable distance between A and B .
To fulfil (20), it has been a common practice to compute the actual distance between A and B at every step during the optimization process and check if (20) holds.But the computation of geometric distances (especially for complex objects) involves complicated formulas with radicals, see a variety of examples detailed in [2].We avoid the computation of geometric distances by using so called adjusted phi-functions defined below.
Suppose we have to maintain a minimal distance ρ = ρ − AB for a pair of objects A, B. We will construct an adjusted phi-function ΦAB satisfying Then we work with it a just like with the regular phi-function Φ AB in the previous sections, where no restrictions on distances were imposed.Indeed, all allowable placements of the objects A, B now correspond to ΦAB ≥ 0 and prohibited placements correspond to ΦAB < 0. Thus our optimization algorithms can proceed the usual routine, but with the new (adjusted) phifunction ΦAB instead of Φ AB .Given an object A and ρ > 0 we define its ρ-expansion (Fig. 12) by where (C, ρ) denotes a circle of radius ρ centered on the origin and the symbol ⊕ stands for the so-called Minkowski sum [12], which is defined by for any two sets A 1 , A 2 ⊂ R 2 .In other words, the ρ-expanded object Â in (22) consists of points that are either in A or at distance ≤ ρ from A. We will not need to use Minkowski sum for computing our phi-functions.Now we construct the adjusted phi-function by ΦAB = Φ ÂB , and it will satisfies the requirements (21).Note that instead of expanding the object A we can expand the other object B and define ΦAB = Φ A B .This extra flexibility can be used in practice to minimize the cost of computation.
Suppose we have to maintain a maximal allowable distance ρ = ρ + for a pair of objects A, B. This means that the objects have to be positioned so that Φ AB ≥ 0 (to avoid overlaps) and ΦAB ≤ 0, where ΦAB is the adjusted function constructed above (the latter condition will keep the distance ≤ ρ).Thus we can define another adjusted phi-function as ΦAB = min{Φ AB , − ΦAB }.

Now we have
Thus all allowable positions of A and B correspond to ΦAB ≥ 0.
We see that the adjusted phi-functions can always be defined as (ordinary) phi-functions, but for expanded objects.It remains to define phi-functions for expanded objects.For any object A we have Â = A∪δA, where δA = ∂A⊕C ρ is the expansion of the boundary of A; see Fig. 12 (right).One can think of δA as a "fattened" boundary of A (whose "thickness" is 2ρ).Then by the decomposition principle (4) we define ΦAB = Φ ÂB = min{Φ AB , Φ δAB }.Now recall that ∂A consists of linear segments and circular arcs, i.e., ∂A = ∪ m i=1 γ i , where each γ i is either a segment of a line or a circular arc.Therefore δA = ∪ m i=1 γi , where γi = γ i ⊕ C ρ denotes the expansion of γ i (as described below).Now by the decomposition principle (4) we define The domain γi = γ i ⊕ C ρ is shown in Fig. 13 for three different cases: γ i is a line segment (left), γ i is an arc of radius > ρ (center), and γ i is an arc of radius ≤ ρ (right); see a detailed analysis below.
In all these three cases we have γi = C 1 ∪ C 2 ∪ R, where C 1 and C 2 are disks of radius ρ centered on the endpoints of γ i .If γ i is a line segment, then R is a rectangle (Fig. 14, left).If γ i is a circular arc of radius r i > ρ, then R is a "bent rectangle" (Fig. 14, center).If γ i is a circular arc of radius r i ≤ ρ, then R degenerates to a circular segment (Fig. 14, right).Thus we define where R denotes the corresponding rectangle, or bent rectangle, or circular segment.
We note that ∂A consists of m components, so δA will consist of m disks of radius ρ and m rectangles or "bent rectangles" (some of the latter may degenerate to circular segments).Rectangles and circular segments are objects of basic types, for which phi-functions were defined in Section 3. Bent rectangles are objects of a new type, so we need to handle them separately.
We have two cases shown in Fig. 15.On the left, the "bent rectangle" is the union of two "wedges" W 1 , W 2 and a hat H. Every wedge W i is in turn the union of a triangle T i and a circular segment D i (see Fig. 16), hence In the second case (Fig. 15, right) the bent rectangle R can be decomposed as R = W 1 ∪ W 2 ∪ (H ∩ C).Accordingly, we define

Numerical examples
We illustrate our method by several model examples.In these examples we describe each object by listing elements of its boundary ∂A = {l 1 , . . ., l n }.Each boundary element l i is completely described by its numerical code (which is 0 for straight line segments, +1 for convex arcs, and −1 for concave arcs), the coordinates of the two endpoints (x 1 , y 1 ) and (x 2 , y 2 ), and (for circular arcs only) the coordinates of the center (x C , y C ).
Our goal is to place a given object or two given objects into a circle of minimal radius or into a rectangle of minimal area.The rectangle is always properly oriented, i.e., its sides are parallel to the x and y axes.Accordingly, our objective function (to be minimized) is F (u 1 , u 2 , . ..) = r in case of a circular container of radius r and F (u 1 , u 2 , . ..) = ab in case of a rectangular container with sides a and b.
The arguments u 1 , u 2 , . . . of the objective function include the translation vectors ν = (ν 1 , ν 2 ) for all the objects and rotation angles θ, where appro- If two objects are placed into a circle, it is enough to rotate one of them to achieve the optimal placement.When one or two objects are placed into a rectangle, each of them may have to be rotated in order to find the best placement.
Example 1.The goal is to place a given object into a circle of minimal radius.The object is a dolphin-like domain A shown in Fig. 17(a), its boundary is described in Table 1.The optimal placement is also shown in Fig. 17(a).The radius of the optimal circle is r * = 4.015234.This example took 3.61 sec of the computer running time (we processed our examples on a PC with an AMD Athlon 64X2 2.6 GHz CPU).
Example 2. The goal is to place the given object (same as in Example 1) into a rectangle of minimal area.The optimal placement is shown in Fig. 17(b).
The rectangle has sides a * = 7.132090 and b * = 6.416804.We note that our algorithm supports rotation of objects.The optimal rectangle is found when the object A is rotated by angle θ A = 1.31245.This example took 104 sec.optimal circle is found when the object B is rotated by angle θ B = 3.141593.This example took 4298 sec.
Example 4. The goal is to place two given objects, A and B, into a circle of minimal radius.The objects have identical shape, they look like thick metal staples and their boundary is described in Table 2.The optimal placement is shown in Fig. 18(b).The radius of the optimal circle is r * = 2.455866.Again, the objects are subject to rotation, and the optimal circle is found when the object B is rotated by angle θ B = 3.141593.This example took 31 sec.Table 3: The object A (Fig. 19) bounded by three arcs.
shape into a circle of minimal radius.The object A is made by three arcs (two concave and one convex) described in Table 3.The object B = H 1 ∪H 2 is the union of two overlapping hats specified in Table 4.The optimal placement is shown in Fig. 19(a).The radius of the circle is r * = 5.322824.Again, the objects are subject to rotation, and the optimal circle is found when the object B is rotated by angle θ B = 2.309901.This example took 1147 sec.
Example 6.The goal is to place the two given objects, A and B (same as in Example 5) into a rectangle of minimal area.The optimal placement is shown in Fig. 19(b).The rectangle has sides a * = 13.294256 and b * = 5.603828.Again, the objects are subject to rotation, and the optimal rectangle is found when the object A is rotated by angle θ A = −0.118376and the object B is rotated by angle θ B = 0.715346.This example took 443 sec.
Example 7. The goal is to place two very irregular (star-shaped) objects, A and B, into a circle of minimal radius.The objects have identical shape, each is the union of four overlapping hats specified in   19) is the union of two overlapping hats.Each hat is specified by the coordinates of the two endpoints (x 1 , y 1 ) and (x 2 , y 2 ) and the center (x C , y C ) of the circular arc bounding it and by the coordinates (x v , y v ) of its third vertex.We note that both circular arcs bounding H 1 and H 2 have radius r = 5.0.20) is the union of four overlapping hats.Hats are specified as in Table 4.We note that all the circular arcs bounding these four hats have radius r = 5.0.Example 9.This is a modification of Example 5: we place two objects A and B into a circle C of minimal radius, but now the object A must be at least the distance of 0.7 away from the object B and from the edge of the circle C, i.e., we need dist(A, B) ≥ 0.7 and dist(A, C * ) ≥ 0.7.In this example we use adjusted phi-functions (Section 4).The optimal placement is shown in Fig. 21.Note that the object A does not touch the object B or the boundary of C * , to maintain the required distance from both.The radius of the optimal circle is r * = 5.823507.The objects are subject to rotation, and the optimal circle is found when the object B is rotated by angle θ B = 2.322388.This example took 7725 sec.the support of National Science Foundation, grant DMS-0969187.We thank the anonymous referee for many useful remarks.

Figure 1 :
Figure 1: A partition of an object into 15 basic objects: 8 convex polygons, 3 circular segments (marked by D), 3 hats (marked by H) and one horn (marked by V).

Figure 3 :
Figure 3: A convex polygon and a circle.

Figure 6 :
Figure 6: The domain G (grey) and three triangles T , T 1 , and T 2 .

Figure 7 :
Figure 7: A circular segment D versus the region G.

3 Figure 8 :
Figure 8: The lines L 1 and L 2 for a segment-hat pair.

Figure 10 :
Figure 10: Four cases of non-overlapping hats H and H .

Example 3 .
The goal is to place two given objects, A and B, into a circle of minimal radius.The objects are identical copies of the dolphin-like object in Example 1.The optimal placement is shown in Fig.18(a).The radius of the circle is r * = 5.251253.Again, the objects are subject to rotation, and the

Figure 17 :
Figure 17: A dolphin-like object placed into (a) a circle of minimal radius and (b) a rectangle of minimal area.

Example 5 .Figure 18 :
Figure 18: (a) Two dolphin-like objects placed into a circle of minimal radius and (b) two staple-like objects placed into a circle of minimal radius.

Figure 19 :Example 8 .
Figure 19: (a) Two objects of different shape placed into (a) a circle of minimal radius and (b) a rectangle of minimal area.

Figure 20 :
Figure 20: (a) Two objects of different shape placed into (a) a circle of radius and (b) a rectangle of minimal area.

Figure 21 :
Figure 21: Two objects A and B placed into a circle C of minimal radius, with additional restriction on distances from A to B and C.

Table 1 :
(1) boundary of the dolphin-like has 13 elements.priate;cf.(1).If we place a single object into a circle, no rotation is needed.

Table 2 :
The boundary of the "thick staple" object has 8 elements, all straight line segments.

Table 5 .
The optimal