diff options
Diffstat (limited to 'source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h')
-rw-r--r-- | source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h index 5cbdd26be57..9999950e240 100644 --- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h @@ -119,10 +119,12 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr _CurvilinearLength = iBrother._CurvilinearLength; _step = iBrother._step; _t = iBrother._t; - if (iBrother._Point == 0) + if (iBrother._Point == 0) { _Point = 0; - else + } + else { _Point = new Point(*(iBrother._Point)); + } _n = iBrother._n; _currentn = iBrother._currentn; } @@ -136,10 +138,12 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr _CurvilinearLength = iBrother._CurvilinearLength; _step = iBrother._step; _t = iBrother._t; - if (iBrother._Point == 0) + if (iBrother._Point == 0) { _Point = 0; - else + } + else { _Point = new Point(*(iBrother._Point)); + } _n = iBrother._n; _currentn = iBrother._currentn; } @@ -154,10 +158,12 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr _CurvilinearLength = iBrother._CurvilinearLength; _step = iBrother._step; _t = iBrother._t; - if (iBrother._Point == 0) + if (iBrother._Point == 0) { _Point = 0; - else + } + else { _Point = new Point(*(iBrother._Point)); + } _n = iBrother._n; _currentn = iBrother._currentn; return *this; @@ -165,8 +171,9 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr virtual ~__point_iterator() { - if (_Point != 0) + if (_Point != 0) { delete _Point; + } } // protected: //FIXME @@ -243,8 +250,9 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr delete _Point; _Point = 0; } - if ((_currentn < 0) || (_currentn >= _n)) + if ((_currentn < 0) || (_currentn >= _n)) { return _Point; // 0 in this case + } return (_Point = new Point(*__A, *__B, _t)); } @@ -255,15 +263,17 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr virtual bool begin() const { - if ((__A == _begin) && (_t < (float)M_EPSILON)) + if ((__A == _begin) && (_t < (float)M_EPSILON)) { return true; + } return false; } virtual bool end() const { - if ((__B == _end)) + if ((__B == _end)) { return true; + } return false; } @@ -334,8 +344,9 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr --_currentn; --__A; --__B; - if (_currentn == _n - 1) + if (_currentn == _n - 1) { return; + } } if (0 == _step) { // means we iterate over initial vertices @@ -358,13 +369,16 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr } // round value - if (fabs(_t) < (float)M_EPSILON) + if (fabs(_t) < (float)M_EPSILON) { _t = 0.0f; + } if (_t < 0) { - if (_currentn == 0) + if (_currentn == 0) { _CurvilinearLength = 0.0f; - else + } + else { _CurvilinearLength += normAB * (-_t); + } _t = 0.0f; } } |