Putting all the rules into one sweep
Why check a collinear group's neighbor again when that neighbor has not changed? Why collect participants on arrival when the position is already in the pending queue? Can a future collinear member provide coverage after the group disappears?
This is Chapter 8 of the segment-intersection series. The rules established separately now cooperate on one set of inputs, one active state, and one pending queue. We proceed from input preparation to an empty queue, following four actions at each event: read, report, update, and check. Chapter 9 connects the general correctness argument; Chapter 10 analyzes total work. This example replaces neither.
Section 1: Seven inputs, one shear coefficient
Names always denote original identities, regardless of active order. Every segment includes its endpoints; the two endpoints of coincide.
| Input | Original endpoints | Supporting line or position |
|---|---|---|
| Only the point |
We use the following established conclusions without proving them again:
| Prerequisite | Conclusion used here | New connection in this article |
|---|---|---|
| Chapter 1: results and identities | Retain a point or complete interval for each unordered input pair | Reconcile seven result records with two point positions |
| Chapter 2: the pending queue, Chapter 3: exact decisions | Retain real future positions; use exact values for ranges, positions, and order | Track the only newly discovered position from the initial endpoint queue |
| Chapter 4: same-point participants | Collect the old block on arrival, merge starters and point inputs, report before updating | Distinguish an event with three passing members from one with an ending member and a point input |
| Chapter 5: collinear groups | Report complete same-line intersections on insertion; recheck extended coverage and remove empty groups | Extension, a short member's departure, a gap, and reactivation occur in one sweep |
| Chapter 6: complete future order | Compare both coordinates for future positions; preserve state outside the current block | Apply this decision in the actual sweep coordinates |
| Chapter 7: uniform shear and restoration | Transform all inputs with one coefficient, then restore complete intersections | Connect the transformation to every endpoint, candidate, and result here |
Using the established safe coefficient choice, all endpoints here are integral, the common denominator is , and the largest absolute endpoint coordinate is . We refer to the common denominator in words only: the letter always denotes the input. Thus
Every input is transformed by . Throughout, denotes this exact fraction, never a decimal approximation. For example, the lower and upper endpoints of become and , so it is no longer vertical in the new coordinates.
Read the numbered panels as original coordinates followed by the exaggerated shear, even when they wrap. Each panel is displayed at its original 320 × 260 size, with equal horizontal and vertical units; marks the origin and ticks are one unit apart. is blue, orange, violet, green, red, cyan, and pink. Dashed distinguishes overlapping identities, not missing coverage. The diamond has no area and does not displace .
Only Figure 2 uses to exaggerate the shear; this is not the calculation coefficient. Later local geometry panels show original coordinates; order diagrams use discrete positions for the active order. All are teaching illustrations, not execution screenshots. Coordinate tables and decisions always use the actual . The originally same-column positions acquire horizontal coordinates , so they are no longer same-column events in sweep coordinates.
Section 2: Initialization knows positions, not reported results
Let denote the fixed collinear group containing . Its line is , but its member set changes. each occupy a separate group; their input names also label those order positions below. belongs to no nonzero group. means that the current members are ; it neither merges their identities nor assigns them an internal vertical order.
Name the original-coordinate candidates , , and . Their new coordinates are , , and . is only the candidate intersection of the horizontal line with the line supporting , not an event assumed to be real.
Substitute the inverse relation into the equation for : . Subtract from both sides to obtain . Since , division by is valid. The same substitution applies to . The sweep therefore uses these fixed lines and closed ranges:
| Group | Height | Ranges that current members may supply |
|---|---|---|
| , , ; only members that have started count | ||
The expression for follows from by subtracting and dividing by positive . Write for the rightmost covered endpoint of ; this is a different object from candidate point . While nonempty, the other groups have rightmost endpoints , respectively.
Initialization registers both endpoints of each nonzero input and the position of . Coincident positions merge while retaining every identity. Thus the end of and point input share ; the two identical endpoints of do not register it twice. There are 12 positions, with empty active order and results. has no input endpoint and is not registered yet; neither is .
For reference, call the positions eventually processed through ; Section 6 gives all coordinates. These labels do not mean that all thirteen positions are known at initialization: the initial queue contains through , then through . Each extraction still chooses the smallest unprocessed position in the new coordinates.
Section 3: Unchanged neighbors, extended coverage
At , starts. There are no old participants or pairs to report. Inserting leaves it alone, with no neighbor to check.
At , read starter . The height of is , so it does not pass through this point and there is no new result. Inserting gives bottom-to-top order , with .
The new neighbors have candidate : substituting into the line of gives , hence . This is future and covered by , but , so it cannot be scheduled. , which has not started, cannot supply current coverage.
At , is an old participant and starts. Following the same-line insertion rule, first report the complete interval — for , then add . remains below , but extends from to .
These panels isolate from the same example, without changing the inputs. Recheck the still-adjacent : and . Both groups currently cover and it is strictly future. Add to the queue. Reporting an interval on insertion and discovering a future point after updating coverage are separate actions.
At , ends while passes through. Retain 's eligibility at its closed endpoint, but do not report the already-reported interval again as a point. Then remove . remains, with . Rechecking neighbors yields the already registered , so retain its existing record. Coverage did not extend and there is no new discovery; this check cannot report again.
At , starts. Here has height : multiplying by positive reduces the comparison to , or . Its height is also positive because . There is no other participant; the new order is . The only new adjacency is . Their slopes both equal and their constant terms differ, so they are distinct parallel lines: no event is scheduled. still separates , which are not directly checked here.
Section 4: One discovered position, three passing participants
At , starts. has height ; has height ; is another above . There is no old same-point participant. Inserting gives . Its only new neighbor is ; the candidate is again . Both cover it and , but the queue already contains that position. Keep one record. Inserting between does not cancel their earlier discovery.
Extract . In the old order, all have height , forming the entire meeting block. , at height , is outside it. Expanding yields only current member , not departed or future . The participants are therefore , all passing through their interiors.
First report the three pairs , , and , each with complete intersection . Reporting only the earliest discovering pair would be insufficient. Do not report old same-line pair again: its earlier complete interval remains unchanged, neither split nor rewritten as a point.
Spacing in the order diagrams aids reading; it does not represent geometric heights. After reporting, all three groups continue. Use the established right-side slope ordering: has slope , has slope , and has slope . The full order becomes .
Internal neighbors and intersect at the current position, which fails the strict-future condition. There is no group below the block. The new upper boundary neighbors yield : on the original line of , the height of is , transforming to . It lies to the right of . covers that closed endpoint, and covers it too. The initial endpoint and point-input records already contain ; do not add another copy. Do not report these pairs before arrival.
Section 5: Report closed endpoints first; do not fill future gaps
At , read the end record for and point input , and find passing in the old meeting block. has height and has height ; neither participates in this height- event.
First report , , and , each with complete intersection . Then leaves and continues. participates only in these pairings: it gets neither a slope nor an active-order position. The remaining order is .
The new boundary neighbors have line candidate . It is future: implies . covers it, but currently contains only , with , so do not schedule it. The future endpoint of cannot replace the current coverage limit.
At , only ending participates, with no new result. Removing it empties , which leaves the order. The newly connected are parallel and yield no candidate. The next queue entry is : there is no stop at , which is neither an endpoint nor an intersection covered by both groups.
At , read starter . The heights of are and : both are below , with below . There is no new result. Reinserting gives . This is the same fixed-line group, but its only current member is and ; it was not active throughout the preceding gap.
Only new neighbors need checking. Their candidate is still , but , so it is not future; starts at and does not contain it either. The rightmost-endpoint criterion applies toward the future from a position currently covered by the group. The inequality alone cannot fill the past. separates , so that pair is not a new adjacency here.
Finally process the end of at , the end of at , and the end of at . Each event has only its ending participant and no new result. Each removes the bottommost group without connecting groups on both sides, so there are no new appointments. Both the queue and active order become empty.
Section 6: The complete event ledger
Every order, member set, coverage limit, and result count below is taken after all reporting, updating, and checking for that row. Orders run bottom to top. The coverage limits of are given in Section 2 and remain fixed while nonempty; the changing is listed here. Every candidate must satisfy both real coverage and complete-position strict futurity. Distinct positions happen to have distinct values in this example; this does not remove the vertical-coordinate comparison from the general rule.
| Event | Original → actual sweep position | Current participants; new results | Order afterward; | Neighbor checks and queue changes | Results / pending positions |
|---|---|---|---|---|---|
| Initial | No position extracted | None; none | Empty; none | Register twelve endpoint positions, excluding | |
| starts; no pair | ; none | No neighbor; extract | |||
| starts; no pair | ; | : exceeds coverage; extract | |||
| passes, starts; interval for | ; | Extension recheck of adds ; extract | |||
| ends, passes; no repeat of old same-line pair | ; | Rechecking retains existing ; extract | |||
| starts; no pair | ; | are parallel; extract | |||
| starts; no pair | ; | yield existing ; extract | |||
| pass; three point-result pairs | ; | and yield current position; yield existing ; extract | |||
| ends, passes, point ; three point-result pairs | ; | : exceeds coverage; extract | |||
| ends; no pair | ; none | After empty-group removal, are parallel; extract | |||
| starts; no pair | ; | : is past and outside ; extract | |||
| ends; no pair | ; | No new adjacency; extract | |||
| ends; no pair | ; | No new adjacency; extract | |||
| ends; no pair | Empty; none | No neighbor; extract , leaving an empty queue |
Reconstruct the queue row by row: start with twelve entries, remove the current one in each row, and add only at . Rediscovery never inserts a duplicate. In particular, after the remaining order is .
Exact values verify the event order. Since , we have and . The middle comparison follows from ; follows from . At the other end, follows respectively from , , and . Together with and , these establish the strict order of all thirteen entries.
Section 7: Restore and check seven complete pair intersections
The sweep results use new coordinates. Apply the established inverse transformation, . The interval endpoints have height zero, restoring horizontal coordinates and . restores to ; restores to . Restoring the whole interval relies on intersection preservation under shear, not on treating it as two point results.
| Original unordered input pair | Complete intersection in original coordinates | Reporting event |
|---|---|---|
| Closed interval from to | ||
| ; ; | Point for each pair | |
| ; ; | Point for each pair |
These are 7 input pairs: 1 interval pair and 6 point pairs, with only 2 distinct point positions. Independently check the set by applying Chapter 1's pairwise method to the other fourteen pairs, using Chapter 3's exact intersection conclusions:
| Unreported pairs | Specific reason for an empty intersection |
|---|---|
| ; | Disjoint collinear closed ranges: and |
| ; | Unique line candidate is beyond and before , respectively |
| ; | The unique candidate is again , outside their respective horizontal ranges |
| ; ; | Unique candidate is outside , , and |
| and are distinct parallel lines | |
| ; ; | has height , so is not on the horizontal line |
| At , the height of is , not the height of |
Seven nonempty pairs plus fourteen empty pairs account for all unordered pairs. This checks the complete result set for this example, not correctness of the general algorithm.
The continuous process connects three distinctions in one state: fixed collinear membership is not current coverage; discovering a position is not collecting all participants on arrival; and eligibility for reporting at an endpoint is not continued activity. The next chapter, Why the whole algorithm remains correct, follows initialization, preservation, and completion to connect the established local arguments into a general explanation of no missed, false, or repeated results for all allowed inputs.