How to compute minimum distance of parallel lines to contain a unit square in a grid at any offset?

78 Views Asked by At

Given two parallel lines placed on graph paper whose angle relative to vertical is θ, where θ is less than or equal to 45°, what is the minimum distance between the two lines to guarantee that there is at least one grid of the graph paper that neither line intersects for every row of the graph paper.

For example, in the following diagram, the red lines are at θ of about 37.79° from vertical and every row has at least one full grid box between the red lines and their distance is about sqrt(5) apart.

enter image description here

I imagined a requirement of the solution being for two stacked boxes, forming a rectangle of height two and width one, that has its upper left corner abut the top line and lower right corner abut the bottom line, the diagonal of the rectangle, having a length of sqrt(5) and the angle of the diagonal would be asin(1/sqrt(5)). Doing geometry, I computed that the distance between the parallel lines would be sqrt(5) * cos( θ - asin(1/sqrt(5))), which for 37.79° suggests a required distance of 2.193... When θ is 0, this solves to 2.0 which is correct for at least that case as for any placement on the graph paper of vertical lines with distance apart of 2, there will always be at least one grid wholly within the two lines.

While this does at least seems in the ballpark of the answer, I believe this is incorrect because the maximum of the equation I gave is when the angle passed to cos is zero, and thus θ is asin(1/sqrt(5) or 26.565...° whereas I would expect the maximum to be at 45° and the function decreasing continuously as θ goes to 0°.

Here is a picture to help solve:

enter image description here

Goal is to compute distance j as a function of θ. Image shows case for 45°.

1

There are 1 best solutions below

0
On BEST ANSWER

I think your formula is correct.

You required there to be one complete grid square between the lines on each row of the grid. You put no such requirement on the columns. Therefore your constraints are not symmetric in the two coordinates, and there is no reason to think the maximum would occur for slope $1.$

If you also required there to be one whole grid square between the lines in each column, your formula would be valid for slopes greater than $1$ whereas you would need a different formula for slopes between zero and $1.$ And then the maximum would occur at slope $1.$