Gathering by Repulsion

09/26/2018 ∙ by Prosenjit Bose, et al. ∙ Simon Fraser University 0

We consider a repulsion actuator located in an n-sided convex environment full of point particles. When the actuator is activated, all the particles move away from the actuator. We study the problem of gathering all the particles to a point. We give an O(n^2) time algorithm to compute all the actuator locations that gather the particles to one point with one activation, and an O(n) time algorithm to find a single such actuator location if one exists. We then provide an O(n) time algorithm to place the optimal number of actuators whose sequential activation results in the gathering of the particles when such a placement exists.



There are no comments yet.


page 9

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In this paper, we consider some basic questions about movement by repulsion. Here a point actuator repels particles, or put another way, particles move so as to locally maximize their distance from the actuator. This problem models magnetic repulsion, movement of floating objects due to waves, robot movement (if robots are programmed to move away from certain stimuli), and crowd movement in an emergency or panic situation. It is, in one sense, the opposite of movement by attraction, which has recently been an active topic of research [2, 3, 11, 10, 14, 9, 1, 8].

1.1 Related work

We initiate the study of repulsion in polygonal settings. The closest comparable work is the work on attraction. Although attraction and repulsion have a similar definition, each has a distinct character. Attraction as it has been studied is mainly a two-point relation: a point attracts a point if , moving locally to minimize distance to , eventually reaches . In repulsion, cannot repulse to itself; must always repulse to some other point . Thus repulsion is a three-point relation.

In attraction, if a particle is attracted onto an edge by a beacon, it is pulled towards the point where there is a perpendicular from the beacon to the line through the edge. If is on the edge, this creates a stable minimum at , and particles accumulate at such mimima. As well, particles can accumulate on some convex vertices.

In repulsion, if a particle is repelled onto an edge by a repulsion actuator, it is pushed away from the point with the perpendicular to the actuator. This implies that is an unstable maximum. We forbid particles from stopping at unstable maxima, so in repulsion the only accumulation points will be convex vertices. We elaborate further on our model in Subsection 1.2.

In this article, we highlight some of the similarities as well as distinctions between these two concepts. For instance, Biro [2] designed an time algorithm for computing the attraction kernel of a simple -vertex polygon ; these are all points that attract all points . The closest counterpart of this for repulsion, which we call the repulsion kernel of a polygon , is all points such that there exists a point such that repels all points in to . We give an time algorithm to compute the repulsion kernel of an -vertex convex polygon, and an time algorithm to find a single-point in the repulsion kernel or report that the kernel is empty.

Both the attraction kernel and the repulsion kernel are concerned with the problem of gathering particles to a point. When the repulsion kernel is empty, it may be the case that we can still gather all particles to a point using more than one repulsion actuator. In this vein, we prove that this is impossible in a polygon with three acute angles. In a convex polygon with at most two acute angles, two repulsion actuators are always sufficient and sometimes necessary. We then provide an time algorithm to place the optimal number of actuators.

1.2 The model

We start with an -vertex convex polygon , which includes its interior. Before the activation of any repulsion actuator, there is a particle on every point of the polygon, including the boundary. During and after activation, we allow many particles to be on the same point; once two particles reach the same point, they travel identically, so we consider them to be one particle.

We restrict the location of the repulsion actuator to points in ; allowing the actuator to reside outside leads to a variation of the problem in which convex polygons are easily dispensed.

See Figure 1 for an illustration of the following definitions. The activation of an actuator will cause all particles to move to locally maximize their distance from the actuator. This means that if a particle is in the interior of , then it moves in a straight line away from the actuator’s location. If a particle is on an edge of the polygon, then it proceeds along the edge in the direction that will further its distance from the active actuator. Once moving, a particle moves until it is stable and can no longer locally increase its distance from the actuator. Stable maxima happen at vertices where neither of the two edges allows movement away from the actuator. We call such vertices the accumulation points of the activation.

