I'm working with discret numbers (integers) and I'm looking for 4 sets of formulas to determine within which of these 4 triangles an $(x;y)$ point is, with $x \in [0;36[$ and $y \in [0;36[$.

Easier to understand with this

  • 1
    $\begingroup$ What have you done so far? $\endgroup$
    – saulspatz
    Oct 20 '19 at 0:18
  • $\begingroup$ So far I found (for the grid starting in the bottom left corner) x < 18 && y < 18 && x > y but it's only for the left part of the yellow triangle.. $\endgroup$ Oct 20 '19 at 0:29
  • $\begingroup$ Okay I found my out I'll post when I finish it $\endgroup$ Oct 20 '19 at 0:43
  • $\begingroup$ How do you deal with the points on the boundaries? Like $(1,0)$ or $(1,1)$. To which triangle do they belong? $\endgroup$
    – Andrei
    Oct 20 '19 at 1:13

$$(x,y) \in {\rm red\ if}\ |y-x|> -1 \wedge |y+x| < 36$$

Can you continue?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.