Skip to main content

Why No Intersection Is Missed

Part 1: The Sweep and Three Types of Events followed a complete sweep of four segments. This part is still Chapter 2. We now turn the rules illustrated by that example into reasoning that applies to every allowed input.

Recall the Assumptions and Rules Needed for the Proof​

This chapter considers finitely many nonvertical segments of positive length: no overlaps, no endpoint contacts, and no point shared by three or more segments. All endpoints and intersections have distinct horizontal coordinates. Horizontal segments are allowed. These teaching assumptions help us see the basic mechanism; the complete algorithm must also handle more complicated inputs.

The sweep line is a vertical auxiliary line moving from left to right. An “active segment” is an input currently meeting it. Sorting the heights of those meetings from bottom to top gives the active order; two consecutive segments are neighbors. Endpoint and intersection positions are sweep events. Before and after an event, take the orders immediately to its left and right, respectively.

Initially, only endpoints are in the pending list. Each time, take the unprocessed position with the smallest horizontal coordinate. The three rules are: at a start, check the new segment's neighbors on both sides; at an end, check the two segments formerly separated by the removed segment; at a crossing, exchange the two segments and check the new outer adjacencies.

A check registers an intersection only after confirming that it lies within both segments and strictly to the right of the current sweep position. Keep one copy of each real future intersection until it is taken from the list; report a result only upon reaching the intersection. To connect these rules to individual events, return to the event record table in Part 1.

The Steps of This Proof​

We need to connect four facts: order stays fixed when there is no event; two segments must be neighbors before crossing; new neighbors are checked when they form; therefore, there cannot be a first missed intersection. We first explain the algebra needed for the first fact, then use it in the geometric reasoning that follows.

Start with Heights We Already Know How to Calculate​

In Part 1, AA has height 11 and CC has height 8−x8-x. For example, at x=6x=6, the height of CC is 8−6=28-6=2, above AA. At x=8x=8, its height is 8−8=08-8=0, below AA instead.

We want notation that turns “which is higher?” into a number we can calculate. Then we can answer: when their vertical order reverses, why must there be a position of equal height in between?

Write yA(x)\teachBlue{y_A(x)} for the height of A\teachBlue{A} at horizontal coordinate xx, and yC(x)\teachViolet{y_C(x)} for the height of C\teachViolet{C} at that same coordinate. The subscript tells us which segment; the number in parentheses tells us where to calculate. For example, yC(6)y_C(6) is the height obtained by substituting x=6x=6 into 8−x8-x.

Always subtract the height of AA from that of CC, and call the result dCA(x)d_{CA}(x). The subscript CACA reminds us that the subtraction order remains CC minus AA:

dCA(x)=yC(x)−yA(x).d_{CA}(x)=\teachViolet{y_C(x)}-\teachBlue{y_A(x)}.

Substitute the two heights to obtain dCA(x)=(8−x)−1d_{CA}(x)=(8-x)-1. Remove the parentheses to get 8−x−18-x-1, then combine the constants 8−18-1 to obtain dCA(x)=7−xd_{CA}(x)=7-x.

Same horizontal coordinateHeight of C\teachViolet{C}Height of A\teachBlue{A}Always CC minus AAVertical relationship
x=6x=68−6=28-6=211dCA(6)=2−1=1>0d_{CA}(6)=2-1=1>0CC is above AA
x=7x=78−7=18-7=111dCA(7)=1−1=0d_{CA}(7)=1-1=0Equal heights; they intersect at PP
x=8x=88−8=08-8=011dCA(8)=0−1=−1<0d_{CA}(8)=0-1=-1<0CC is below AA
Before the intersection, at x=6: C has height 2 and A height 1. With C minus A, d_CA(6)=1.Before the intersection, at x=6: C has height 2 and A height 1. With C minus A, d_CA(6)=1.
At the intersection, x=7: C and A have equal height at P=(7,1), so d_CA(7)=0.At the intersection, x=7: C and A have equal height at P=(7,1), so d_CA(7)=0.
After the intersection, at x=8: C has height 0 and A height 1. Still using C minus A, d_CA(8)=-1.After the intersection, at x=8: C has height 0 and A height 1. Still using C minus A, d_CA(8)=-1.

