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 cam
I prefer to use 'sin' and 'cos' to make a circle. If you want some special shape like Oval. You can use the 'fac_specialX' and 'fac_specialY' make it different. If 'fac_specialX' and 'fac_specialY' not a fixed value(maybe be changed each time in loop), can make the shape more special.(or just try to modify a part of the circle array)
int r=10;// radius
int x0=25,y0=25; // center
int circle_points = 300; // accuracy --> higher cause better quality but slow
int circleX[circle_points]; // circle array
int circleY[circle_points]; // circle array
// #define PI 3.1415926
double fac_angle = ( 2*PI ) / circle_points;
// normal circle : fac_specialX & fac_specialY set 1
// Oval : fac_specialX --> higher cause longer in X
// fac_specialY --> higher cause longer in Y
double fac_specialX = 0.5;
double fac_specialY = 1.5;
// Calculate the coordinates
for(int i=0 ; i ->> sin cos
circleX[i] = x0 + r*sin( (i+1)*fac_angle )*fac_specialX;
circleY[i] = y0 + r*cos( (i+1)*fac_angle )*fac_specialY;
// set the ponts in M array
M[ circleY[i] ][ circleX[i] ] = 1;
}