diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-31 16:21:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-31 16:22:52 +0300 |
commit | aba4e6810f8b4d0e459137b64e061a2cadc457d1 (patch) | |
tree | 2b6159c7ba0f23c020600b71276772fa4a882b5b /source/blender/freestyle/intern/geometry | |
parent | 72a563cdee8fef198a200ff65b57ddb847c01795 (diff) |
Cleanup: style, use braces in source/ (include disabled blocks)
Diffstat (limited to 'source/blender/freestyle/intern/geometry')
-rw-r--r-- | source/blender/freestyle/intern/geometry/Polygon.h | 3 | ||||
-rw-r--r-- | source/blender/freestyle/intern/geometry/SweepLine.h | 24 | ||||
-rw-r--r-- | source/blender/freestyle/intern/geometry/VecMat.h | 6 |
3 files changed, 22 insertions, 11 deletions
diff --git a/source/blender/freestyle/intern/geometry/Polygon.h b/source/blender/freestyle/intern/geometry/Polygon.h index f0e1199d930..b3f47c8ca77 100644 --- a/source/blender/freestyle/intern/geometry/Polygon.h +++ b/source/blender/freestyle/intern/geometry/Polygon.h @@ -215,8 +215,9 @@ class Polygon3r : public Polygon<Vec3r> { real epsilon = M_EPSILON) const { #if 0 - if (_vertices.size() < 3) + if (_vertices.size() < 3) { return false; + } #endif return GeomUtils::intersectRayTriangle( orig, dir, _vertices[0], _vertices[1], _vertices[2], t, u, v, epsilon); diff --git a/source/blender/freestyle/intern/geometry/SweepLine.h b/source/blender/freestyle/intern/geometry/SweepLine.h index 36094bf5086..f31b276d358 100644 --- a/source/blender/freestyle/intern/geometry/SweepLine.h +++ b/source/blender/freestyle/intern/geometry/SweepLine.h @@ -55,10 +55,12 @@ template<class Edge> class Intersection { /*! returns the parameter giving the intersection, for the edge iEdge */ real getParameter(Edge *iEdge) { - if (iEdge == EdgeA) + if (iEdge == EdgeA) { return tA; - if (iEdge == EdgeB) + } + if (iEdge == EdgeB) { return tB; + } return 0; } @@ -131,8 +133,9 @@ template<class T, class Point> class Segment { inline bool operator==(const Segment<T, Point> &iBrother) { - if (_edge == iBrother._edge) + if (_edge == iBrother._edge) { return true; + } return false; } @@ -237,10 +240,12 @@ template<class T, class Point> class SweepLine { vector<Segment<T, Point> *> toadd; typename vector<Segment<T, Point> *>::iterator s, send; for (s = segments.begin(), send = segments.end(); s != send; s++) { - if (p == (*(*s))[0]) + if (p == (*(*s))[0]) { toadd.push_back((*s)); - else + } + else { remove((*s)); + } } for (s = toadd.begin(), send = toadd.end(); s != send; s++) { add((*s), binrule, epsilon); @@ -275,8 +280,9 @@ template<class T, class Point> class SweepLine { s != send; s++) { Segment<T, Point> *currentS = (*s); - if (true != binrule(*S, *currentS)) + if (true != binrule(*S, *currentS)) { continue; + } if (true == currentS->order()) { v2[0] = ((*currentS)[0])[0]; @@ -290,8 +296,9 @@ template<class T, class Point> class SweepLine { v2[0] = ((*currentS)[1])[0]; v2[1] = ((*currentS)[1])[1]; } - if (S->CommonVertex(*currentS, CP)) + if (S->CommonVertex(*currentS, CP)) { continue; // the two edges have a common vertex->no need to check + } if (GeomUtils::intersect2dSeg2dSegParametric(v0, v1, v2, v3, t, u, epsilon) == GeomUtils::DO_INTERSECT) { @@ -312,8 +319,9 @@ template<class T, class Point> class SweepLine { inline void remove(Segment<T, Point> *s) { - if (s->intersections().size() > 0) + if (s->intersections().size() > 0) { _IntersectedEdges.push_back(s); + } _set.remove(s); } diff --git a/source/blender/freestyle/intern/geometry/VecMat.h b/source/blender/freestyle/intern/geometry/VecMat.h index bb12e5b97f0..acc593e8ac9 100644 --- a/source/blender/freestyle/intern/geometry/VecMat.h +++ b/source/blender/freestyle/intern/geometry/VecMat.h @@ -868,8 +868,9 @@ template<class T, unsigned N> inline Vec<T, N> operator/(const Vec<T, N> &v, const typename Vec<T, N>::value_type r) { Vec<T, N> res(v); - if (r) + if (r) { res /= r; + } return res; } @@ -878,8 +879,9 @@ template<class T, unsigned N> inline typename Vec<T, N>::value_type operator*(const Vec<T, N> &v1, const Vec<T, N> &v2) { typename Vec<T, N>::value_type sum = 0; - for (unsigned int i = 0; i < N; i++) + for (unsigned int i = 0; i < N; i++) { sum += v1[i] * v2[i]; + } return sum; } |