Read the panels in order: before, at, and after the intersection. All three use the same scale. A vertical dashed line marks the comparison position, and dots mark the heights at that horizontal coordinate. We have extracted A,CA,C from Part 1 without changing their coordinates.

A height difference can be positive, zero, or negative. It is not the nonnegative distance obtained by always subtracting “lower” from “higher.” If we switched whichever segment is higher to the front of the subtraction, we would lose the indication that their vertical order has reversed. The concrete calculation shows what the notation is for; next we must prove the result for any two segments.

Write the Height Difference for Any Two Segments​

Choose two nonvertical segments U,VU,V. Write yU(x),yV(x)y_U(x),y_V(x) for their respective heights at horizontal coordinate xx. Whenever we discuss a range of horizontal coordinates, we will require both segments to exist throughout it, so that points on extended lines are not mistaken for points on the segments.

As explained in Writing a Line Equation from Two Endpoints, the height on a nonvertical line can be written as “a fixed number times the horizontal coordinate, plus another fixed number.” Write the two containing lines separately:

yU(x)=mUx+bU,\teachBlue{y_U(x)}=\teachBlue{m_U}x+\teachBlue{b_U}, yV(x)=mVx+bV.\teachOrange{y_V(x)}=\teachOrange{m_V}x+\teachOrange{b_V}.

mU,bUm_U,b_U are the first line's two fixed coefficients, and mV,bVm_V,b_V are the second line's. Subscripts distinguish which line each belongs to. The horizontal coordinate xx can change, but these four coefficients do not change as the sweep moves.

For this chosen pair, always use VV minus UU, and denote the height difference by d(x)d(x):

d(x)=yV(x)−yU(x).d(x)=\teachOrange{y_V(x)}-\teachBlue{y_U(x)}.

Thus d(x)>0d(x)>0 means VV is above UU, d(x)=0d(x)=0 means equal heights, and d(x)<0d(x)<0 means VV is below UU. Earlier, dCA(x)d_{CA}(x) specifically meant CC minus AA in the example; here d(x)d(x) specifically means the chosen VV minus UU.

To understand how d(x)d(x) changes with position, first substitute the two line expressions:

d(x)=(mVx+bV)−(mUx+bU).d(x)=(m_Vx+b_V)-(m_Ux+b_U).

Subtracting the entire parenthesized expression changes the signs of both terms:

d(x)=mVx+bV−mUx−bU.d(x)=m_Vx+b_V-m_Ux-b_U.

Group the terms containing xx together and the fixed constants together:

d(x)=(mVx−mUx)+(bV−bU).d(x)=(m_Vx-m_Ux)+(b_V-b_U).

Both terms in the first group contain xx, so factor it out using the distributive law:

d(x)=(mV−mU)x+(bV−bU).d(x)=(m_V-m_U)x+(b_V-b_U).

Only now introduce abbreviations for the two coefficient differences. Let the Greek letters α\alpha (alpha) and β\beta (beta) denote

α=mV−mU,β=bV−bU.\alpha=m_V-m_U,\qquad \beta=b_V-b_U.

Then

d(x)=αx+β.d(x)=\alpha x+\beta.

β\beta is the difference between the two lines' constant terms; it is a different quantity from either bUb_U or bVb_V. Each has its own notation. This form lets us compare the heights by studying a single height-difference expression, without writing both lines at every step.

First Handle a Constant Height Difference​

If α=0\alpha=0, then d(x)=0×x+β=βd(x)=0\times x+\beta=\beta. Whatever the horizontal coordinate, the height difference is the same number.

When β>0\beta>0, VV remains above UU; when β<0\beta<0, VV remains below UU. Neither case can reverse the order.

When β=0\beta=0, the equation α=mV−mU=0\alpha=m_V-m_U=0 gives mV=mUm_V=m_U, and β=bV−bU=0\beta=b_V-b_U=0 gives bV=bUb_V=b_U. The two containing lines coincide completely. If the segments also both cover a horizontal-coordinate interval of positive length, their heights match at every position in that interval, producing a nonzero-length overlap. This chapter excludes overlaps, so this situation cannot occur on the common interval we are about to discuss.