Figure 1: (a) An activation at drives the particle at away from . On reaching an edge at , it will continue to move away from , until it reaches a local maximum of distance from at . (b) Accumulation points of an active actuator at . (c) At an unstable maximum, such as , particles will turn left.

Unstable maxima happen when a particle is on an edge where one or both directions give no differential change of distance from the actuator; this happens only at the perpendicular projection of the actuator onto the edge (see Figure 1c). A particle at an unstable maximum will move off of it in a direction of no improvement and then will be able to increase the distance from the actuator by continuing in that direction. To maintain a deterministic model, we will assume that particles move counterclockwise around the polygon at unstable maxima if there is a choice of two directions of no improvement. However, the choice of counterclockwise motion is arbitrary, and does not affect our results.

We may activate actuators sequentially from several places inside the polygon. We would like for every activation of an actuator to be from a location without particles, but the particle-on-every-point model forbids this on the first activation. So, when we choose a location for the first actuator, we remove the particle at that location from the problem. For subsequent activations, however, we do require that the actuator’s position be chosen from the points of the polygon without particles.

The main question we consider is when can we place a sequence of points such that repulsion from those points gathers all other points in the polygon to one point? When the repulsion kernel is non-empty, one point is sufficient. In general, our goal is to minimize the number of sequential activations performed to gather all the particles to one point. If all the particles in a polygon can be gathered to a point with sequential activations of actuators, we call the polygon -gatherable. If this is not possible for any , then we call the polygon ungatherable.

2 Background, notation, and terminology

2.1 General notation

We will use the convention that the vertices of are in counterclockwise order around the polygon. Vertex indices are taken modulo , so , etc. Edges are denoted with being the edge between and . The boundary of the polygon will be denoted , and by we mean the part of from counterclockwise to . In reference to curves, line segments, or intervals, we use the usual parentheses to denote relatively open ends and square brackets to denote relatively closed ends. Thus is the boundary from to , including but not . Given three distinct points in the plane, by we mean the counterclockwise angle between the ray from to and the ray from to .

2.2 Slabs and the three regions of an edge

Consider a polygon edge with particles covering it. When an actuator is activated, depending on its location relative to the edge, there are three possible effects on the particles: it drives them counterclockwise over the entire edge, it drives them clockwise over the entire edge, or it drives some of them clockwise and some of them counterclockwise (see Figure 2). In the latter case, a perpendicular from the edge to the actuator exists, and the particles clockwise of the perpendicular are driven clockwise, and the particles counterclockwise of the perpendicular are driven counterclockwise. The point where the perpendicular hits the edge is called a split point. We allow split points at the endpoint of an edge if a perpendicular from the endpoint to the actuator exists.

Figure 2: We use arrows in the diagrams to show the direction that the particles are driven. (a) The activation drives the particles (on the indicated edge) clockwise. (b) The activation drives the particles counterclockwise. (c) The activation splits the particles at , driving some clockwise and some counterclockwise.

We divide the inner halfplane of an edge into three regions depending on what effect an activation in the region has on the particles on the edge. This is done by drawing interior-facing perpendiculars to the edge at each of its vertices. The regions are , where an activation drives the particles clockwise, , where an activation drives the particles counterclockwise, and , where an activation drives some particles clockwise and some counterclockwise. We refer to as the slab of . The slab is closed on its boundaries, and and are open where they meet .

Figure 3: The three regions , , and .

2.3 Flow diagrams

Given a polygon and a location of an actuator, we may find the accumulation points and the split points, and mark each edge (or portion of a split edge) with the direction of particle movement along that edge, as in Figure 4. We call a diagram of this a flow diagram for with respect to .

Figure 4: A flow diagram, showing the direction of particle movement, along with the accumulation points and split points, given an actuator at .
Lemma 1.

In a traversal of , accumulation and split points alternate.


Note that in a flow diagram the only points of the boundary with two opposing directions of particle movement are the accumulation points, where the movement is towards the point, and the split points, where the movement is away from the point. Thus, between any two consecutive split points on the boundary, there must be an accumulation point, and between any two consecutive accumulation points, there must be a split point. This implies the lemma. ∎

