Skip to main content

Event Spacing and the Shear Coefficient

Continuing from the previous article: after uniform scaling, all endpoints have integer coordinates with absolute values at most the integer MM, where M≥1M≥1. The positive denominators of endpoint and actual intersection coordinates in lowest terms are at most 8M28M^2. We now use this result to bound event spacing and choose the shear coefficient.

How far apart must different horizontal coordinates be?​

The event positions considered here include all input endpoints and all actual intersections of nonparallel segments that lie on both segments. The same point may correspond to several input pairs or several teaching stops. This proof concerns only the order of geometric positions; it does not merge their identities.

Write two different event horizontal coordinates in lowest terms as p/qp/q and r/tr/t, where q,tq,t are positive integers at most 8M28M^2. Subtract using a common denominator:

pq−rt=ptqt−rqqt=pt−rqqt.\frac pq-\frac rt =\frac{pt}{qt}-\frac{rq}{qt} =\frac{pt-rq}{qt}.

Here we multiply the first fraction's numerator and denominator by tt, and the second fraction's numerator and denominator by qq, giving the common positive denominator qtqt. Distance does not depend on the sign of the subtraction, so take the absolute value:

∣pq−rt∣=∣pt−rq∣qt.\left|\frac pq-\frac rt\right|=\frac{|pt-rq|}{qt}.

Because the horizontal coordinates differ, the numerator pt−rqpt-rq cannot be 00. It is a nonzero integer, whose absolute value is at least 11. With the denominator unchanged, replacing the numerator by 11 therefore gives a fraction no larger than the original distance:

∣pt−rq∣qt≥1qt.\frac{|pt-rq|}{qt}\ge\frac1{qt}.

Also, q≤8M2q\le8M^2 and t≤8M2t\le8M^2, and both numbers are positive. Multiplying gives

qt≤(8M2)(8M2)=64M4.qt\le(8M^2)(8M^2)=64M^4.

Taking reciprocals of positive numbers reverses their order. For example, 2<62<6, but 1/2>1/61/2>1/6. Thus 1/(qt)≥1/(64M4)1/(qt)\ge1/(64M^4). Combining the two steps gives

∣XP−XQ∣≥1qt≥1(8M2)2=164M4.|X_P-X_Q|\ge\frac1{qt}\ge\frac1{(8M^2)^2} =\frac1{64M^4}.

This is like a "minimum safe gap" between fractions: with an upper bound on their denominators, different fractions cannot be arbitrarily close.

Check with small fractions: the distance between 1/21/2 and 2/32/3 is ∣3−4∣/6=1/6|3-4|/6=1/6. Their denominators are both at most 33, so the same method bounds their distance below by 1/(3×3)=1/91/(3\times3)=1/9. The actual distance 1/61/6 is larger than 1/91/9, with no contradiction: a lower bound guarantees only that the distance is not smaller; it need not be attained. Likewise, 1/(64M4)1/(64M^4) need not be the actual smallest gap in the current figure.

On the other hand, a point on a segment cannot be higher than its higher endpoint or lower than its lower endpoint. Input endpoints and actual segment intersections therefore all have heights between −M-M and MM. The largest height difference occurs when one event is at the top and the other at the bottom, and is only M−(−M)=2MM-(-M)=2M. Thus

∣YP−YQ∣≤2M.|Y_P-Y_Q|\le2M.

Notice that an intersection of supporting lines may lie far outside the segments. The denominator bound still applies to it, but this height-difference bound applies only to endpoints and actual segment intersections, not to arbitrary intersections of extended lines.

Where the fifth power and the constant 256 come from​

Compare the original gap with the change caused by shear​

Suppose event PP is originally to the left of event QQ, so XP<XQX_P<X_Q. We care about "the right horizontal coordinate minus the left horizontal coordinate": as long as this difference stays positive, QQ remains to the right of PP.

After shearing, their horizontal coordinates are XP′=XP+sYPX'_P=X_P+sY_P and XQ′=XQ+sYQX'_Q=X_Q+sY_Q. Subtract and remove parentheses:

XQ′−XP′=(XQ+sYQ)−(XP+sYP)=XQ+sYQ−XP−sYP=(XQ−XP)+s(YQ−YP).\begin{aligned} X'_Q-X'_P &=(X_Q+sY_Q)-(X_P+sY_P)\\ &=X_Q+sY_Q-X_P-sY_P\\ &=\teachBlue{(X_Q-X_P)}+\teachOrange{s(Y_Q-Y_P)}. \end{aligned}

The first term, XQ−XP\teachBlue{X_Q-X_P}, is the original positive gap, at least 1/(64M4)1/(64M^4). The second term, s(YQ−YP)\teachOrange{s(Y_Q-Y_P)}, is the change in that gap. We choose s>0s>0, so:

  • If YQ>YPY_Q>Y_P, the right-hand point moves farther right, increasing the gap.
  • If YQ=YPY_Q=Y_P, both points move by the same amount, leaving the gap unchanged.
  • If YQ<YPY_Q<Y_P, the gap decreases by s∣YQ−YP∣s|Y_Q-Y_P|, which is at most 2Ms2Ms.