What remains to study is a height difference that changes sign. Then α\alpha cannot be zero. Our goal is to find a position in between where the difference equals zero.

Use a Ratio to Describe an Intermediate Position​

Choose two horizontal coordinates: uu on the left and vv on the right, so u<vu<v. Suppose U,VU,V both exist throughout the interval from uu to vv, with both ends also within each segment's bounds.

d(u)d(u) means substituting position uu into the height-difference expression: d(u)=αu+βd(u)=\alpha u+\beta. Similarly, d(v)=αv+βd(v)=\alpha v+\beta. The u,vu,v in parentheses are not multipliers; they tell us “at which horizontal coordinate to calculate.”

First assume d(u)>0d(u)>0 and d(v)<0d(v)<0: on the left, VV is above UU; on the right, it is below UU. We know the differences at the two ends and want to find where the difference is zero between them. For this, we first need a way to describe every intermediate position.

First Walk Along a Number Line​

Consider a separate numerical example: moving from horizontal coordinate 22 to 1010, the full distance is 10−2=810-2=8. After covering one quarter of it, the distance traveled is 14×8=2\frac14\times8=2, and the current position is

2+2=4.2+2=4.

Here 44 is between 22 and 1010. To obtain the current position, calculating the distance traveled is not enough; we must add the starting position.

Number-line example: from 2 to 10, the full distance is 8. At a ratio of one quarter, the distance traveled is 2 and the current position is 4.Number-line example: from 2 to 10, the full distance is 8. At a ratio of one quarter, the distance traveled is 2 and the current position is 4.

The shorter marked line shows the distance traveled, and the longer one shows the full distance. Both are measured from the same starting point. They are drawn above and below the number line to distinguish their lengths, not to represent two different paths.

Now Use General Notation​

From uu to vv, the full distance is v−uv-u, which is positive because v>uv>u. Let tt denote “the fraction of the full distance already traveled”: for example, t=14t=\frac14 means one quarter. The traveled distance is t(v−u)t(v-u). Add the starting position to obtain the current position:

u+t(v−u).u+t(v-u).
General number line: start u, end v, full distance v-u; distance traveled t(v-u), current position u+t(v-u). The diagram uses 0<t<1.General number line: start u, end v, full distance v-u; distance traveled t(v-u), current position u+t(v-u). The diagram uses 0<t<1.

When t=0t=0, the distance traveled is zero and we remain at uu. When t=1t=1, the position is u+(v−u)=vu+(v-u)=v. If 0<t<10<t<1, multiplying the inequality by positive v−uv-u gives

0<t(v−u)<v−u.0<t(v-u)<v-u.

Add uu to all three parts:

u<u+t(v−u)<u+(v−u)=v.u<u+t(v-u)<u+(v-u)=v.

Thus, finding a ratio tt strictly between 00 and 11 gives a position strictly between u,vu,v. Next we want the height difference at this position to be exactly zero.

Calculate Where the Height Difference Is Zero​

Why Rewrite It Using the Height Differences at the Ends?​

We know d(u)>0d(u)>0 and d(v)<0d(v)<0, but not the difference in between. The purpose of rewriting is therefore to express the intermediate difference in terms of d(u),d(v)d(u),d(v), so that we can use these known signs.

In d(x)=αx+βd(x)=\alpha x+\beta, replace xx with the position just described:

d(u+t(v−u))=α(u+t(v−u))+β.d\bigl(u+t(v-u)\bigr)=\alpha\bigl(u+t(v-u)\bigr)+\beta.

Expand the outer parentheses using the distributive law:

d(u+t(v−u))=αu+αt(v−u)+β.d\bigl(u+t(v-u)\bigr)=\alpha u+\alpha t(v-u)+\beta.

Group αu\alpha u with β\beta. In the remaining product, change the factor order to put tt first:

d(u+t(v−u))=(αu+β)+tα(v−u).d\bigl(u+t(v-u)\bigr)=(\alpha u+\beta)+t\alpha(v-u).

Expand α(v−u)=αv−αu\alpha(v-u)=\alpha v-\alpha u:

d(u+t(v−u))=(αu+β)+t(αv−αu).d\bigl(u+t(v-u)\bigr)=(\alpha u+\beta)+t(\alpha v-\alpha u).

