Commit a39fbb4d authored by Cassio Kirch's avatar Cassio Kirch

Added new initial conditions: a circle with right radius.

parent be4b3e4e
......@@ -24,6 +24,18 @@ getBoxID (struct Boid boid)
return tmpBoxID;
}
void
initializeCircleCorrectly(struct Boid* const boid)
{
double angle, radius;
angle = RANDOM_0(PI*2.0);
radius = sqrt(RANDOM_0(1.0)) * \
sqrt(N * 0.137832224) * ELASTIC_DISTANCE;
/* R^2 = re^2 * N * sqrt(3) / (4 pi) */
boid -> position[X] = radius * cos(angle);
boid -> position[Y] = radius * sin(angle);
}
void
initializeCircle (struct Boid* const boid)
{
......@@ -46,7 +58,7 @@ initializeBoid (struct Boid* const boid)
{
static unsigned int boidCount = 0;
static unsigned int endoBoids = (unsigned)(ENDOPROP*N);
initializeCircle (boid);
initializeCircleCorrectly (boid);
boid -> velocity[X] = 0.0;
boid -> velocity[Y] = 0.0;
boid -> boxID = getBoxID (*boid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment