Moving a Chair through a Door: A Tutorial on Local Spatial Reasoning in Algorithmic Robotics

Spatial reasoning problems in robotics may be categorised into two types: global and local. A typical problem of the global kind involves determining if a robot can navigate along a specified terrain from one specified (starting) point to another (target) point by means of a suitable path, subject to a variety of constraints. A quintessential example of local spatial reasoning is the determination of whether an object can pass through a specified opening. This paper presents a tutorial on the local spatial reasoning problem of deciding whether a given rigid convex object can pass through a specified convex aperture, and if possible, planning a sequence of motions to accomplish the task, in a computationally efficient manner. The exposition of this material is at the freshman and sophomore undergraduate levels, and is well suited to motivate computer science students in discrete mathematics courses.


Introduction
A typical problem in robotics is concerned with whether a robot can navigate in a space filled with obstacles, from some starting location S to a target location T, while avoiding collisions with the obstacles, and perhaps satisfying additional constraints such as minimizing the total distance travelled, minimizing the cost incurred, or avoiding slopes that are too steep [1]. At different locations during such a global planned navigation path the robot may encounter specific local challenges such as grasping an object with a fingered-hand [2], [3], or jaw-grippers [4], [5], navigating through a narrow sharp turn at a corner of a corridor [6], or passing through a door [7] or window [8]. Such problems are referred to as local spatial reasoning (or planning), and comprise the topic of this tutorial.

Two-Dimensional Space
Let us first look at the problem in Edwin A. Abbott's Flatland-the two-dimensional space we call the plane. Furthermore, let us begin our investigation with a rather strange-looking chair-a convex polygon. Geometrically our problem can now be described as follows. Let the plane be divided into two half-planes by a vertical infinite line L, and refer to figure 1. This line might represent the wall between a room and a balcony. Let A denote the left half-plane (room) and B the right half-plane (balcony). Let C be a convex polygon (the chair) situated in A. Let us delete a line segment D from line L. This gap represents the door. What can we say about the necessary and sufficient conditions under which C can be moved from A to B? Before we proceed we should be clear about what we mean by move. To start with, no restrictions are placed on the type of motions allowed. In other words, in our attempt to move C from A to B we may enlist any family of continuous rigid motions consisting of combinations of translations and rotations. Of course we are not allowed to 'lift' C into the third dimension. Neither is it permitted to squeeze, mutilate, spindle or otherwise deform C, as one might do 2 1234567890''""   Let P be a polygon in the plane lying on one side of a line L and refer to figure 2. Consider a light source infinitely far away from P on the same side of L as P. Furthermore assume that the light rays are parallel to each other and orthogonal (at right angles) to L. Then the polygon casts a shadow on L. The length of this shadow depends on the orientation of P with respect to L. We define the width of a polygon P, denoted by W(P), as the length of the shortest shadow made by P while P is rotated through all possible orientations.
Consider two infinite half-rays r1 and r2 emanating from some common point O, such that they are not collinear, and refer to figure 3 (left). These two rays divide the plane into two unbounded regions. The region with an acute angle at the base of the two half-rays is called a cone. Let Hi, i = 1, 2 denote the half-plane determined by a line through O that is orthogonal to ri and contains ri. The intersection of H1 and H2 is called the dual cone. If we let Hi, i = 1, 2 denote the half-plane determined by a line through O that is orthogonal to ri, but does not contain ri, then the intersection of H1 and H2 is the external dual cone. Note that if the angle of a cone is small then the angle of the corresponding dual cone is large and vice versa. Now consider a convex polygon P consisting of n vertices p1, p2, . . . , pn. Each vertex pi and its incident edges give rise to a dual cone Ci and a corresponding external dual cone. Let the angle of the external dual cone of vertex pi be denoted by θi, and refer to figure 3 (b). Then it follows that the sum θ1 + θ2 + . . . + θn = 2π. One may think of continuously "wrapping" a tangent line around the polygon With these preliminaries we are ready to return to the problem of moving a chair through a door. The door D on the wall L, as illustrated in figure 1, is a gap in this line. Let us refer to the length of this gap as the width of the door and denote it by δ. A proof is now presented of Theorem 1. A proof of this theorem, based on the principle of continuity, for the case when C is a smooth convex body (with unique tangents at every boundary point of C) was given by Gilbert Strang [9]. The proof presented here is a modification of his proof to handle convex polygons with a finite number n of vertices.