The first parenthesized expression is already d(u)d(u). To recognize the second, separately calculate the difference between the height differences at the ends:

d(v)−d(u)=(αv+β)−(αu+β).d(v)-d(u)=(\alpha v+\beta)-(\alpha u+\beta).

Remove parentheses, then group the constant terms:

d(v)−d(u)=αv+β−αu−β=(αv−αu)+(β−β).d(v)-d(u)=\alpha v+\beta-\alpha u-\beta =(\alpha v-\alpha u)+(\beta-\beta).

Since β−β=0\beta-\beta=0, we have d(v)−d(u)=αv−αud(v)-d(u)=\alpha v-\alpha u. Substitute these two identified expressions back:

d(u+t(v−u))=d(u)+t(d(v)−d(u)).d\bigl(u+t(v-u)\bigr)=\teachBlue{d(u)}+t\bigl(\teachOrange{d(v)}-\teachBlue{d(u)}\bigr).

This says that the height difference at an intermediate position equals the left-end height difference plus tt times the change between the two ends. It is not an extra assumption: it is the equality we have just expanded step by step, and it holds for every ratio tt.

Set the Difference to Zero, Then Check the Ratio​

Equal heights mean a zero height difference. Set the right-hand side above to zero:

0=d(u)+t(d(v)−d(u)).0=d(u)+t\bigl(d(v)-d(u)\bigr).

Subtract d(u)d(u) from both sides:

−d(u)=t(d(v)−d(u)).-d(u)=t\bigl(d(v)-d(u)\bigr).

Multiply both sides by −1-1, changing the signs of both terms inside the right-hand parentheses:

d(u)=t(−d(v)+d(u)).d(u)=t\bigl(-d(v)+d(u)\bigr).

Exchange the order of those two terms to write

d(u)=t(d(u)−d(v)).d(u)=t\bigl(d(u)-d(v)\bigr).

Since d(v)<0d(v)<0, we have −d(v)>0-d(v)>0. Also d(u)>0d(u)>0, so

d(u)−d(v)=d(u)+(−d(v))>d(u)>0.d(u)-d(v)=d(u)+\bigl(-d(v)\bigr)>d(u)>0.

Thus d(u)−d(v)d(u)-d(v) is nonzero, and we may divide both sides of the equation by it:

d(u)d(u)−d(v)=t,\frac{d(u)}{d(u)-d(v)}=t,

or

t=d(u)d(u)−d(v).t=\frac{\teachBlue{d(u)}}{\teachBlue{d(u)}-\teachOrange{d(v)}}.

We must also check that this solution does not place us outside the two ends. Both numerator and denominator are positive, so t>0t>0. The numerator d(u)d(u) is smaller than the denominator d(u)−d(v)d(u)-d(v). Divide both sides of that inequality by this positive denominator:

d(u)d(u)−d(v)<d(u)−d(v)d(u)−d(v)=1.\frac{d(u)}{d(u)-d(v)}<\frac{d(u)-d(v)}{d(u)-d(v)}=1.

Therefore 0<t<10<t<1. The earlier number-line reasoning tells us that u+t(v−u)u+t(v-u) lies strictly between u,vu,v. Substituting this tt back into the zero-difference equation indeed makes the difference zero. Since both segments exist throughout the interval, this equal-height position is an intersection of the two segments.

What If the Difference Changes from Negative to Positive?​

Keep d(x)=yV(x)−yU(x)d(x)=y_V(x)-y_U(x); do not switch the subtraction order. Now assume d(u)<0d(u)<0 and d(v)>0d(v)>0. The earlier substitutions, expansions, and rearranged equations still hold. Only the justification for division and the inequalities changes.

Since d(u)<0<d(v)d(u)<0<d(v), we have d(u)−d(v)<0d(u)-d(v)<0, which is still nonzero. The equation gives the same ratio formula. To see its size clearly, multiply numerator and denominator by the nonzero number −1-1:

t=d(u)d(u)−d(v)=−d(u)−(d(u)−d(v))=−d(u)d(v)−d(u).t=\frac{d(u)}{d(u)-d(v)} =\frac{-d(u)}{-(d(u)-d(v))} =\frac{-d(u)}{d(v)-d(u)}.

