Skip to main content

Equal Horizontal Coordinates, Degenerate Inputs, and Original Coordinates

The previous article proved that the positive coefficient s=1/[256(M+1)5]s=1/[256(M+1)^5] preserves the left-to-right order of events with different original horizontal coordinates. This article handles special cases such as equal horizontal coordinates, then transfers the result from scaled coordinates back to the originals. We still write X=DxX=Dx and Y=DyY=Dy, where DD is a positive integer common denominator and MM is the maximum of 11 and the absolute values of all scaled endpoint coordinates.

Equal horizontal coordinates, vertical segments, and degenerate inputs​

If two events originally satisfy XP=XQX_P=X_Q, after shearing we have

XQ′−XP′=s(YQ−YP).\teachViolet{X'_Q}-\teachViolet{X'_P}=s(Y_Q-Y_P).

For example, if PP is lower and QQ is higher, then YQ−YP>0Y_Q-Y_P>0. Multiplying by the positive number ss keeps it positive, so XQ′−XP′>0X'_Q-X'_P>0: the lower event is on the left and the higher event on the right. This preserves the event order of "compare horizontal coordinates first, then vertical coordinates": different original horizontal coordinates are ordered left to right, and equal original horizontal coordinates are ordered bottom to top.

If two positions coincide exactly, both their horizontal and vertical coordinate differences are 00, and the differences after shearing are still 00. Coincident positions therefore remain coincident; segments participating at the same point must not be split into different event positions.

A nonzero segment has distinct endpoints. If their horizontal coordinates differ, the order-preservation proof above guarantees that they still differ after shearing. If their horizontal coordinates agree, their vertical coordinates must differ, and a positive shear coefficient makes their horizontal coordinates differ as well. Thus nonzero vertical segments are eliminated, while other nonzero segments do not become vertical.

The formula above for a unique intersection cannot be applied directly to every input:

  • Parallel but not collinear: there is no intersection. Here Δ=0\Delta=0, so the formula cannot be used because division by 00 is not allowed.
  • Collinear: the segments may be disjoint, touch at one point, or overlap over a complete interval. The two boundaries of an overlap interval come from input endpoints and are already included among the event positions; the infinitely many points inside the interval need not all become events. If a third, nonparallel segment crosses the overlap interval, the crossing position is still covered by the bound for actual intersections.
  • Zero-length point inputs: these have no unique supporting line, and their position is included as an endpoint. After shearing they are still points, and must not be treated as nonzero segments with slopes.

The current implementation chooses the positive coefficient proved here only when a nonzero vertical segment exists. Otherwise it uses s=0s=0 and performs no shear. Thus "distinct positions with the same horizontal coordinate are separated" describes the positive-coefficient branch, not a change that happens in every calculation.

Returning to original coordinates without adjusting the coefficient​

Scaling and shearing can be performed in either order:

D(x+sy)=Dx+sDy=X+sY.D(x+sy)=Dx+sDy=X+sY.

The left side means "shear first, then scale by DD"; the right side means "scale first, then shear." The equality is just the distributive law. Both procedures therefore give the same coordinates, so original and scaled coordinates use the same ss: there is no need to multiply or divide it by DD again.

We can also check the distances in the original coordinates directly. Since XQ−XP=D(xQ−xP)X_Q-X_P=D(x_Q-x_P), dividing the scaled horizontal gap by DD gives the original horizontal gap; the height difference has the same relationship. In the original coordinates the horizontal gap is therefore at least 1/(64DM4)1/(64DM^4), and the height difference is at most 2M/D2M/D. To preserve left-to-right order, it is enough that

s2MD<164DM4.s\frac{2M}{D}<\frac1{64DM^4}.

Multiplying both sides by the positive number DD leaves the inequality direction unchanged. Canceling DD gives

2Ms<164M4.2Ms<\frac1{64M^4}.

This is exactly the condition we have already proved.