Theorem 1: A convex chair can be moved through a door if, and only if, the width of the chair does not exceed the width of the door.
Proof: The proof of the if statement of the theorem is straightforward. It suffices to show that if the width of the chair C does not exceed the width of the door δ, then C can be moved from room A to balcony B. We will present a constructive proof of this claim by describing a sequence of translations and rotations that will accomplish this task. Imagine a light source of parallel rays which are orthogonal to L illuminating the polygon and creating a shadow on L. Assume the wall is a vertical line in the plane and refer to figure 4. First move C by a rotation R that minimizes the length of its shadow on the wall, i.e., the width W(C) of the polygon. Then move C by a vertical translation T1, such that the shadow is aligned with the door D. Since, by assumption, W(C) does not exceed the width of D, we can complete the trajectory with one final translation T2 in the horizontal direction. Thus, if the width of the chair does not exceed the width of the door, then C can always be moved from A to B by a sequence of motions consisting of at most one rotation and at most two translations. Furthermore, the computational complexity of the planned trajectory is dominated by computing the width of the convex polygon, and may be computed using O(n) operations [5]. The proof of the only if statement of the theorem is more subtle. It must be shown that if the width of the chair exceeds the width of the door then the chair cannot be moved from A to B by any sequence of combined rotations and translations. An alternate equivalent statement of this claim is that if the chair can be moved from A to B (by some sequence of translations and rotations unknown to us), then the width of the chair cannot exceed the width of the door. Let us prove this version of the statement. Therefore assume there exists such a family of rigid motions that takes C from A to B. Before and after this sequence of motions, C does not intersect D. As C moves through D we look at the intersection I of C with D. Consider two lines tangent to C through the end points of I as well as unit outer-normal vectors at the end points of I orthogonal to the tangent lines. In figure 5, the diagrams (a) and (b) illustrate the position of C, along with the tangents and corresponding tangentnormal vectors, just after C begins to penetrate D, and just before C has gone completely through D. Two types of events occur, in a sufficiently small time interval ∆t, while C passes through D: either (1) D intersects only the interior of two edges of C, or (2) one or two vertices of C pass across D. In the type-1 event the tangent lines and their normal vectors are distinct, and do not change throughout ∆t. In the type-2 event the tangent lines and their normal vectors are not well defined when a vertex of C lies in D, and change their orientation after the vertex has gone through D. During the motion, as C passes through D we maintain the sum of the angles of the external dual cones of the vertices of C that are on or to the right of D. This sum is zero when C is left of D and equals 2π when it lies to the right of D. Therefore there exists a vertex of C such that when it crosses D it causes the sum to jump from a value less than π to a value greater than π (see figure 5 (c)). This implies that when this vertex intersects D there exists a pair of tangent lines in direction φ such that one line contains this vertex and is parallel to the other line. It follows that if C can be moved from A to B by some motion, however complex, it can do so with a single translation (after pre-positioning) in direction φ. But the width of the door δ, the length l(I) of the intersection of C with D, the width of C in direction φ, denoted by Wφ(C), and the width W(C) of the chair C are all related by the inequalities: δ ≥ l(I) ≥ Wφ(C), ≥ W(C). Therefore, the width of the chair C cannot exceed the width of the door δ. Q.E.D.
Note that Theorem 1 applies only to convex objects. If an object is not convex, such as a boomerang for example, then it is possible that it can move from A to B even though the width of the boomerang exceeds the width of the door by an arbitrarily large amount. Consider the example in figure 6. The width of the boomerang is much greater than the width of the door but it can still pass through the door by means of three translations and two rotations. One translation and rotation are used to preposition the boomerang. Then one translation moves one of the arms across the door, a second rotation repositions the boomerang so that it is ready to continue, and a final third translation completes the trajectory.

Figure 6.
Moving an object C that has the shape of a boomerang, from A to B via a translation, followed by a rotation, followed by a second translation, even though the width of the boomerang is greater than the width of the door.