Theorem 1.

A convex polygon is -gatherable from iff lies in the slab of exactly one of the edges of .


A polygon is -gatherable from iff an actuator at has one accumulation point. Since accumulation and split points alternate, this holds iff the actuator has exactly one split point. Since an actuator has a single split point in every slab that it is in (and no others), the result follows. ∎

The boundary of the slab for edge consists of and two rays perpendicular to . If we produce these two rays for each edge of , and intersect all these rays with , we get a set of at most chords that define a decomposition that we call the slab decomposition of . An example slab decomposition is shown in Figure 6. The cells of this decomposition have the property that if two points are in a cell, then these two points are in exactly the same set of slabs of .

Theorem 1 then immediately implies that the repulsion kernel of is the union of zero or more cells of the slab decomposition of . This gives us the basis for an time algorithm for finding the repulsion kernel. We start by constructing the slab decomposition. We can use topological sweep to compute a quad-edge data structure for the slab decomposition in time [5, 4, 6].

Theorem 2.

The repulsion kernel of a convex polygon can be computed in time.


We construct the slab decomposition. As we construct the decomposition, we augment each edge with information about which slab or slabs it borders and to which side of the edge said slabs are on. (An edge may border two slabs if the two slabs each have a defining ray that are collinear.). Choose an arbitrary cell of the decomposition and determine how many slabs it is in. From this cell, perform a graph search on the dual of the decomposition. Each time we step over an edge, from one cell to another, during this search, we update in constant time the number slabs we are in, according to the information on the edge. We maintain a list of all cells where this value is one. At the end of the search, this list is the repulsion kernel. ∎

If we allow actuators to be located outside a polygon , then every convex polygon is 1-gatherable.

Lemma 2.

Every convex polygon is 1-gatherable from some point in the plane.


If you go far enough away, you can always find a point that is not covered by any slab. For this point, there is only one accumulation point. Therefore, an activation of an actuator from this point moves all the particles to the accumulation point. ∎

Given the above, one may be tempted to believe that every convex polygon is -gatherable when the actuators are restricted to be inside the polygon. However, this is not always the case.

Lemma 3.

For , the regular -gon is not -gatherable.


Assume that the edge length of is , and that is oriented with direction (horizontal on the bottom of the polygon). This is illustrated in Figure 5 for .

By Lemma 9, we need only show that is not -gatherable from its boundary. By symmetry, we need consider only . The edge starts at the top center of the polygon and proceeds downward to the left. The slab contains the upper half of , as the distance (see figure) is greater than . (It is , to be precise, where is half the vertex angle, or .) Similarly, the slab contains the bottom half of .

Thus, each point of is in and either or or both. Thus, by Theorem 1, the polygon is not -gatherable from any point of .

The vertices are sometimes special cases, but here the vertex (the top vertex of the polygon) is in , , and , and thus the polygon is not -gatherable from there. By symmetry, it is not -gatherable from any vertex.

Figure 5: (a) covers the top half of . (b) covers the bottom half.

In fact, some convex polygons may be ungatherable. It turns out that acute angles are a major impediment to gathering.

Lemma 4.

A particle that is at an acute vertex of cannot be moved by an actuator activated at any point in .


Given any point , the acute vertex is a local maximum with respect to distance since any point in that is infinitesimially close to is closer to than . ∎

This immediately implies the following.

Theorem 3.

A convex polygon with three acute vertices is not -gatherable for any .

For the remainder of the paper, we only consider convex polygons with at most two acute vertices.

3 1-Gatherability

We have shown so far that not all convex polygons are 1-gatherable. We have also given a complete characterization of when a convex polygon is 1-gatherable by computing the repulsion kernel of a polygon in time. This begs the question whether it is possible to find a point from which the polygon is 1-gatherable more efficiently, without having to compute the repulsion kernel. We answer this question in the affirmative by providing an time algorithm. Before presenting the algorithm, we highlight some useful geometric properties.

