Cleanup: use braces for sources in intern/
Omitted intern/itasc as some of these sources are from KDL: https://www.orocos.org/kdl.html
This commit is contained in:
@@ -113,8 +113,9 @@ static void create_projection_axes(int64_t axes[NUM_AXES][3], const int64_t tri[
|
||||
/* Get triangle edge vectors */
|
||||
int64_t tri_edges[3][3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++)
|
||||
for (int j = 0; j < 3; j++) {
|
||||
tri_edges[i][j] = tri[(i + 1) % 3][j] - tri[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
/* Triangle normal */
|
||||
@@ -171,8 +172,9 @@ CubeTriangleIsect::CubeTriangleIsect(int64_t cube[2][3],
|
||||
cube_proj.origin = dotProduct(axes[axis], cube[0]);
|
||||
|
||||
/* 3 direction vectors */
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < 3; i++) {
|
||||
cube_proj.edges[i] = dotProduct(axes[axis], cubeedge[i]);
|
||||
}
|
||||
|
||||
/* Offsets of 2 ends of cube projection */
|
||||
int64_t max = 0;
|
||||
@@ -201,11 +203,13 @@ CubeTriangleIsect::CubeTriangleIsect(int64_t cube[2][3],
|
||||
inherit->tri_proj[axis][0] = vts[0];
|
||||
inherit->tri_proj[axis][1] = vts[0];
|
||||
for (i = 1; i < 3; i++) {
|
||||
if (vts[i] < inherit->tri_proj[axis][0])
|
||||
if (vts[i] < inherit->tri_proj[axis][0]) {
|
||||
inherit->tri_proj[axis][0] = vts[i];
|
||||
}
|
||||
|
||||
if (vts[i] > inherit->tri_proj[axis][1])
|
||||
if (vts[i] > inherit->tri_proj[axis][1]) {
|
||||
inherit->tri_proj[axis][1] = vts[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,8 +227,9 @@ CubeTriangleIsect::CubeTriangleIsect(CubeTriangleIsect *parent)
|
||||
for (int i = 0; i < NUM_AXES; i++) {
|
||||
cubeProj[i].origin = parent->cubeProj[i].origin;
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
for (int j = 0; j < 3; j++) {
|
||||
cubeProj[i].edges[j] = parent->cubeProj[i].edges[j] >> 1;
|
||||
}
|
||||
|
||||
cubeProj[i].min = parent->cubeProj[i].min >> 1;
|
||||
cubeProj[i].max = parent->cubeProj[i].max >> 1;
|
||||
@@ -337,13 +342,15 @@ float CubeTriangleIsect::getIntersectionPrimary(int edgeInd) const
|
||||
int64_t d = proj1 - proj0;
|
||||
double alpha;
|
||||
|
||||
if (d == 0)
|
||||
if (d == 0) {
|
||||
alpha = 0.5;
|
||||
}
|
||||
else {
|
||||
alpha = (double)((proj2 - proj0)) / (double)d;
|
||||
|
||||
if (alpha < 0 || alpha > 1)
|
||||
if (alpha < 0 || alpha > 1) {
|
||||
alpha = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
return (float)alpha;
|
||||
|
||||
@@ -54,8 +54,9 @@ class DualConInputReader : public ModelReader {
|
||||
/* initialize maxsize */
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float d = max[i] - min[i];
|
||||
if (d > maxsize)
|
||||
if (d > maxsize) {
|
||||
maxsize = d;
|
||||
}
|
||||
}
|
||||
|
||||
/* redo the bounds */
|
||||
@@ -64,15 +65,17 @@ class DualConInputReader : public ModelReader {
|
||||
max[i] = (max[i] + min[i]) / 2 + maxsize / 2;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
min[i] -= maxsize * (1 / scale - 1) / 2;
|
||||
}
|
||||
maxsize *= 1 / scale;
|
||||
}
|
||||
|
||||
Triangle *getNextTriangle()
|
||||
{
|
||||
if (curtri == input_mesh->tottri)
|
||||
if (curtri == input_mesh->tottri) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Triangle *t = new Triangle();
|
||||
|
||||
@@ -97,8 +100,9 @@ class DualConInputReader : public ModelReader {
|
||||
|
||||
int getNextTriangle(int t[3])
|
||||
{
|
||||
if (curtri == input_mesh->tottri)
|
||||
if (curtri == input_mesh->tottri) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int *tr = GET_TRI(input_mesh, curtri);
|
||||
t[0] = tr[0];
|
||||
|
||||
@@ -325,16 +325,18 @@ void Octree::addTriangle(Triangle *trian, int triind)
|
||||
|
||||
/* Project the triangle's coordinates into the grid */
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++)
|
||||
for (j = 0; j < 3; j++) {
|
||||
trian->vt[i][j] = dimen * (trian->vt[i][j] - origin[j]) / range;
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate projections */
|
||||
int64_t cube[2][3] = {{0, 0, 0}, {dimen, dimen, dimen}};
|
||||
int64_t trig[3][3];
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++)
|
||||
for (j = 0; j < 3; j++) {
|
||||
trig[i][j] = (int64_t)(trian->vt[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add triangle to the octree */
|
||||
@@ -379,22 +381,27 @@ InternalNode *Octree::addTriangle(InternalNode *node, CubeTriangleIsect *p, int
|
||||
/* Pruning using intersection test */
|
||||
if (subp->isIntersecting()) {
|
||||
if (!node->has_child(i)) {
|
||||
if (height == 1)
|
||||
if (height == 1) {
|
||||
node = addLeafChild(node, i, count, createLeaf(0));
|
||||
else
|
||||
}
|
||||
else {
|
||||
node = addInternalChild(node, i, count, createInternal(0));
|
||||
}
|
||||
}
|
||||
Node *chd = node->get_child(count);
|
||||
|
||||
if (node->is_child_leaf(i))
|
||||
if (node->is_child_leaf(i)) {
|
||||
node->set_child(count, (Node *)updateCell(&chd->leaf, subp));
|
||||
else
|
||||
}
|
||||
else {
|
||||
node->set_child(count, (Node *)addTriangle(&chd->internal, subp, height - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (node->has_child(i))
|
||||
if (node->has_child(i)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
delete subp;
|
||||
@@ -445,10 +452,12 @@ void Octree::preparePrimalEdgesMask(InternalNode *node)
|
||||
int count = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (node->has_child(i)) {
|
||||
if (node->is_child_leaf(i))
|
||||
if (node->is_child_leaf(i)) {
|
||||
createPrimalEdgesMask(&node->get_child(count)->leaf);
|
||||
else
|
||||
}
|
||||
else {
|
||||
preparePrimalEdgesMask(&node->get_child(count)->internal);
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
@@ -2016,8 +2025,9 @@ int Octree::floodFill(LeafNode *leaf, int st[3], int len, int /*height*/, int th
|
||||
|
||||
// cells
|
||||
LeafNode *cs[2];
|
||||
for (j = 0; j < 2; j++)
|
||||
for (j = 0; j < 2; j++) {
|
||||
cs[j] = locateLeaf(cst[j]);
|
||||
}
|
||||
|
||||
// Middle sign
|
||||
int s = getSign(cs[0], 0);
|
||||
@@ -2195,8 +2205,9 @@ static void solve_least_squares(const float halfA[],
|
||||
b2 = b2 + A * -mp;
|
||||
result = pinv * b2 + mp;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
rvalue[i] = result(i);
|
||||
}
|
||||
}
|
||||
|
||||
static void mass_point(float mp[3], const float pts[12][3], const int parity[12])
|
||||
|
||||
Reference in New Issue
Block a user