Draw rectangles, circles or arbitrary polygons in a m x n matrix
I want to simulate the flow around objects in two dimensions. Therefore I wrote a program in C which uses the Navier-Stokes equations to describe the motion of fluids. Now I came to the point where I actually want more than just placing a rectangle in the simulation domain. To draw such a rectangle I just do something like: for(int i=start_x; i<end_x; i++) for(int j=start_y; j<end_y; j++) M[i][j] = 1; // barrier cell = 1 Doing this I get a nice rectangle. No surprise. But what would be an approach if I want to simulate the flow around a circle, a cross, a triangle, a wing profile or any other