Lemma 5.

Let be an accumulation point of an actuator activated at in . The line that goes through and is perpendicular to is a line of support of the polygon.


Since is an accumulation point, it is a local maximum of distance from . Thus, the circle with center and radius encloses the polygon in the neighborhood of . The line is tangent to (outside of) at and thus locally supports the polygon at . Since the polygon is convex, also globally supports the polygon. ∎

We now show that we can restrict our attention to particles starting only on the boundary of .

Lemma 6.

An actuator in that 1-gathers all the particles on also 1-gathers all particles in .


The activation of an actuator in forces a particle in the interior of to move directly away from the actuator until it hits the boundary at some point . Since there was a particle whose initial position is , the particle will follow the path of and stop at the same place stops. Thus, the location of will always be accounted for by the position of . In other words, is redundant and can be removed from the problem. ∎

We can take this a step further and show that particles located on the interior of edges are redundant.

Lemma 7.

An actuator in that 1-gathers all the particles on the vertices also 1-gathers all particles on .


The activation of an actuator in forces a particle in the interior of an edge of to move along along the edge until it reaches a vertex . There was a particle that started at , and we can follow the proof of Lemma 6. ∎

The above lemmas show that particle movement can be restricted to the boundary. In fact, to solve the general problem, we only need to consider the problem where particles are only on vertices. We show a relationship between self-approaching paths and the path on the boundary followed by a particle under the influence of an actuator. Recall that a directed path is self-approaching if for any three consecutive points on the path, we have the property that [7].

Lemma 8.

If is self-approaching from to then activating an actuator at sends all the particles on to along the boundary.


Let be an arbitrary point on . We observed that activating an actuator at will move along the boundary. We need to establish in which direction the particle will move. Since is self-approaching from to , we have that . Therefore, the particle will move to since particles move in a direction to increase their distance from an actuator. ∎

Next, we show that if the repulsion kernel is not empty, then there is at least one point on the boundary that is in the repulsion kernel.

Lemma 9.

Let be a convex polygon that is -gatherable from a point in the interior of , and let be the accumulation point for . Let be the ray from through , not including the point . Then is -gatherable from the point , with as its accumulation point (see Figure 6).

Figure 6: is 1-gatherable from . Each slab in is shown, with areas darkness corresponding to the number of slabs overlapping there.

By Theorem 1, the point of gatherability is in one edge ’s perpendicular slab. Without loss of generality, we assume that is horizontal at or below (by rotation), that is not to the right of (by reflection), and that is (by labelling). Let be such that . See Figure 7. Let be the point on which has a perpendicular through . Note that is a split point for .

Figure 7: Some relevant points on the polygon.

To show that is 1-gatherable from the point on , by Lemma 7, it suffices to show that the particles located on the vertices of move to one accumulation point with the activation of an actuator at . We will show that this accumulation point is . We assume without loss of generality that is located on the edge . Recall that if happens to be on , then the placement of the actuator on means the particle located at is removed from consideration.

We begin with the claim that an accumulation point for is . If this were not the case, then there would be a way to increase the distance from on the boundary in the neighborhood of . By Lemma 5, there is a line perpendicular to that is a line of support of at . By construction, is perpendicular to . Therefore, is a local maximum with respect to , and thus is an accumulation point for . We will now show that particles located at all other vertices move to when an actuator is activated at .

Since is a split point for , we have that upon activation of , the particles on the vertices on move clockwise along the boundary to . Similarly, the particles on the vertices on move counterclockwise along the boundary to . By Theorem 1, this means that is in all of the regions , and is in , . See Figure 9.

Figure 8: is in the regions to .
Figure 9: is in the regions to .

Since all of the slabs cross the chord between and , we have that is also in , . Thus, the vertices move in a clockwise direction to .

Now, we must show that the particles on vertices also move to . We first consider the vertices . Again, since these vertices move counterclockwise when the actuator is activated at , the slabs for cross the chord between and . Therefore, none of them can contain . This implies that is in .

