From d8dbd49a2f23b7637f05fc058f39bdf6ab706624 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 31 May 2019 22:51:19 +1000 Subject: Cleanup: style, use braces in source/ Automated using clang-tidy. --- .../freestyle/intern/winged_edge/Curvature.cpp | 51 ++++++++++++++-------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'source/blender/freestyle/intern/winged_edge/Curvature.cpp') diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp index 4fb92e35b40..4f2f2dae9af 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp +++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp @@ -62,8 +62,9 @@ static bool angle_obtuse(WVertex *v, WFace *f) static bool triangle_obtuse(WVertex *, WFace *f) { bool b = false; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { b = b || ((f->getEdgeList()[i]->GetVec() * f->getEdgeList()[(i + 1) % 3]->GetVec()) < 0); + } return b; } @@ -80,8 +81,9 @@ static real cotan(WVertex *vo, WVertex *v1, WVertex *v2) /* denom can be zero if u==v. Returning 0 is acceptable, based on the callers of this function * below. */ - if (denom == 0.0) + if (denom == 0.0) { return 0.0; + } return (udotv / denom); } @@ -127,17 +129,20 @@ bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh) { real area = 0.0; - if (!v) + if (!v) { return false; + } /* this operator is not defined for boundary edges */ - if (v->isBoundary()) + if (v->isBoundary()) { return false; + } WVertex::incoming_edge_iterator itE; - for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) + for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) { area += (*itE)->GetaFace()->getArea(); + } Kh = Vec3r(0.0, 0.0, 0.0); @@ -190,10 +195,12 @@ bool gts_vertex_gaussian_curvature(WVertex *v, real *Kg) real area = 0.0; real angle_sum = 0.0; - if (!v) + if (!v) { return false; - if (!Kg) + } + if (!Kg) { return false; + } /* this operator is not defined for boundary edges */ if (v->isBoundary()) { @@ -236,11 +243,13 @@ void gts_vertex_principal_curvatures(real Kh, real Kg, real *K1, real *K2) { real temp = Kh * Kh - Kg; - if (!K1 || !K2) + if (!K1 || !K2) { return; + } - if (temp < 0.0) + if (temp < 0.0) { temp = 0.0; + } temp = sqrt(temp); *K1 = Kh + temp; *K2 = Kh - temp; @@ -313,21 +322,25 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V */ N[0] = N[1] = N[2] = 0.0; - for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) + for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) { N = Vec3r(N + (*itE)->GetaFace()->GetNormal()); + } real normN = N.norm(); - if (normN <= 0.0) + if (normN <= 0.0) { return; + } N.normalize(); } /* construct a basis from N: */ /* set basis1 to any component not the largest of N */ basis1[0] = basis1[1] = basis1[2] = 0.0; - if (fabs(N[0]) > fabs(N[1])) + if (fabs(N[0]) > fabs(N[1])) { basis1[1] = 1.0; - else + } + else { basis1[0] = 1.0; + } /* make basis2 orthogonal to N */ basis2 = (N ^ basis1); @@ -352,8 +365,9 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V WFace *f1, *f2; real weight, kappa, d1, d2; Vec3r vec_edge; - if (!*itE) + if (!*itE) { continue; + } e = *itE; /* since this vertex passed the tests in gts_vertex_mean_curvature_normal(), this should be @@ -590,8 +604,9 @@ static bool sphere_clip_vector(const Vec3r &O, real r, const Vec3r &P, Vec3r &V) void compute_curvature_tensor(WVertex *start, real radius, NormalCycle &nc) { // in case we have a non-manifold vertex, skip it... - if (start->isBoundary()) + if (start->isBoundary()) { return; + } std::set vertices; const Vec3r &O = start->GetVertex(); @@ -601,8 +616,9 @@ void compute_curvature_tensor(WVertex *start, real radius, NormalCycle &nc) while (!S.empty()) { WVertex *v = S.top(); S.pop(); - if (v->isBoundary()) + if (v->isBoundary()) { continue; + } const Vec3r &P = v->GetVertex(); WVertex::incoming_edge_iterator woeit = v->incoming_edges_begin(); WVertex::incoming_edge_iterator woeitend = v->incoming_edges_end(); @@ -630,8 +646,9 @@ void compute_curvature_tensor(WVertex *start, real radius, NormalCycle &nc) void compute_curvature_tensor_one_ring(WVertex *start, NormalCycle &nc) { // in case we have a non-manifold vertex, skip it... - if (start->isBoundary()) + if (start->isBoundary()) { return; + } WVertex::incoming_edge_iterator woeit = start->incoming_edges_begin(); WVertex::incoming_edge_iterator woeitend = start->incoming_edges_end(); -- cgit v1.2.3