Three-Dimensional Space
Theorem 1 establishes in two dimensions that if a convex polygon can be moved through a door by some sequence of continuous rigid motions, then it must possess a shadow that fits in the door. It is natural to ask if the same property holds in 3-dimensional space: if a convex polyhedron can be moved through a convex 2-dimensional door in a wall, does it follow that the polyhedron must possess a shadow that fits in the door? Surprisingly, the answer to this question is negative, thus highlighting the difference that exists between two and three dimensional space.
We now describe a convex polyhedron P and a convex door D (that Gilbert Strang [9] attributes to Harold Stark) with the property that although no shadow of P fits into D, the polyhedron can nevertheless be moved through the door. The shape of the convex door is a circular disk such as a port-hole in a ship, a docking port in the international space station, or an access hole in a sewer. As a relevant aside, it is useful to remark here that the reason sewer access-holes tend to be round, and not square, is that a square cover possesses a shadow that fits in the hole, and therefore such a cover could easily fall into the sewer possibly injuring a worker. A round access-hole on the other hand contains a lid with a diameter slightly greater than the diameter of the hole. Therefore it does not possess any shadows that fit in the hole, and therefore cannot fall into the hole. As we shall see however, such conclusions cannot be drawn when the cover is not a circular disc in spite of it being convex. The example object that is to be moved from A to B is a polyhedron with five faces, well known since antiquity, namely a pyramid. Let d denote the diameter of the circular door. For the moment assume the pyramid has the standard shape, such as the ancient pyramids of Egypt, i.e., the top or apex of the pyramid projects downwards to the center point of the square base. Such a pyramid will actually not accomplish our task, but is analyzed first since it helps to understand the correct solution. Later we will modify this pyramid. Let the length of the side of the square base of the pyramid also be d, the same as the diameter of the circular door, and let its height denoted by d* be slightly greater than d/2, the radius of the door. In other words, d* = d/2 + ε where ε is some relatively small positive constant.
It will be established that this polyhedron contains no shadow that fits in the door. First, without loss of generality, place the pyramid with its base on the xy-plane such that the sides of the base are parallel to the x and y axes. The points on the surface of the unit direction sphere may be used to describe all directions in which light can produce shadows. Consider for the moment only the base of the pyramid as an infinitely thin 2-dimensional plate and ask for which directions of light rays this plate contains a shadow that fits in the door. Before proceeding further it is useful to introduce the notion of the diameter of a set. When the set is a circle, the diameter is a well-known concept, but what about the diameter of an arbitrary set? Let x and y be two points contained in the set in question and let d(x, y) denote the distance between x and y. The diameter of the set is the greatest value that d(x, y) can be take over all points x and y in the set. Now let us return to the base of the pyramid and examine its shadows in different directions. From the top (or +z direction) the shadow is a square with diameter equal to 2 d ≈ 1.414d. From any other direction, excluding the equatorial directions (along the xy-plane, the shadow is either a rectangle or a rhombus with diameter greater than d. For the equatorial directions other than parallel to the x or y axes, the shadow is a line segment with length greater than d and less than 2 d. Hence the only directions which yield a shadow with diameter not exceeding the diameter of the door are the x and y directions. In these directions the base of the pyramid has a shadow which is a line segment of length precisely d. Thus, the only way the pyramid has any chance of having its shadow fit in the door is for its base to be perfectly aligned to a center line of the door (diameter of the circle). Figure 7 illustrates front and side views of one such possible position. However, since the height of the pyramid is greater than the radius of the circular door, a portion of the top of the pyramid creates a shadow on a portion of the wall outside of the door. Therefore this pyramid cannot yield any shadow that fits in the door. Unfortunately, neither is it possible for the object be moved through the door because the only way it can do so, requires that first the entire base of the pyramid translate through the door, and this is not possible because the top of the pyramid blocks such a translation. To fix this problem the shape of the pyramid is modified as follows. Rather than use an Egyptian-style pyramid we use a pyramid in the architectural style of the leaning Olympic Stadium in Montreal, so that the top of the pyramid projects to a point outside of its base. We accomplish this by translating the top vertex of the pyramid in a direction parallel to the base and sufficiently far so that the entire base can translate through the door before being blocked by the top of the pyramid. Such a pyramid is illustrated in figure 8. The height of the new pyramid is the same as that of the old pyramid and for exactly the same reasons as before, this new pyramid has no shadows that fit in the door. Nevertheless, this new pyramid can be completely moved through the door. First the continuous rigid motion proposed by Gilbert Strang is explained. Once the pyramid is prepositioned, this motion consists of two translations and one rotation. Subsequently, it will be shown that a different motion can be accomplished with just two translations, dispensing with the rotation altogether. The first solution is illustrated in figure 9. After prepositioning the pyramid so that its base is parallel to the xy-plane and it lies flush with the diameter of the door, translation T1 moves the entire base of the pyramid in a direction parallel to the xy-plane through the door until the top of the pyramid comes into contact with the door at two points. A rotation R1 is then carried out about the axis determined by these two points, through an angle that positions the upper triangular face of the pyramid parallel to the xy-plane. Finally, since the top of the rotated pyramid is no longer blocked by the door, translation T2 in a direction parallel to the xy-plane moves the entire pyramid across the door. This completes the argument that Theorem 1 does not hold in 3-dimensional space.   Figure 9. Side view of the motion of the pyramid through the door via one translation, followed by one rotation, followed by another translation (after prepositioning).
It will be shown now that, after prepositioning the leaning pyramid, two translations suffice to move the pyramid across the door, and hence the rotation portion of the motion described by Strang [9] is not necessary. The first translation T1 is as before: the pyramid is translated with its base parallel to the xy-plane and flush with the center line of the door as illustrated in figure 10 until the top of the pyramid collides with the edge of the door. Once this position is reached, there exists a set of directions that will permit a second translation T2 to move the entire pyramid across the door. To see this consider the polyhedral four-sided unbounded cone determined by the four rays emanating from the top vertex of the pyramid, in the directions of the four vertices of the base of the pyramid. The interior of this cone does not intersect any portion of the wall. Any translation of the pyramid in a direction defined by a ray from the apex of the pyramid that is obtained by a linear combination of the four rays that determined the cone will maintain the pyramid in the interior of this cone. Therefore such a translation will not cause any collisions with the boundary of the door.

Moving Non-convex Polygons
For more challenging problems students can explore similar questions for non-convex polygons such as monotone polygons, star-shaped polygons, and arbitrary simple polygons [10]- [17].