Any number of ways, certainly many if I spent any amount of time to think them up. Simplest?
1. Start with meshgrid, creating sets of indices into the final array.
2. Create a polygon, that denotes the corners of the triangle.
3. Use inpolygon to indicate which points lie inside the triangle.
4. Assign the array initially uing zeros.
5. Use logical indexing to overwrite the points inside the polygon as 1.
So simple and fast, fully vectorized. But many other ways too.