The last step distributes the negative sign in the denominator, giving −d(u)+d(v)=d(v)−d(u)-d(u)+d(v)=d(v)-d(u). Now the numerator −d(u)>0-d(u)>0, and the denominator d(v)−d(u)=d(v)+(−d(u))d(v)-d(u)=d(v)+(-d(u)) is greater than the numerator. Hence

0<−d(u)<d(v)−d(u).0<-d(u)<d(v)-d(u).

Divide all three parts by positive d(v)−d(u)d(v)-d(u) to obtain 0<t<10<t<1 again. Thus a change from negative to positive also produces a segment intersection strictly between the ends. If the height difference at an end is already zero, that end is already an intersection; the two sign-change cases here address endpoints whose differences are both nonzero.

Without an Event, the Order Cannot Change​

We have now proved: if both segments exist throughout an interval and their vertical order is reversed at its ends, there must be an intersection inside the interval. We handled both directions of sign change, as well as the case of a constant height difference.

Now consider a horizontal-coordinate range with no endpoint and no intersection. With no endpoint, no segment starts or ends, so the active membership stays fixed. If some pair changed its vertical order, we could choose a position before and one after the change where the height difference, taken in the same subtraction order, has opposite signs. By the result just proved, there must be an intersection in between, contradicting the absence of intersections in this range.

Thus every pair's vertical relationship stays fixed, and so does the entire active order. We need to update the order only at sweep events, not re-sort after every tiny movement. Next we use this fact to investigate whether a third segment can remain between two segments just before they cross.

Why Must Two Segments Become Neighbors Before Crossing?​

The preceding result applies to any pair. Now suppose the chosen U,VU,V intersect, and let pp be the intersection's horizontal coordinate. Here pp is one coordinate value, not the intersection's pair of coordinates. The heights there are yU(p),yV(p)y_U(p),y_V(p). Intersecting means yU(p)=yV(p)y_U(p)=y_V(p).

We will prove that, in a short interval before reaching pp, no other active segment lies between U,VU,V. They do not have to be neighbors from the beginning.

Why Can We Choose an Interval Before the Intersection with No Other Event?​

There are finitely many inputs, each with two endpoints. Since there are no overlaps, each segment pair has at most one intersection. Thus the total number of endpoints and intersections is finite. Here we mean all actual events in the input; we can discuss their geometry without requiring the algorithm to have discovered them first.

Let ee be the horizontal coordinate of the last event to the left of pp. Such an event exists because both left endpoints of U,VU,V lie left of pp, and a finite set of coordinates has a greatest member. Event coordinates are all distinct, so e<pe<p.

Choose r=(e+p)/2r=(e+p)/2 between them. Why is it between them? Subtract separately:

r−e=e+p−2e2=p−e2>0,r-e=\frac{e+p-2e}{2}=\frac{p-e}{2}>0, p−r=2p−e−p2=p−e2>0.p-r=\frac{2p-e-p}{2}=\frac{p-e}{2}>0.

Both inequalities follow from p−e>0p-e>0 and divisor 2>02>0. Thus e<r<pe<r<p, and there is no other endpoint or intersection from rr up to, but not including, pp.

The intersection of U,VU,V is in both interiors because endpoint contacts are excluded. Their left endpoints are no later than ee, and their right endpoints lie to the right of pp. Hence U,VU,V both exist throughout the interval from rr to pp.

By “no event, no order change,” active membership and vertical order remain fixed from rr up to the left side of pp. We can now ask whether some other segment can lie between U,VU,V in this stable order.

Suppose for Now That a Segment W Lies Between Them​

To rule out this possibility, assume temporarily that an active segment WW lies between them at rr. This is a “proof by contradiction”: we temporarily accept the situation we want to exclude. If it necessarily violates a known condition, the assumption cannot be true.

Write yW(x)y_W(x) for the height of WW at horizontal coordinate xx. First consider UU below and VV above. At rr we have

yU(r)<yW(r)<yV(r).y_U(r)<y_W(r)<y_V(r).
Temporary assumption for contradiction: at r, to the left of intersection coordinate p, W lies between U and V. There is no other event from r up to p.Temporary assumption for contradiction: at r, to the left of intersection coordinate p, W lies between U and V. There is no other event from r up to p.

