Bisecting three classes of lines

We consider the following problem: Let $\mathcal{L}$ be an arrangement of $n$ lines in $\mathbb{R}^3$ colored red, green, and blue. Does there exist a vertical plane $P$ such that a line on $P$ simultaneously bisects all three classes of points in the cross-section $\mathcal{L} \cap P$? Recently, Schnider [SoCG 2019] used topological methods to prove that such a cross-section always exists. In this work, we give an alternative proof of this fact, using only methods from discrete geometry. With this combinatorial proof at hand, we devise an $O(n^2\log^2(n))$ time algorithm to find such a plane and the bisector of the induced cross-section. We do this by providing a general framework, from which we expect that it can be applied to solve similar problems on cross-sections and kinetic points.


Introduction
The ham-sandwich theorem is a fundamental result in discrete and computational geometry. It asserts that for a set of points in R d with d classes, there exists a hyperplane that simultaneously bisects all classes. This is tight in the sense that in any dimension, there exist sets with d + 1 classes that cannot be bisected by a hyperplane. To push the boundary of this limitation further, Luis Barba introduced the following problem. 1 Let L be an arrangement of n lines in R 3 . The arrangement L is in general position if no two lines are parallel or intersect and no line is vertical (parallel to the z-axis). Let P be a directed plane, not containing any line of L. A cross-section of L induced by P is the point set defined by the intersection of L with P . We will usually consider the cross-section to be in the plane, i.e., we map P to R 2 . Problem 1. Given an arrangement L of n lines in R 3 in general position colored red, green, and blue, does there exist a cross-section determined by a vertical plane for which there exists a line that simultaneously bisects all three classes of points?
Recently, Schnider [21] was able to answer this question in the affirmative. Actually, the plane defining such a cross-section can be chosen to contain any vertical line disjoint from L. However, this freedom of choice can not be used to show an analogous statement for four colors, Barba showed that three colors is tight if we restrict ourselves to vertical planes. 2 On the other hand, if we allow all possible planes, a stronger statement might be possible, but different arguments than the ones in [21] would be necessary. We will reprove the following version of the result for three colors: Theorem 1. Given an arrangement L of n lines in R 3 in general position colored red, green, and blue, none of which intersect the z-axis. Then, there exists a plane through the z-axis that defines a cross-section for which there exists a line that simultaneously bisects all three classes of points.
Note that in [21], the result is phrased differently, but this version follows analogously from the arguments in that paper. The proof in [21] is existential using topological methods. In this work, we provide a combinatorial proof (i.e., a proof that uses only methods from discrete geometry and combinatorics) of Theorem 1 that sheds further light on the structure of the problem. This allows us to devise an O(n 2 log 2 (n)) time algorithm to find such a plane and the bisector of the induced cross-section.
Preliminaries. Every triple of points of a point set in the plane is oriented either clockwise or counterclockwise, or it is collinear. Two sets of n points (not all on a single line) with a given bijection between them have the same order type if each triple in one set is oriented in the same way as its image in the other set. The orientation of a point triple (p, q, r) is given by the sign of the determinant x p x q x r y p y q y r 1 1 1 .
In particular, it is 0 if the points are on a line. Whether there is a bisecting line for a crosssection only depends on its order type (rather than on the actual coordinates of the individual points). We first observe that the points of a cross-section belonging to three lines become collinear only a constant number of times during the rotation of P . W.l.o.g., let n = (t, 1, 0) T be the normal vector of P at time t. Then the coordinates of the intersection point of a line and P is a function in t. Three points become collinear if the above determinant is zero. Since we have a rational function of constant degree, the number of times at which three points of a cross-section become collinear is constant. Further, there is a change in the order type if one of the lines is parallel to P , which happens only once. In total, such a cross-section of n lines thus determines O(n 3 ) different order types. (See [17,2]  Related work. There is a vast number of algorithmic results for problems related to ham-sandwich cuts. Lo, Matoušek, and Steiger [15] provide a linear-time algorithm for finding a ham-sandwich cut in the plane (following a linear-time randomized algorithm by Lo and Steiger [16]). They also provide algorithms for higher dimensions. In contrast to that, optimally counting the number of ham-sandwich cuts of a bi-colored point set is still an open problem. The current best algorithm relies on walking the median level of the dual line arrangement and keeping track of the levels of the two color classes [5]. This can be done in O(n 4/3 log 1+ (n)) time [6,10] for any > 0. (We will also use this as a sub-algorithm.) Arrangements of lines in R 3 were probably first considered as a data structure by McKenna and O'Rourke [19]. Chazelle et al. [7] consider further algorithms and properties related to such arrangements. Lines in R 3 naturally appear in connection with kinetic data structures. Problems that involve points moving at individual constant speed can be modeled as problems on line arrangements in R 3 and cross-sections with vertically translated planes (see, e.g., [4] for a historical account). For such problems, the number of changes in the combinatorial structure of the point set is crucial. For example, the order type of a cross-section changes only at the time when three points become collinear. Among other results, Lund et al. [17] give a tight bound of 2 n 3 on the number of point triples that become collinear at some point in time. Aichholzer et al. [2] show that there appear O(n 9 ) different order types in that setting. Combinatorial changes in minimum and maximum spanning trees [13], Voronoi diagrams [3], as well as convex hulls and bounding boxes [1] of such moving points have also been investigated.
Let us emphasize that our setting is different from the one in which the plane is translated. When rotating a plane around the z-axis, it will at some point be parallel to each line of L, making the corresponding point vanish in the cross-section. This does not happen for translated planes. Also, our trajectories are not linear. Lund et al. [17] give an example of a line arrangement in which no point triple changes its orientation; in our setting, after rotating the plane around the z-axis by 180 • , the orientation of all point triples in the cross-section has changed.

A Combinatorial Proof
In this section we give an alternative proof of Theorem 1. The proof relies on an analysis of the changes in the combinatorial structure of the cross-sections when rotating a plane containing the z-axis. In particular, we will show that during a rotation of the plane by 180 • , one of the cross-sections must be such that there exists a line that simultaneously bisects all three classes of points. Further, the method used to prove this allows us to algorithmically decide, for some moment in the rotation, whether a solution appears before or after this moment. This sidedness oracle is a crucial element for the algorithm described in Section 3.

Dual interpretation in cross-sections
For every directed plane P containing the z-axis, denote by S(P ) the induced cross-section. Consider the dual line arrangement A(P ), under the standard point-line-duality. (For example, a point (x p , y p ) is mapped to the line with equation y = x p x + y p .) For an arrangement of m lines, the k-level is the set of points that has at most k lines below it and at most m − k − 1 lines above it. If there is no vertical line, the k-level is a piece-wise linear xmonotone curve. The m 2 -level is called the median level. Denote by r(P ), b(P ) and g(P ) the median levels of the red, green and blue lines in A(P ), respectively. A line that bisects all three point sets in a cross-section S(P ) corresponds to an intersection point of the three median levels r(P ), b(P ) and g(P ). Thus, we want to show that there exists some plane P such that in the induced line arrangement A(P ) the three median levels r(P ), b(P ) and g(P ) have a common intersection.
To this end, we start with some plane P 0 through the z-axis and rotate it around that axis, keeping track of the changes in the induced arrangement. After a rotation of angle π, we will arrive again at P 0 , but oriented the other way; we will call this oriented plane P 1 . Note that S(P 1 ) is S(P 0 ) mirrored at the z-axis. Similarly, A(P 1 ) is A(P 0 ) mirrored at the z-axis. (The first coordinate of a point corresponds to the slope of the dual line; hence, mirroring along the z-axis, which is the y-axis of the plane, corresponds to inverting all slopes, which in turn is equivalent to mirroring along the z-axis.) We will now study what type of changes can occur in the intersection pattern of the middle levels during this rotation.
For simplicity, we assume that each color class of L contains an odd number of lines. (This assumption may be dropped at the cost of a more involved exposition.) Then all three median levels are x-monotone curves along lines of the arrangement, except in the degenerate cases where the plane is parallel to one of the lines. We will look at these degenerate cases later. For now, suppose no line is parallel to P . We walk along the green median level g(P ) (which is now just a curve) and look at the order of intersections with r(P ) and b(P ) from left to right. We say that a level m intersects g(P ) from below if m is below g(P ) before the intersection and above afterwards. Similarly, m can intersect g(P ) from above. Note that if an intersection of m and g(P ) is from below, then the next intersection has to be from above. We will call intersections of r(P ) with g(P ) red intersections and intersections of b(P ) with g(P ) blue intersections. Further note that when reorienting P , the order of intersections reverses, and all intersections from above become intersections from below and vice versa.
When rotating the plane P , the dual line arrangement and thus the median levels r(P ), b(P ), and g(P ) change continuously as long as no line becomes parallel to P . Note that the order of intersection along g(P ) can only change when the order type of S(P ) (and thus also A(P )) changes. Further, the only changes in the order type of A(P ) that affect the order of intersection along g(P ) are either the degenerate cases or the ones where a vertex of A(P ) passes over a segment of g(P ). Thus, there are the four ways in which the order of intersection along g(P ) can change during a rotation of P .
1. The first is that a red intersection and a blue intersection switch places (i.e., the relative order in which they appear along g(P )). In this case, the two intersections coincide at some point in time, and the point at which they coincide is an intersection that we are looking for; in particular, this means that three lines of A(P ) meet in a single point. See Figure 1 for an illustration.
2. The second case happens when (without loss of generality) two red intersections, the first from below, the second from above, coincide. Then, rotating further, the two intersections vanish. This type of change does not indicate a solution. See Figure 2 for an illustration.
3. The third case happens when the last segments of g(P ) and (without loss of generality) r(P ) become parallel. Then the last red intersection vanishes, but it reappears as the first red intersection as the rotation of P continues. Furthermore, if this intersection was from above, it is now from below, and vice versa. Also this type of change will not give us a solution. See Figure 3 for an illustration. (This case does not give a change when considering P as a projective plane; however, as we prefer to have an order on the intersections along g(P ), we consider P to be Euclidean.) 4. Finally, a last type of change occurs in the degenerate case when the plane becomes parallel to one of the lines; call it and assume without loss of generality that it is red. See Figure 4 for an illustration. Let m be the number of red lines. In this case, the point of intersection of and P moves towards infinity, vanishes when P is parallel to , and then enters from the other side. In the dual, this corresponds to a line h getting steeper and steeper, until it vanishes when P is parallel to , and then rotating further, changing the sign of its slope. (It is useful to consider h to become vertical at this limit instead of vanishing.) In this situation, the median level r(P ) changes quite drastically: assume without loss of generality that h has negative slope before  it becomes orthogonal and positive slope afterwards. Then, shortly before h vanishes, it has the smallest slope of all red lines. Afterwards, it has the largest slope of all red lines. Furthermore, the new median level (i.e., m 2 -level) of the red arrangement is the former ( m 2 − 1)-level to the left of the intersection of h and r(P ), and it is the former ( m 2 + 1)-level to the right of this intersection. In particular, several pairs of red intersections might have vanished and several red and blue intersections might have switched places. However, at the moment when h is vertical (or actually vanishes), it plays no role for the median level. Thus, the red median level is actually the whole area between the former ( m 2 − 1)-level and the former m 2 -level to the left of h, and the area between the former n 2 -level and the former ( m 2 + 1)-level to the right of h. Thus, if a red and a blue intersection switch places, the blue intersection lies inside the red median level at the moment when h is vertical, and we again have a solution.
(In S(P ), this intersection corresponds to a line through a green and a blue point, bisecting an even number of red points.) The same argument holds if is blue and a similar argument applies if is green.
In conclusion, we can track the intersections of r(P ) and b(P ) along g(P ) and we find a solution whenever a red intersection and a blue intersection switch places. Furthermore, we know that after rotating all the way from P 0 to P 1 the order of intersections has reversed and all intersections that were from above are now from below and vice versa. Thus, what we want to show is that at some point during the rotation, a red and a blue intersection need to switch places. We will do this in a purely combinatorial setting in the next section.

Bi-chromatic Sign Sequences
We define a bi-chromatic sign sequence S as a finite sequence of signs s ∈ {+, −} that satisfies the following conditions: (1) each symbol s is either red or blue; (2) the subsequence of all symbols of one color has odd length and alternates between + and −.  Note that the red and blue intersections along g(P ) define a bi-chromatic sign sequence when writing intersections from above as + and intersections from below as −. See Figure  5 for an illustration.
We define the inverse of a sign s, denoted by s as the other sign, but in the same color. We further define the reverse of S = s 1 , . . . , s k , denoted by S, as s k , . . . , s 1 . Note that if S is the sequence of red and blue intersections for some P , then reorienting P gives rise to S.
We consider the following operations on bi-chromatic sign sequences: These operations describe exactly the changes that can happen for a sequence of red and blue intersections: Case 1 translates to a switch, case 2 gives an insertion or a deletion, case 3 corresponds to a transfer. For case 4, we need the following lemma: Lemma 2. Consider the degenerate case when the plane becomes parallel to one of the lines. Assume that there is no solution at this point of rotation. Then the change in the bichromatic sign sequence defined by the red and blue intersections along g(P ) can be described as a sequence of insertions, deletions and transfers.
Proof. Assume without loss of generality that the line that the plane becomes parallel to is red. In the dual of the cross-section, we will, as above, consider the dual line h to become vertical. Assume again without loss of generality that h has negative slope before it becomes orthogonal and positive slope afterwards. Let r 0 (P ) and r 1 (P ) be the red median levels right before and just after h is vertical. From the assumption that there is no solution at this point of rotation, we conclude that all intersections of b(P ) with g(P ) must be either below or above both r 0 (P ) and r 1 (P ). In particular, the only changes that can happen between two consecutive intersections of b(P ) with g(P ) are insertions and deletions. It remains to analyze the changes before the first and after the last intersection of b(P ) with g(P ). For this, we distinguish two cases. In the first case, both r 0 (P ) and r 1 (P ) start on the same side of g(P ), without loss of generality above. Note that then both r 0 (P ) and r 1 (P ) need to end below g(P ). In particular, the same argument as above also holds before the first and after the last intersection of b(P ) with g(P ). In the second case, r 0 (P ) starts above g(P ), whereas r 1 (P ) starts below g(P ). Then, r 0 (P ) ends below g(P ) and r 1 (P ) ends above g(P ). In particular, without loss of generality, the bi-chromatic sign sequence for r 0 (P ) starts with a red +, while the bi-chromatic sign sequence for r 1 (P ) ends with a red −. This change can be described by a transfer. Again, by the above arguments, all other changes correspond to insertions and deletions. The analogous proof holds when the line that the plane becomes parallel to is blue and similar arguments apply when is green.
In fact, it can be shown that case 4 can always be described as a sequence of insertions, deletions, transfers and switches, but the above lemma is enough for our purposes. Let us summarize our findings so far in a lemma: Lemma 3. Let L be an arrangement of n lines in R 3 colored red, green, and blue, none of which intersect the z-axis. For every oriented plane P containing the z-axis, the induced cross-section defines a bi-chromatic sign sequence. Further, if P 0 and P 1 are two oriented planes and S 0 and S 1 are their induced bi-chromatic sign sequences, rotating P 0 until it coincides with P 1 gives rise to a sequence of bi-chromatic sign sequences from S 0 to S 1 , where two consecutive sign sequences differ by a switch, insertion, deletion or transfer. Finally, every switch used in this transformation from S 0 to S 1 corresponds to a cross-section for which there exists a line that simultaneously bisects all three classes of points.
We will show that it is not possible to transform a sequence S to S using only insertions, deletions and transfers. To this end, we first define the reduced sign sequence of a bichromatic sign sequence: look at a subsequence of consecutive elements of the same color. If this subsequence has even length, remove it. Iteratively removing such consecutive monochromatic subsequences of even length leaves us with a sequence that alternates between the colors. Further, it is easy to check that this sequence is still a bi-chromatic sign sequence. Finally, as both the subsequence of red elements as well as the subsequence of blue elements have odd length, the new sequence is not empty and it starts with a different color than it ends with (a fact that will be crucial in proving the following lemmas). We call the sequence obtained this way the reduced sign sequence of a bi-chromatic sign sequence S, and denote it by ρ(S).
At last, we arrive at our final definition. For a reduced sign sequence ρ(S), we consider two functions. The first, denoted by Σ(ρ(S)), is the sum of "+"-symbols minus the number of "−"-symbols in ρ(S). Note that the value of this function is always in {−2, 0, 2}. The second function, denoted by λ(ρ(S)), is 2 whenever the first symbol of ρ(S) is red and 0 otherwise. We now define the trace τ of a bi-chromatic sign sequence as follows: We continue by proving a few crucial lemmas about traces.

Lemma 4. The trace of a bi-chromatic sign sequence is invariant under insertions, deletions and transfers.
Proof. It follows immediately from the definitions that the reduced sign sequences, and thus the trace, is invariant under insertions and deletions. As for transfers, consider the two sequences S = s 1 , . . . , s k and S = s 2 , . . . , s k , s 1 . If their reduced sign sequences are equal, so are their traces, so assume that their reduced sign sequences are different. In this case we claim that we either have (a) ρ(S) = r 1 , r 2 , . . . , r m and ρ(S ) = r 2 , . . . , r m , r 1 or (b) ρ(S) = r 1 , r 2 , . . . , r m and ρ(S ) = r m , r 1 , . . . , r m−1 . Assume without loss of generality that r 1 is red, and thus r m is blue. We will distinguish the cases where s 1 is red or blue. If s 1 is red we can assume without loss of generality that s 1 = r 1 . In particular, s 1 will be the last element of ρ(S ). Further, as all blocks of the same color in S except the first and last one do not change their length with a transfer, all other elements in ρ(S) stay the same and we are in case (a). If s 1 is blue, the transfer will either create or destroy an odd-length blue block in the beginning of S. In particular, ρ(S ) will begin with a blue element r 0 . On the other hand, the transfer will either create or destroy an even-length blue block at the end of S and thus ρ(S ) will end with the red element r m−1 . Since ρ(S ) is still a bi-chromatic sign sequence, we conclude that r 0 = r m and we are in case (b). In both cases we deduce that Σ(ρ(S )) = Σ(ρ(S)) ± 2 and λ(ρ(S )) = λ(ρ(S)) ± 2. Thus τ (S ) := 1 2 (Σ(ρ(S)) + λ(ρ(S)) ± 4) mod 2 = τ (S) ± 2 mod 2 = τ (S). Note that the above in general does not hold for switch operations. While there is no change in the sum of the signs in the sign sequence by a switch operation, this does not hold for the reduced sign sequence, as the parities of adjacent substrings of the same color changes.
Lemma 5. The traces of a bi-chromatic sign sequence S and its reverse S are different.
Combining Lemma 4 and Lemma 5, we conclude the following: Corollary 6. Any sequence of operations transforming a bi-chromatic sign sequence S into its reverse S contains at least one switch.
Combining this with Lemma 3, we obtain a proof of Theorem 1. In particular, knowing the traces of S and S, computing the trace for a cross-section between S and S also tells us in which direction a switch has to occur. In order to have a sidedness oracle for a plane in our original problem, we thus need to efficiently compute the trace of the reduced sign sequence of the cross-section determined by this plane.
Lemma 7. The reduced sign sequence of a cross-section of n lines can be obtained in O(n 4/3 log 1+ (n)) time.
Proof. We first compute each color class of the bi-chromatic sign sequence separately. To this end, we walk the median level of the line arrangement of the two involved color classes, keeping track of the levels of them (note that every intersection between the two median levels lies in the median level of their total arrangement). That is, we walk the median level of the red and the green lines, and then the median level of the blue and the green lines. This can be done in O(m log 1+ (n)) time [6,10], where m is the complexity of the median level. The current best bound for the complexity of a median level of an arrangement of n lines is O(n 4/3 ) [9]. Further, the above argument shows that the number of elements of each color class in the bi-chromatic sign sequence is bounded by the complexity of the corresponding median level of the arrangement of two colors. Given the two subsequences, we can easily merge them to the order in which they appear from left to right into the bi-chromatic sign sequence. The time this requires is linear in the length of that sequence, which we have just observed to be in O(n 4/3 ). Finally, given a bi-chromatic sign sequence, its reduced sign sequence can easily computed in time linear in the length of the bi-chromatic sign sequence.
All that remains now for the sidedness oracle is to compute the trace of the sign sequence, which can again be easily done in time linear in the length of the reduced sign sequence.
Corollary 8. Given a plane through the z-axis, we can determine on which side of the plane there exists bisecting cross-section in O(n 4/3 log 1+ (n)).

The Algorithm
We may now use the above insight to devise an algorithm to find the defining plane of a cross-section with a simultaneously bisecting line. We first recall that the existence of a bisecting line depends only on the order type of the cross-section. As all events that change the order type of a cross-section between P a and P b are the ones in which three points of the cross-section become collinear, we need to find such an event. As noted in the introduction, within that interval, any triple of points in the cross-sections can change its orientation only a constant number of times, during which it becomes collinear. As there can be Θ(n 3 ) such events, checking all of them would already give a polynomial time algorithm, but we want to do something faster.

A general framework
We will now develop an algorithmic framework that allows us to to find the defining plane of a cross-section with a simultaneously bisecting line efficiently. As all events that change the order type of a cross-section between P a and P b are the ones in which three points of the cross-section become collinear, we need to find such an event. As noted in the introduction, within that interval, any triple of points in the cross-sections can change its orientation only a constant number of times, during which it becomes collinear. As there can be Θ(n 3 ) such events, checking all of them would already give a polynomial time algorithm, but we want to do something faster. For our framework we will assume the following input: 1. a continuously changing family of point sets P t , t ∈ [0, 1] of size n with the property that each triple of points changes their orientation only a constant number of times and for each triple these events can be found in constant time. This family contains some solution point sets P x .
2. a sidedness oracle S which for every t ∈ [0, 1] computes in time T (n) a value S(t) ∈ {−1, 0, 1} with the following properties: For example, the family of point sets could be defined by points in two colors, red and blue, moving at constant speed along trajectories that are described by polynomials of constant degree, the blue points starting left and ending right of the y-axis, the red points starting right and ending left of the y-axis. The solution point sets could then be all point sets where both the blue and the red Tukey median regions can be intersected by a single vertical line. A sidedness oracle could then be constructed by computing both Tukey median regions and checking if the are separated by a vertical line, returning 0 if not, or −1 or 1, depending on which color is to the left of the vertical line. The runtime of the sidedness oracle in this example would be O(n log 3 (n)), see [14].
We will use Megiddo's [20] parametric search technique in the following way. Let P a and P b be two point sets with S(a) = −1 and S(b) = 1 or vice versa (we may start with P a = P 0 and P b = P 1 ). We therefore know that there is at least one solution point set P x between them. The high-level idea is to construct a representation of the order type of the (unknown) point set P x by simulating a parallel sorting algorithm for each point of P x . In each iteration, the sorting algorithm produces a batch of O(n) comparisons that need to be answered. Each comparison is related to a constant number of events. There is a total order in which these events occur when going from P a to P b . By selecting the median of these events in time O(n), we can answer approximately half of the events in each batch by applying the sidedness oracle once. We repeat this O(log(n)) times to answer all the events of the batch. A batch therefore can be processed in O((n + T (n)) log(n)) time. In addition, we update P a and P b at each application of the sidedness oracle to narrow down the interval containing our solution P x . For one run of the sorting algorithm (requiring O(log(n)) batches), this amounts to O((n + T (n)) log 2 (n)) time. In total, we require n runs of the sorting algorithm, giving the total running time of O((n + T (n))n log 2 (n)).
After this high-level exposition, we now turn to the detailed description of our algorithm, where we will also describe how to further speed it up.
Order types and local sequences. The combinatorial representation of the order type we will use is the set of local sequences of unordered switches (for short, local sequences), devised by Goodman and Pollack [12]. (See also the work by Streinu [22] and by Felsner and Weil [11] on that topic.) For any point p of a point set S, consider the rotating line with pivot p; the order in which this line passes over the other points of S is the local sequence of p in S. (While the local sequence is cyclic, it can be linearized by letting it start at the element of S \ {p} with, say, the smallest label.) The local sequences of all the points of S determine the order type of S [12]. We construct these sequences by considering n different (but not independent) sorting problems: for each point p ∈ S, sort the points of S \ {p} around p as they appear along the local sequence.
Determining the order type on P x . Let P = P x be the unknown solution point set. For each point p ∈ P , we run a parallel sorting algorithm that sorts the points of P \ {p} according to the unsigned local sequence of p. Pick an arbitrary point q ∈ P \ {p} with which the sequence should start (recall that it is actually circular). This sorting algorithm has O(log(n)) iterations. In each iteration, we get a batch B of (n − 1)/2 point pairs of S \ {p}; such a pair (a, b) corresponds to a comparison of a and b in the order around p, that can be answered by knowing the order type of the four points p, q, a, b. Between P a and P b , there are at most a constant number of events at which this order type changes (all of which can be obtained in constant time). Thus, for the batch B of comparisons, we get a list E of such events, whose size is in O(|B|) = O(n). Each event is associated with a value t in the interval [a, b]. As soon as we know for each event the side on which the solution P lies, we can answer all the comparisons of the batch B. We pick the median of these events in O(n) time, which gives us a point set P at which the event happens. We apply the sidedness oracle to determine the side of P containing P (or find a solution, if the oracle returns 0). Also, we update P a or P b by setting one to P , maintaining the invariant that P is between P a and P b . Hence, in T (n)+O(n) time, we can process approximately half of the events; after O(log(n)) iterations of picking the median of the remaining events and narrowing the interval between P a and P b , all events E of the batch B have been answered. That is, we are left with an interval between P a and P b that contains the solution P and within which the orientation of the point triples involved in the comparisons does not change. In total, the parallel sorting algorithm requires us to answer O(log(n)) batches to sort the points around p. Hence, after O((n + T (n)) log 2 (n)) time, the local sequence of a point p in the point set P is determined. We do this for all n points of P , further narrowing down the interval between P a and P b . Thus after a total of O((n + T (n))n log 2 (n)) = O(n 2 log 2 (n) + T (n)n log 2 (n)) steps, the local sequence of all the points and thus the order type of P is determined. Further, in the final interval [a, b], this order type does not change, meaning that a solution is found.
Speeding up. As an anonymous reviewer noted, the above algorithm can be sped up by using a slight variation of the parallel sorting algorithm: by bundling together O(n) batches of all n runs of the sorting algorithm, we get O(log(n)) batches, each of size O(n 2 ). For each such batch, we pick the median of the events in O(n 2 ) time and apply the sidedness oracle to determine the side of P containing P (or find a solution, if the oracle returns 0). Hence, in T (n) + O(n 2 ) time, we can process approximately half of the events, leaving us again with O(log(n)) iterations to answer all events of the batch. As we again have O(log(n)) batches, the local sequence of all the points and thus the order type of P can thus be determined in time O((n 2 + T (n)) log 2 (n)) = O(n 2 log 2 (n) + T (n) log 2 (n)).
This algorithm proves the following: Given an input to the framework described above, a solution point set P can be found in time O(n 2 log 2 (n) + T (n) log 2 (n)).

Applying the framework
We may now use the above framework to devise an algorithm to find the defining plane of a cross-section with a simultaneously bisecting line. We first recall that the existence of a bisecting line depends only on the order type of the cross-section. In this terminology, we observe that there exists a bisection only if three points of the cross-section become collinear (i.e., when the median levels of the three classes intersect in a single point), or when a line of L becomes parallel to the defining plane P (and thus the intersection of two median levels is inside the two-dimensional region defined by the third one). In particular, the latter events constitute a change in the order type that is not captured by our framework. When rotating the plane P 0 by an angle of π, there are n events in which a line becomes collinear to the plane. We will now describe how we handle these events. We start by arbitrarily choosing P 0 (and thus P 1 ). For each line in L, we can determine in constant time the plane between P 0 and P 1 that is parallel to it. For each of these n planes, we would like to compute the reduced sign sequence. If the solution is at one of these n events, we are done. Otherwise, the sign sequences give us two planes between which there is a solution, and between which there is no event in which a line becomes parallel to the rotating plane. This interval (or a solution) can be found using binary search in O(n log(n) + T (n) log(n)) time. We let P a and P b be these two planes.
From the observations in the introduction, it follows that the number of the other events is in O(n 3 ); in particular, recall that the number of times a point triple on P changes its order type is constant. Further, Corollary 8 gives us a sidedness oracle for these events. We can thus apply to above framework with P 0 = P a and P 1 = P b . The runtime of the framework dominates the above computations, thus the total runtime of our algorithm is O(n 2 log 2 (n)+ T (n) log 2 (n)). Recall that from Corollary 8, we have T (n) ∈ O(n 4/3 log 1+ (n)), hence we get the following: Theorem 10. Given an arrangement L of n lines in R 3 colored red, green, and blue, none of which intersect the z-axis. Then, a plane through the z-axis that defines a cross-section for which there exists a line that simultaneously bisects all three classes of points can be found in O(n 2 log 2 (n)) time.

Conclusion
We have given a combinatorial proof of Theorem 1. The underlying structures that we discovered allowed us to give an O(n 2 log 2 (n)) time algorithm. We did this by providing a general framework that can be used for continuously changing point sets. We do not believe that the runtime of our algorithm is best possible, it would be interesting to see whether other techniques might give a better runtime. Applying techniques like ε-nets and cuttings so far did not lead to an improved algorithm.
It is also not clear that we really need all possible events: if one could for example show, that there is always a bisector at an event where one line becomes parallel to the plane, we would only need the first part of the algorithm, which would reduce its runtime. We were so far not able to find an example of an arrangement where no solution is at such an event.
Apart from the existence of a ham-sandwich cut there are many other problems that could be studied for cross-sections of a rotating plane, e.g. finding a cross section has the point with the highest (Tukey, simplicial, ...) depth. We expect that our framework can be used to solve some of these problems.