We now show that the vertices move in a clockwise direction to . Consider the circle centered at and going through . This circle contains since particles on , move in a counterclockwise direction to when an actuator is activated at . It is strict containment as the particles always move away from .

Figure 10: The circle contains the boundary from to .

Now consider the circle that has the chord as diameter. Since is the accumulation point for , it is the farthest point from . This implies that the the center of lies on the segment , with radius . contains since . (Figure 11).

Figure 11: The circle contains the circle and thus contains the boundary from to .

Let be an arbitrary point in . Since is in the interior of , we have that . By convexity, we have that . Consider the cone formed by the ray from to and the ray at that is an extension of the line through and . Since , we have that the angle formed at this ray is strictly less than and is contained in the cone. Lemma 3 in [7] states that when is contained in a cone at with angle at most for every then is self-approaching from to . By Lemma 8, we have that an activation of an actuator at sends clockwise around the boundary to since . Therefore, the vertices move in a clockwise direction to .

We have now shown the polygon is 1-gatherable from .

As a consequence of the previous lemma, in order to tell if a polygon is -gatherable, it suffices to determine if it is -gatherable from the boundary. To do this in linear time, we employ an approach that resembles the rotating calipers algorithm to compute the diameter of a convex polygon [13]. In essence, for every point on , we want to compute the first clockwise and first counterclockwise accumulation point. We do this in two steps. We compute all the counterclockwise accumulation points then compute the clockwise accumulation points. The algorithm to compute the counterclockwise accumulation points proceeds as follows. We start at the lowest point of and place the first horizontal caliper at . We then walk around the boundary in counterclockwise direction until we find the counterclockwise accumulation point for . We place the second caliper at such that it is perpendicular to . As moves counterclockwise around , there are two types of events. Either moves to a new vertex or the caliper at becomes coincident to an edge of in which case moves from one vertex to the next. There are a linear number of events that occur and by recording these events, when the calipers returns to its starting positions, we know the counterclockwise accumulation point for every point on the boundary of . By repeating this in the clockwise direction, we find the clockwise accumulation points. For any point on the boundary of , if its clockwise accumulation point is the same as its counterclockwise accumulation point, then the polygon is 1-gatherable from that point. We conclude this section with the following:

Theorem 4.

We can determine if a convex -vertex polygon is 1-gatherable in time.


Follows from Lemma 9 and the discussion above. ∎

4 2-Gatherability

In this section we prove that a convex polygon with at most two acute vertices is 2-gatherable. We then give an algorithm to determine the location of the two actuators and the sequence of activation.

Figure 12: Figure for Lemma 5
Theorem 5.

If a convex polygon has two or fewer acute vertices, then it is 2-gatherable.


Let be the smallest disk enclosing polygon with centre . Either there are two vertices and of that form a diameter of or there are three vertices , , and on such that is in the interior of the triangle formed by the three vertices [12, 15]. We consider each case separately. Recall that by Lemma 6, we can assume that the particles are only located on the boundary of .

Case 1: Two vertices and of form a diameter of . In this case, we show that an actuator activated at vertex results in all particles accumulating at . Assume, without loss of generality, that and lie on a vertical line with below . The two vertices partition the polygon boundary into two chains, which is to the right of and which is to the left. We also assume that each chain consists of at least two edges, since otherwise, one of the chains is the edge and trivially any particle on this edge moves to when an actuator at is activated. To complete the proof in this case, by Lemma 8, it suffices to show that both and are self-approaching curves from to .

Consider any point . Since is in strictly to the right of we have that . Consider the cone formed by the intersection of the half-space bounded by the line through and that contains and the half-space bounded by the line through and that does not contain . This cone has angle at most and contains . Since is an arbitrary point on , by Lemma 3 in [7], we have that is self-approaching from to . A similar argument shows that is also self-approaching from to .

