Definition · Collinear segments, and the projection coordinateTwo segments are collinear when all four endpoints lie on one line, which makes all four orientation determinants zero. For collinear segments with r = p₂ − p₁ nonzero, define the projection coordinate of a point x as (x − p₁)·r. In this coordinate p₁ is at 0 and p₂ is at r·r, and both are integers whenever the endpoints are.
Theorem · No function of the four signs is the intersection testThere exist two pairs of segments whose four orientation signs are equal, one of which meets and one of which does not. Consequently any intersection test computed from the four signs alone is wrong on at least one of them.
Take p₁p₂ = (0, 0)–(6, 0) with q₁q₂ = (4, 0)–(10, 0), and p₁p₂ = (0, 0)–(4, 0) with q₁q₂ = (6, 0)–(10, 0). In both, all four points lie on the line y = 0, so all four determinants are zero and the sign vectors are both (0, 0, 0, 0).
The first pair shares every point with 4 ≤ x ≤ 6, so it meets. The second pair has the first segment ending at x = 4 and the second starting at x = 6, so no point is on both and it does not meet. A function of the sign vector returns one value on that vector, and it cannot be both true and false.
□
That argument is short and it is worth stating as a theorem rather than as a remark, because the usual reaction to the collinear case is to look for a cleverer combination of the signs. There is none, and the reason is structural: the signs are a function of which side of each line each point is on, and when everything is on the line, every input with that property has the same signature.
Example · The two inputs, side by sideSelect the overlapping collinear worked example and read the KPI row: proper crossing no, touching yes, bounding boxes overlap yes, verdict they meet. Select the one with the gap: proper crossing no, touching no, bounding boxes overlap NO, verdict they miss. The four-sign table above is byte-for-byte identical between the two runs, and every other row on the page changes.
One label to distrust while you are there. The worked example with the gap is offered as “collinear, boxes touching, no overlap”, and the boxes are not touching: they are the intervals from 0 to 4 and from 6 to 10, with two units between them, and the widget's own bounding-box row reports NO on that input. Read the row, not the label. While you are checking: none of the seven worked examples has overlapping boxes AND segments that miss, so the one case that shows the filter failing to decide has to be typed. 0, 0; 4, 4; 2, 0; 4, 1 does it — boxes overlapping, no crossing, and the status line then says the boxes are a filter and never an answer.
The bounding boxes DO separate these two, and it is worth working out why, because the answer is more interesting than a coincidence. Along a line, both coordinates are monotone in the parameter: if the direction has rx ≠ 0 then x increases or decreases steadily, and if rx = 0 the segment is vertical and y does. So for COLLINEAR segments, overlapping boxes and overlapping intervals along the line are the same condition, and the box test is not a filter at all here — it is exact. Running 197,506 random collinear pairs past both tests produces not one disagreement.
That does not make the box test the answer, for two reasons. It stops being exact the moment the segments are not collinear, which is the whole of the rest of the problem and where 0, 0; 4, 4; 2, 0; 4, 1 lives. And it says nothing about the degenerate case below, where one segment is a point. The projection coordinate is the form worth learning because it is the same computation in both, and because it states the question in the coordinate the answer actually lives in rather than in two coordinates that happen to agree with it.
Degenerate segments reach the same branch
A segment whose two endpoints coincide is a point. The lab has one: the point (3, 2) against the segment from (0, 0) to (6, 4), which passes through it. All four determinants are zero again, proper is false, and the right answer is yes. The parametric route handles this by noticing that r·r = 0 and falling back to asking whether the point lies on the other segment; a route that divided by r·r would have failed here instead.
That is the third distinct family that produces four zeros: collinear and overlapping, collinear and disjoint, and degenerate. A fourth is nearly there — a shared endpoint gives two zeros rather than four. The lab's preset list walks all of them deliberately, and four of its seven entries are inputs the proper test alone gets wrong.
How the interval test is kept exact
The projection coordinates t₀ and t₁ are dot products of integer vectors, so they are integers, and the first segment occupies [0, r·r] which is also an integer interval. The test is then max(t₀, t₁) ≥ 0 and min(t₀, t₁) ≤ r·r, two integer comparisons. No normalisation, no direction vector of unit length, no division.
It is worth appreciating how little this costs. The entire collinear branch is a handful of multiplications and two comparisons, and it converts a test that is right on general position into one that is right on everything. The usual reason it is missing from an implementation is not cost; it is that the author never constructed an input that reaches it.