You can generate your picture using: $$\frac{x}{T} - \left\lfloor\frac{x}{T}\right\rfloor < \frac{\tau}{T}$$ where $<$ is a two-argument function that gives $1$ when true and $0$ when false, as is common in programming languages like C. The left hand side is the phase in $[0..1)$.
(Note when implementing on a computer it's best to accumulate the phase with wrapping, to avoid floating point precision issues that will be noticeable after a few minutes with 32bit float.)