This figure shows the assumption we aim to rule out. It initially draws only a short part of WW near rr, without deciding its height at pp. Dashed lines r,pr,p mark the range of the argument. This is not a set of inputs already confirmed to satisfy the chapter's assumptions.

First confirm that WW cannot disappear. It is already active at rr. If it ended between rr and pp, that would be an endpoint event, contradicting the absence of events in this range. If it ended exactly at pp, its endpoint would share the horizontal coordinate of the intersection of U,VU,V, also violating the assumptions. Thus WW exists all the way to pp.

Next confirm that it cannot move outside the pair before reaching pp. There is no event from rr up to pp, so the active order stays fixed: WW remains above UU and below VV. Only one question remains: at the boundary position pp itself, could it suddenly lie outside the two segments?

Where Can the Height of W Be at the Intersection?​

If yW(p)<yU(p)y_W(p)<y_U(p), then the height difference WW minus UU is positive at rr and negative at pp. Both segments exist throughout the interval from rr to pp. By the sign-change result proved earlier, W,UW,U must intersect strictly between r,pr,p. This contradicts the absence of other events. Therefore yW(p)<yU(p)y_W(p)<y_U(p) is impossible, meaning

yU(p)≤yW(p).y_U(p)\le y_W(p).

If yW(p)>yV(p)y_W(p)>y_V(p), the height difference WW minus VV is negative at rr and positive at pp. Applying the same result for the opposite sign-change direction gives an intersection of W,VW,V strictly between r,pr,p, again a contradiction. Thus yW(p)>yV(p)y_W(p)>y_V(p) is impossible, meaning

yW(p)≤yV(p).y_W(p)\le y_V(p).

Combine these restrictions:

yU(p)≤yW(p)≤yV(p).y_U(p)\le y_W(p)\le y_V(p).

But U,VU,V are intersecting, so yU(p)=yV(p)y_U(p)=y_V(p). A number that can be neither smaller nor greater than this common height must equal it. Therefore

yU(p)=yW(p)=yV(p).y_U(p)=y_W(p)=y_V(p).
Contradiction forced by the between-segments assumption: at p, W can be neither below U nor above V, so it must have the same height as both, giving a point shared by three segments.Contradiction forced by the between-segments assumption: at p, W can be neither below U nor above V, so it must have the same height as both, giving a point shared by three segments.

This figure is the consequence forced by the preceding assumption, not an input allowed in this chapter. Three segments with the same horizontal coordinate and the same height pass through the same point, violating the condition that no point belongs to three or more segments. The figure illustrates the contradiction; its justification remains the two height-difference arguments above.

If VV is below and UU above before the crossing, then WW minus VV is positive at rr, and WW minus UU is negative there. In the same way, rule out the former becoming negative and the latter becoming positive at pp. This gives yV(p)≤yW(p)≤yU(p)y_V(p)\le y_W(p)\le y_U(p). The two ends are still equal, again forcing a point shared by three segments. Neither vertical order permits a segment WW in between.

Thus we must reject the initial assumption that “a WW still lies between them.” Two segments must become neighbors before crossing, although they need not be neighbors from the start. This is a geometric statement about adjacency, not yet a proof that the sweep actually checked the pair. The next section supplies that connection.

Why Are New Neighbors Always Checked When They Form?​

At the beginning, the active order is empty and there are no neighbors. Without an event, neither membership nor order changes, so a new neighboring pair cannot appear on its own. Adjacencies can therefore form only at the three event types.

A start event inserts one segment into the existing order. The relative heights of old segments stay fixed, as do adjacencies away from the insertion position. The only new adjacencies are between the new segment and one segment below and one above. The start rule checks exactly these two sides, skipping a side that does not exist.

An end event removes one segment. The order of all other members stays fixed. If it had a neighbor on each side, the barrier between those two disappears and they become neighbors. The end rule checks exactly this pair. If there was a neighbor on only one side, removing the segment cannot join two old members.

