Commit 37bc5588 authored by Cassio Kirch's avatar Cassio Kirch

BSD indentation with two spaces.

parent d73a8fa2
......@@ -11,11 +11,11 @@ initializeBoxes (struct Box* const box) /* The input is an array. */
{
unsigned int boxCount;
for (boxCount=0; boxCount<BOXES; ++boxCount)
{
box[boxCount].boxID = boxCount;
box[boxCount].first = NULL;
box[boxCount].last = NULL;
}
{
box[boxCount].boxID = boxCount;
box[boxCount].first = NULL;
box[boxCount].last = NULL;
}
}
bool
......@@ -43,11 +43,11 @@ appendBoid (struct Boid* const boid, struct Box* const box)
if (conductor == NULL)
box[boid -> boxID].first = boid;
else
{
while (conductor -> next != 0)
conductor = conductor -> next;
conductor -> next = boid;
}
{
while (conductor -> next != 0)
conductor = conductor -> next;
conductor -> next = boid;
}
boid -> previous = conductor;
boid -> next = NULL;
box[boid -> boxID].last = boid;
......
......@@ -17,92 +17,92 @@ getDistance (const struct Boid* const boid2, const struct Boid* const boid1)
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
distance.sine = (boid2 -> position[Y] - boid1 -> position[Y]) / \
distance.module;
distance.cosine = (boid2 -> position[X] - boid1 -> position[X]) / \
distance.module;
return distance;
}
else if ((isInEdge (boid1 -> boxID) == true) || \
(isInEdge (boid2 -> boxID) == true))
{
/* 1o boid à esquerda. */
temp = boid1 -> position[X] + RANGE;
distance.module = absDistance (temp, \
boid1 -> position[Y], \
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
distance.sine = (boid2 -> position[Y] - boid1 -> position[Y]) / \
distance.module;
distance.cosine = (boid2 -> position[X] - temp) / distance.module;
return distance;
}
/* 1o boid à direita */
temp = boid1 -> position[X] - RANGE;
distance.module = absDistance (temp, \
boid1 -> position[Y], \
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
distance.sine = (boid2 -> position[Y] - boid1 -> position[Y]) / \
distance.module;
distance.cosine = (boid2 -> position[X] - temp) / distance.module;
return distance;
}
/* 1o boid abaixo */
temp = boid1 -> position[Y] + RANGE;
distance.module = absDistance (boid1 -> position[X], \
temp, \
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
distance.sine = (boid2 -> position[Y] - temp) / distance.module;
distance.cosine = (boid2 -> position[X] - boid1 -> position[X]) / \
distance.module;
return distance;
}
else if ((isInEdge (boid1 -> boxID) == true) || \
(isInEdge (boid2 -> boxID) == true))
/* 1o boid acima */
temp = boid1 -> position[Y] - RANGE;
distance.module = absDistance (boid1 -> position[X], \
temp, \
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
/* 1o boid à esquerda. */
temp = boid1 -> position[X] + RANGE;
distance.module = absDistance (temp, \
boid1 -> position[Y], \
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
distance.sine = (boid2 -> position[Y] - boid1 -> position[Y]) / \
distance.module;
distance.cosine = (boid2 -> position[X] - temp) / distance.module;
return distance;
}
/* 1o boid à direita */
temp = boid1 -> position[X] - RANGE;
distance.module = absDistance (temp, \
boid1 -> position[Y], \
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
distance.sine = (boid2 -> position[Y] - boid1 -> position[Y]) / \
distance.module;
distance.cosine = (boid2 -> position[X] - temp) / distance.module;
return distance;
}
/* 1o boid abaixo */
temp = boid1 -> position[Y] + RANGE;
distance.module = absDistance (boid1 -> position[X], \
temp, \
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
distance.sine = (boid2 -> position[Y] - temp) / distance.module;
distance.cosine = (boid2 -> position[X] - boid1 -> position[X]) / \
distance.module;
return distance;
}
/* 1o boid acima */
temp = boid1 -> position[Y] - RANGE;
distance.module = absDistance (boid1 -> position[X], \
temp, \
boid2 -> position[X], \
boid2 -> position[Y]);
if (distance.module < NEIGHBOR_DISTANCE)
{
distance.sine = (boid2 -> position[Y] - temp) / distance.module;
distance.cosine = (boid2 -> position[X] - boid1 -> position[X]) / \
distance.module;
return distance;
}
/* não vizinhos */
else
{
distance.sine = 0.0;
distance.cosine = 0.0;
distance.module = NEIGHBOR_DISTANCE * 2.0;
return distance;
}
distance.sine = (boid2 -> position[Y] - temp) / distance.module;
distance.cosine = (boid2 -> position[X] - boid1 -> position[X]) / \
distance.module;
return distance;
}
/* não vizinhos */
else
/* não vizinhos */
else
{
distance.sine = 0.0;
distance.cosine = 0.0;
distance.module = NEIGHBOR_DISTANCE * 2.0;
return distance;
}
}
/* não vizinhos */
else
{
distance.sine = 0.0;
distance.cosine = 0.0;
distance.module = NEIGHBOR_DISTANCE * 2.0;
return distance;
}
}
/* Supõe-se que a função só será chamada para boids vizinhos. */
......
......@@ -74,6 +74,7 @@ makeSum (struct Boid* const boid, const struct Boid* conductor, \
else /* Assume endo. */
boid -> endoNeighbors++;
#endif
}
}
conductor = conductor -> next;
......
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