0

enter image description here

Basically I need to find out what are the tiles affected by the area projected by the 2 lines, is there maybe a function or something like that to get that information?.

Artemix
  • 203
  • 4
    While your picture is evocative, let me suggest that you write a precise mathematical desciption. What are the tiles affected by the area projected by the 2 lines is not sufficiently precise. You should be able to easily make it precise by using coordinates, and equations for the lines, and mathematical conditions on the rectangles in question. – Lee Mosher Feb 05 '24 at 15:33
  • You might also want to read the portion of our formatting and writing guidelines, under the heading Make your question visible, searchable, accessible. – Lee Mosher Feb 05 '24 at 15:34
  • And you might also profit from reading the meta post Why image cannot be used for explaining my maths problem?. – Lee Mosher Feb 05 '24 at 15:37
  • I honestly dont think there is anything else that is needed to be added in order to properly convey what Im looking for, the squares can just be defined as a NxN square in a X,Y arbitrary location. – Artemix Feb 05 '24 at 15:39
  • Let me again suggest you read carefully that post for why images cannot be used. Meanwhile, I'll vote to close. – Lee Mosher Feb 05 '24 at 15:42
  • Do you know the exact equations of the two lines? At first glance, it looks like $y = 2x - 1$ and $y = \frac{3}{2}x - 3$ (with the origin at the lower left corner), but on closer inspection, the slope of the left line is not exactly 2. – Dan Feb 05 '24 at 16:41

1 Answers1

3

Given two lines defined by the equations $y = a_1 x + b_1$ and $y = a_2 x + b_2$, you seem to want the squares with vertices $(X,Y)$, $(X+1,Y)$, $(X+1,Y+1)$ and $(X,Y+1)$, $X$ and $Y$ integers, such that at least one vertex is (strictly) below the first line and at least one is (strictly) above the second. Thus $$ \eqalign{\min(Y - a_1 X - b_1, Y - a_1 (X+1) - b_1) &< 0 \cr \max(Y+1 - a_2 X - b_2, Y+1 - a_2 (X+1) - b_2) &> 0 \cr} $$ If $a_1 > 0$ and $a_2 > 0$, that's $$ \eqalign{ Y - a_1 X &< a_1 + b_1\cr Y - a_2 X &> b_2 - 1\cr} $$

Robert Israel
  • 448,999