We therefore need to guard only against the third case. If two objects start at least 1010 meters apart and the gap decreases by less than 1010 meters, they still have not met. In the same way, here we need

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

Since M≥1M\ge1, we have 2M>02M>0. Dividing both sides by the positive number 2M2M leaves the inequality direction unchanged:

s<164M4÷(2M)=164M4×12M=1128M5.s<\frac1{64M^4}\div(2M) =\frac1{64M^4}\times\frac1{2M} =\frac1{128M^5}.

The last step uses 64×2=12864\times2=128 and M4×M=M5M^4\times M=M^5. The fifth power comes from the fourth power in horizontal spacing multiplied by the first power in the height difference.

The inequality must be strict. If the reduction equaled the original gap, the new horizontal coordinate difference would be 00, and strict left-to-right order would no longer be guaranteed.

Check that the chosen coefficient meets the requirement​

Rather than seek the largest usable coefficient, we choose the more conservative, uniform value

s=1256(M+1)5.s=\frac1{256(M+1)^5}.

Since M+1>M>0M+1>M>0, multiplying five copies of M+1M+1 gives a larger result than multiplying five copies of MM, so (M+1)5>M5(M+1)^5>M^5. Hence

256(M+1)5>256M5>128M5.256(M+1)^5>256M^5>128M^5.

For positive fractions with numerator 11, a larger denominator means a smaller fraction. Therefore

0<s=1256(M+1)5<1128M5.0<s=\frac1{256(M+1)^5}<\frac1{128M^5}.

Now multiply both sides of the right-hand inequality by the positive number 2M2M to check the maximum reduction:

2Ms<2M128M5=164M4.2Ms<\frac{2M}{128M^5} =\frac1{64M^4}.

The last step divides both numerator and denominator by 2M2M. This is exactly the required condition that the reduction be smaller than the minimum safe gap.

Both 256=2×128256=2\times128 and replacing MM by M+1M+1 enlarge the denominator and decrease the coefficient, leaving extra room. This choice certainly meets the condition, but it is neither the only correct coefficient nor the largest possible one.

Substitute the result into the horizontal coordinate difference​

Any real number is at least the negative of its absolute value; for example, 3≥−33\ge-3 and −3=−∣−3∣-3=-|-3|. Thus the change s(YQ−YP)s(Y_Q-Y_P) is at least −s∣YQ−YP∣-s|Y_Q-Y_P|, and the height difference is at most 2M2M. Substituting step by step gives

XQ′−XP′=(XQ−XP)+s(YQ−YP)≥(XQ−XP)−s∣YQ−YP∣≥164M4−2Ms>0.\begin{aligned} X'_Q-X'_P &=(X_Q-X_P)+s(Y_Q-Y_P)\\ &\ge(X_Q-X_P)-s|Y_Q-Y_P|\\ &\ge\frac1{64M^4}-2Ms\\ &>0. \end{aligned}

The last step holds because we have just proved 2Ms<1/(64M4)2Ms<1/(64M^4): subtracting a smaller number from a larger one gives a positive result. Therefore XQ′>XP′X'_Q>X'_P, and the event originally on the left remains on the left.

Example: the largest absolute coordinate is 3​

Suppose the input endpoints have integer coordinates whose largest absolute value is 33. Take D=1D=1, so M=3M=3:

s=1256(3+1)5=1256⋅45=1256⋅1024=1262144.s=\frac1{256(3+1)^5} =\frac1{256\cdot4^5} =\frac1{256\cdot1024} =\boxed{\frac1{262144}}.

For example, the endpoints (0,−3)(0,-3) and (0,3)(0,3) of a vertical segment become

(−3262144,−3),(3262144,3).\left(-\frac3{262144},-3\right),\qquad \left(\frac3{262144},3\right).

Their horizontal coordinates now differ, so the segment is no longer vertical, but the transformation has lost no information.

Finally, calculate the distance bounds as well. Since 2M=62M=6, the absolute value of the change in the horizontal coordinate difference of any two events is at most

2Ms=6×1262144=6262144.2Ms=6\times\frac1{262144}=\frac6{262144}.

For events whose original horizontal coordinates differ, the lower bound on their safe gap is

164M4=164×34=164×81=15184.\frac1{64M^4}=\frac1{64\times3^4} =\frac1{64\times81}=\frac1{5184}.

To verify 6/262144<1/51846/262144<1/5184, multiply both sides by the positive number 262144×5184262144\times5184. After canceling the denominators, only an integer comparison remains:

6×5184=31104<262144.6\times5184=31104<262144.

The maximum reduction is therefore smaller than the guaranteed minimum gap, without relying on decimal approximations. This estimate concerns any two events. The endpoints of the vertical segment above originally had equal horizontal coordinates; their separation follows directly from s>0s>0 and their different heights.