# Formulas to diagonally divide a square in four triangles

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[$$.

• What have you done so far? Oct 20 '19 at 0:18
• 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.. Oct 20 '19 at 0:29
• Okay I found my out I'll post when I finish it Oct 20 '19 at 0:43
• How do you deal with the points on the boundaries? Like $(1,0)$ or $(1,1)$. To which triangle do they belong? Oct 20 '19 at 1:13

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