The two segments involved in a crossing are already neighbors before it, as the previous section proved. If a short consecutive portion of the order before crossing is L,U,V,HL,U,V,H, where LL is the lower outer neighbor and HH the upper outer neighbor, afterward it is L,V,U,HL,V,U,H. The only new adjacencies are L,VL,V and U,HU,H, exactly the two pairs checked by the crossing rule; skip nonexistent outer neighbors. U,VU,V merely exchange vertical positions. This pair has not become a different input pair, and there is no need to seek a second intersection.

We have also used the fact that crossing reverses their order. Check it from d(x)=αx+βd(x)=\alpha x+\beta: two distinct lines intersect at pp, so αp+β=0\alpha p+\beta=0. Subtract αp\alpha p from both sides to obtain β=−αp\beta=-\alpha p. Substitution gives d(x)=αx−αpd(x)=\alpha x-\alpha p; factoring out α\alpha gives d(x)=α(x−p)d(x)=\alpha(x-p). Here α\alpha cannot be zero, since then β\beta would also be zero and the lines would coincide, contrary to the no-overlap condition in this situation. The factor x−px-p is negative left of pp and positive right of it. Multiplying by fixed nonzero α\alpha still gives opposite signs on the two sides, so the segments really do exchange order. Other segments neither start nor end here and do not pass through this intersection, so their order stays fixed.

We obtain a conditional statement about the process: provided all earlier events have been processed correctly under the rules, every new neighboring pair is checked when it forms. Why include “earlier”? We are still proving that no intersection is missed, so we cannot assume in advance that “all crossings have been processed.” Next we use only events to the left of a chosen position, avoiding circular reasoning.

Why Can There Be No First Missed Intersection?​

Now connect “neighbors before crossing” with “new neighbors are checked” to prove that the sweep list misses no intersection.

Why Choose the Leftmost Missed Intersection?​

Start a proof by contradiction: temporarily suppose that after the sweep ends, at least one real intersection has been missed. “Missed” means that the intersection of its input pair was not reported upon reaching that position.

There are finitely many intersections, so finitely many missed ones. Choose the one with smallest horizontal coordinate. Denote that coordinate by p∗p_*, and the two inputs crossing there by U∗,V∗U_*,V_*. The subscript ∗* simply marks “the selected earliest missed intersection and its two segments”; it is not multiplication. These symbols are distinct from p,U,Vp,U,V, used earlier for an arbitrary intersection.

Choosing the smallest has this consequence: every real intersection strictly left of p∗p_* was not missed. We assume nothing about the right side, nor do we assume that p∗p_* has already been discovered.

All endpoints enter the list at the start, so endpoints on the left cannot be omitted either. Starting with the empty order on the far left, consider events to the left of p∗p_* in position order: insert at a start, remove at an end, and exchange at a crossing. Each step is processed under the rules. Between consecutive events there is no other event, so order stays fixed. Therefore, up to the left side of p∗p_*, the maintained active order matches the actual geometric order. Every intersection used in this reasoning is left of p∗p_*, precisely the range guaranteed by choosing the earliest missed one.

Find When the Pair Became Adjacent​

The earlier geometric result applies to every intersection, including this one: U∗,V∗U_*,V_* must be neighbors in a short interval before p∗p_*.

The initial order was empty, so this adjacency cannot have existed before the sweep began. Adjacency changes only at events. Tracing the event sequence, we can therefore find the event that created the adjacency that persists until just before p∗p_*. Call that event's horizontal coordinate ss. If they were neighbors earlier and were later separated by another segment, use the last event where they became neighbors again.

This position is strictly left of the intersection: s<p∗s<p_*. It has already been processed correctly. Under the three rules, U∗,V∗U_*,V_* were checked when this adjacency formed. What does that check imply?

First step of the earliest-missed-intersection contradiction: s is less than p_*. At s, U_* and V_* become neighbors and are checked. Their segment intersection confirms future position p_*, which is registered for this input pair.First step of the earliest-missed-intersection contradiction: s is less than p_*. At s, U_* and V_* become neighbors and are checked. Their segment intersection confirms future position p_*, which is registered for this input pair.

Starting from the assumption that p∗p_* was missed, the figure shows relations derived in the proof, not an actual execution trace. On the number line, ss is where adjacency forms and the check occurs; p∗p_* is the supposedly missed position. The arrow above means that checking at ss discovers and registers this future position, not that the sweep immediately jumps there.