Case 2: There are three vertices , , and appearing in counter-clockwise order on such that is in the interior of the triangle formed by the three vertices. Since there are at most two acute vertices, without loss of generality, assume that is a polygon vertex with interior angle at least . Reorient the polygon such that is the lowest point. The polygonal chains , and are self-approaching from to , to and to , respectively, by the same argument as the one used in Case 1. In fact, since is strictly in the interior of the triangle formed by the three vertices, we have that the cones used to prove that the chains are self-approaching have an angle that is strictly less than .

By placing a first active actuator on , we have that all the particles on and all the particles on move onto . Since is self-approaching from to , if we activated a second actuator at then all the particles on this chain move to ’s accumulation point which would complete the proof. However, even though is not acute, it may be the case that is the counterclockwise accumulation point for . This would prevent us from placing an actuator on since after the activation of the first actuator on , particles have accumulated on . Recall that all subsequent placements of actuators must be on points in that are free of particles. Since for every point on , , there must exist a point on the edge infinitessimally close to such that the is still strictly greather than for every . This implies that is self-approaching from to . Thus, by Lemma 8, activating a second actuator at , which is free of particles after the first activation, moves all the particles that have accumulated on to the counterclockwise accumulation point of .


  • [1] Sang Won Bae, Chan-Su Shin, and Antoine Vigneron. Improved bounds for beacon-based coverage and routing in simple rectilinear polygons. arXiv preprint arXiv:1505.05106, 2015.
  • [2] Michael Biro. Beacon-based routing and guarding. PhD thesis, State University of New York at Stony Brook, 2013.
  • [3] Michael Biro, Justin Iwerks, Irina Kostitsyna, and Joseph SB Mitchell. Beacon-based algorithms for geometric routing. In Symp. on Alg. and Data Struct. (WADS), pages 158–169. 2013.
  • [4] Herbert Edelsbrunner and Leonidas J. Guibas. Topologically sweeping an arrangement. J. Comput. Syst. Sci., 38(1):165–194, 1989.
  • [5] Herbert Edelsbrunner and Leonidas J. Guibas. Corrigendum: Topologically sweeping an arrangement. J. Comput. Syst. Sci., 42(2):249–251, 1991.
  • [6] Leonidas J. Guibas and Jorge Stolfi. Primitives for the manipulation of general subdivisions and computation of voronoi diagrams. ACM Trans. Graph., 4(2):74–123, 1985.
  • [7] Christian Icking, Rolf Klein, and Elmar Langetepe. Self-approaching curves. Math. Proc. Camb. Phil. Soc., 123(3):441–453, 1999.
  • [8] Irina Kostitsyna, Bahram Kouhestani, Stefan Langerman, and David Rappaport. An optimal algorithm to compute the inverse beacon attraction region. In Symp. on Comp. Geom. (SoCG), pages 55:1–55:14, 2018.
  • [9] Bahram Kouhestani, David Rappaport, and Kai Salomaa. On the inverse beacon attraction region of a point. In Canadian Conf. on Comp. Geom., 2015.
  • [10] Bahram Kouhestani, David Rappaport, and Kai Salomaa. The length of the beacon attraction trajectory. In Canadian Conf. on Comp. Geom., pages 69–74, 2016.
  • [11] Bahram Kouhestani, David Rappaport, and Kai Salomaa. Routing in a polygonal terrain with the shortest beacon watchtower. Comput. Geom., 68:34–47, 2018.
  • [12] Nimrod Megiddo.

    Linear-time algorithms for linear programming in

    and related problems.
    SIAM J. Comput., 12(4):759–776, 1983.
  • [13] Michael Shamos. Computational Geometry. PhD thesis, Yale Univeristy, 1978.
  • [14] Thomas C Shermer. A combinatorial bound for beacon-based routing in orthogonal polygons. arXiv preprint arXiv:1507.03509, 2015.
  • [15] Emo Welzl. Smallest enclosing disks (balls and ellipsoids). In New Results and New Trends in Computer Science, pages 359–370, 1991.