6.1.1 Translational Relaxation of a Single Polygon
In this section, we focus on planning the translation of a single polygon
Q
in an envi- ronment consisting ofk
static polygonal obstaclesP
1,P
2,:::
,P
k that surroundQ
. Thepurpose of the motion planning is to nd a point
q
and a maximal valuel
such that thecenter of
Q
can be placed at any point within a square centered atq
and has size 2l
2l
.without colliding with the surrounding obstacles. In other words, once
Q
's center is placed at (q
x
;q
y), it will be free from collision when
displaced by (
l;l
) for parameters and whose values are in the range [ 1;
1]. What this means for a boundary pointu
ofQ
whenQ
is placed atq
is that if we place the centerof a 2
l
2l
square atu
then the square can not contain any points from the obstacles. Ifwe move the center of the 2
l
2l
square along the boundary ofQ
, the square generates a\band" of obstacle-free region about the boundary of Q. We refer to this band as the slack region of
Q
. Hence, another way to look at the relaxation ofQ
is that if we place the center ofQ
at (q
x
;q
y) then Q has the largest area slack region.
We call the above mentioned motion planning problem the relaxation problem for
Q
. We show next that by applying the position-based optimization model described in Chapter 4, we can nd a locally optimal solution to the relaxation problem.Recall that, using the conguration space approach, we can convert the obstacles
P
i(1
i
k
) into enlarged obstaclesP
i(Q
) (1i
k
) and reduce the problem ofplanning the motion for
Q
to the problem of planning the motion for a single pointq
, which represents the center ofQ
, in the presence of the enlarged obstacles. The free spaceF
Q forthe motion planning of
Q
is the complement of the union of these enlarged obstacles.F
Q = (P
1(
Q
))[(P
2(
Q
))[:::
[(P
k (Q
)):
Let us denote the square corresponding to the range [
q
xl;q
x+l
][q
yl;q
y+l
] by R.Clearly, solving the relaxation problem for
Q
is equivalent to nding largest sized squareRcontained in
F
Q1. Using De Morgen's law, we can expressF
Q alternatively as
F
Q =P
1(
Q
)\P
2(
Q
)\:::
\P
k (Q
):
Hence, nding the largestRin
F
Q is equivalent to nding the largestRthat belongs to allof the enlarged obstacles
P
i(Q
) (i
= 1;:::;k
) simultaneously.Let us representRby its four corners: (
q
x+l;q
y+l
), (q
xl;q
y+l
), (q
xl;q
yl
) and(
q
x+l;q
yl
). Since Rhas to be contained inP
i(Q
) (for 1i
k
), its four cornersmust also be contained in
P
i(Q
). We use the same locality heuristic described the lastchapter to construct a large convex subset Ci of
P
i(Q
) that containsc
Q, the currentposition of the center of
Q
. The locality heuristic is applicable here since in tightly packed layouts, such as in marker making applications, the freedom ofQ
to move around is very limited. This implies thatRis usually very small and thatq
must be close
c
Q. Hence, for
the purpose of nding the largestR, the convex subsetCi obtained by the locality heuristic
gives a good approximation of
P
i(Q
).1More precisely, it is equivalent to nding the largest sized square in the connected component of
F Q
It follows from the convexity ofCi that ifCicontains all four corners of a square, thenCi
contains the entire rectangle. Thus, to ensure thatCicontainsR, it is sucient to constrain
the four corners of Rto remain in Ci.
We use the same method as described in Section 4.1.1 to derive a set of linear constraints for each of the four corners of R. Consider the upper right corner (
q
x+l;q
y+l
) as anexample. The linear constraint generated for this point with respect to an edge
AB
ofCi isthe following.
(
B
yA
y)q
x (B
xA
x)q
y+ (B
yA
yB
x+A
x)l
+A
xB
y+A
yB
x 0 (6:
1)which is a linear constraint on
q
x;q
y andl
. The constraints for other three corners withrespect to edge
AB
are built similarly.Next, for each obstacle
P
i (i
= 1:::;k
), we calculate the convex setCi fromP
(Q
)using the locality heuristic and built a set of linear constraints for the corners ofRwithCi.
Let
S
be the collection of such linear constraints. We set up the following linear program of three variablesq
x,q
y andl
.maximize
l
subject to :
S
The solution (
q
x
;q
y
;l
) of the linear program gives a locally optimal solution for the relax-ation of
Q
. That is, if the center ofQ
is placed at (q
x
;q
y), then
Q
can move (;
)l
invarious directions (
;
), wherejj;
jj<
1, without colliding into the surrounding polygons.Figure 6.1 shows an example of the relaxation for piece 12.
6.1.2 Rotational Compaction of a Single Polygon
From the previous section, we see that the larger the size of R, the larger the slack
region of
Q
. Conceivably, the size ofRcalculated forQ
with dierent tilts can be dierent.The idea behind rotational compaction using relaxation is the following: By sequentially placing each of the polygons in a position and proper tilt such that it has the largest slack region, we transform the layout into a \looser" conguration. Hence, we can subsequently apply our translational compaction algorithm to \tighten" the loosened layout.
Our rst task is to nd the tilt
ofQ
that yields the largest R. That is, whenQ
istilted by
, R as calculated by the algorithm in the previous section has the largest size.0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 11 12
Let the range of tilt allowed for
Q
be [;
]. Ideally, we would like to calculate the size of Rfor every angle within the tilt range and choose the largest one. However, that wouldrequire a complicated non-linear algorithm which would be dicult to make numerically stable. Therefore, we only take
K
equally-spaced discrete values within the range and calculate RforQ
tilted by the rotation corresponding to a discrete value. We then set tothe angle that yields the largestR.
An example of rotational relaxation is depicted in Figure 6.2. Piece 12 has the position and the tilt that allow it to have the largest slack region.
6.1.3 Algorithm for Rotational Compaction Using Relaxation
The complete algorithm for rotational compaction using relaxation method is as follows.
Step 1
Do a rotational relaxation for each polygon in the layout.Step 2
Do a translational compaction.Step 3
Iterate Step 1 and 2 until no progress can be made.For Step 2, we can specify the same objective function used in the various compaction functions described in Chapter 4. The relaxation of Step 1 helps to \loosen" the layout and hence the translational compaction done in Step 2 usually achieves better results than without the relaxation.
Figure 6.3 through Figure 6.4 present an example of rotational compaction using relax- ation on a human generated marker. Figure 6.3 shows the original marker and the result of rotational compaction using relaxation. Figure 6.4 compares the results of applying left- ward translational compaction alone on the marker and applying rotational compaction using relaxation.
The best result we have achieved is 2.41% improvement in eciency on a human gener- ated production marker versus 0.79% improvement with translational compaction alone.