Follow the Check All the Way to Reporting​

Check the consequences and the pending-list rules one by one:

  1. The point at p∗p_* really is an intersection of U∗,V∗U_*,V_*. Thus the common point obtained by solving their line equations is within both segments' bounds. It cannot be rejected by the bounds check as the intersection of the extended lines of B,CB,C was in Part 1.
  2. The check occurs at ss, and s<p∗s<p_*. Hence this intersection lies strictly in the future and cannot be rejected as “already reached or passed.”
  3. Therefore, if not yet registered, it must enter the pending list. If it was registered earlier, the list already has that record and no duplicate is needed. In either case, it is in the list.
  4. This chapter's rules retain confirmed real future intersections even when their segments temporarily stop being neighbors. The record therefore cannot disappear before reaching p∗p_*.
  5. Each time, the list yields the leftmost unprocessed position. There are finitely many endpoints and real intersections, and the same event is not registered repeatedly, so the pending events left of p∗p_* will all be taken out. Since p∗p_* remains in the list, the sweep cannot stop or skip past it to a position farther right. It must reach p∗p_* and report the corresponding input pair.
Second step of the earliest-missed-intersection contradiction: after registration at s, the real future intersection p_* remains in the list. Positions are taken in order, eventually reaching p_* and reporting the intersection of U_* and V_*, contradicting the missed-intersection assumption.Second step of the earliest-missed-intersection contradiction: after registration at s, the real future intersection p_* remains in the list. Positions are taken in order, eventually reaching p_* and reporting the intersection of U_* and V_*, contradicting the missed-intersection assumption.

The hollow circle denotes the intersection retained in the list before it is reached, and the filled circle means reaching and reporting it under the rules. “Reporting” here is the necessary consequence of the argument. It directly contradicts the assumption that this intersection was missed.

There can therefore be no first missed intersection. If there were any missed intersections, their finite set would have a first one. Since the first is impossible, no intersection is missed.

Why Are There No False or Duplicate Reports?​

Missing nothing is only part of correctness. We must also show that every reported result is real and no input pair is reported twice.

No false reports: only real intersections computed and confirmed to lie within both segments are registered. The corresponding pair's intersection is reported upon reaching it. Points belonging only to extended lines, not to the segments, cannot enter the results.

No duplicate reports: this chapter excludes overlaps, so two segments have at most one intersection. Each crossing is registered only once, and repeated checks do not create a second record. Upon arrival, it is taken out and reported. If the pair is checked again later, that point is no longer strictly in the future and cannot be added again. Thus each original unordered input pair is reported once.

A result's identity here is its input pair. U∗,V∗U_*,V_* and V∗,U∗V_*,U_* are the same unordered pair; other input pairs have their own identities. Although this chapter excludes points shared by multiple segments, that does not make “same geometric position” a general synonym for “same input pair.” Chapter 1 showed that more complicated inputs can yield results for several distinct pairs at one position.

What Work Is Saved, and What Comes Next?​

The sweep line saves the work of “rechecking every segment pair whenever anything changes.” A start checks at most two new neighboring pairs, an end at most one, and an ordinary crossing at most two. Without an event, the active order needs no update.

This does not mean the total check count is fixed, nor that every intersection computation performed by pairwise checking is avoided. In our example, following adjacency changes checks A,CA,C and A,DA,D again. If there are many intersections, there are inherently many results to report. Maintaining the order and pending list also costs work. Chapter 10 will bring these costs together.

This part also relies on several decisions: which segment is higher, where an intersection lies, whether it remains inside both segments, and whether two records describe the same event. The example uses integer endpoints and integer intersections to keep attention on adjacency changes. The next chapter, “Keeping Geometric Decisions Exact,” considers more general coordinates and explains how to make these decisions reliably.

The two parts of Chapter 2 now form a complete chain: Part 1 explains the sweep and registration; Part 2 proves that order is fixed without events, crossing segments become neighbors, and new neighbors are checked, then rules out the earliest missed intersection and verifies the absence of false or duplicate reports. To reconnect proof and example, return to the event record table in Part 1.