From e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 17 Apr 2019 06:17:24 +0200 Subject: ClangFormat: apply to source, most of intern Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat --- source/blender/freestyle/intern/geometry/BBox.h | 222 ++++++++++++------------ 1 file changed, 108 insertions(+), 114 deletions(-) (limited to 'source/blender/freestyle/intern/geometry/BBox.h') diff --git a/source/blender/freestyle/intern/geometry/BBox.h b/source/blender/freestyle/intern/geometry/BBox.h index 741d4e6715e..7350fabbc13 100644 --- a/source/blender/freestyle/intern/geometry/BBox.h +++ b/source/blender/freestyle/intern/geometry/BBox.h @@ -28,133 +28,127 @@ #include "BLI_utildefines.h" #ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" +# include "MEM_guardedalloc.h" #endif namespace Freestyle { -template -class BBox -{ -public: - inline BBox() - { - _empty = true; - } - - template - inline BBox(const T& min_in, const T& max_in) : _min(min_in), _max(max_in) - { - _empty = false; - } - - template - inline BBox(const BBox& b) : _min(b.getMin()), _max(b.getMax()) - { - _empty = false; - } - - template - inline void extendToContain(const T& p) - { - if (_empty) { - _min = p; - _max = p; - _empty = false; - return; - } - for (unsigned int i = 0; i < Point::dim(); i++) { - if (p[i] < _min[i]) - _min[i] = p[i]; - else if (p[i] > _max[i]) - _max[i] = p[i]; - } - _empty = false; - } - - inline void clear() - { - _empty = true; - } - - inline bool empty() const - { - return _empty; - } - - inline const Point& getMin() const - { - return _min; - } - - inline const Point& getMax() const - { - return _max; - } - - inline BBox& operator=(const BBox& b) - { - BLI_assert(!b.empty()); - _min = b.getMin(); - _max = b.getMax(); - _empty = false; - return *this; - } - - inline BBox& operator+=(const BBox& b) - { - BLI_assert(!b.empty()); - if (_empty) { - _min = b.getMin(); - _max = b.getMax(); - _empty = false; - } - else { - for (unsigned int i = 0; i < Point::dim(); i++) { - if (b.getMin()[i] < _min[i]) - _min[i] = b.getMin()[i]; - if (b.getMax()[i] > _max[i]) - _max[i] = b.getMax()[i]; - } - } - return *this; - } - - inline bool inside(const Point& p) - { - if (empty()) - return false; - for (unsigned int i = 0; i < Point::dim(); i++) { - if ((_min[i]>p[i]) || (_max[i] class BBox { + public: + inline BBox() + { + _empty = true; + } + + template inline BBox(const T &min_in, const T &max_in) : _min(min_in), _max(max_in) + { + _empty = false; + } + + template inline BBox(const BBox &b) : _min(b.getMin()), _max(b.getMax()) + { + _empty = false; + } + + template inline void extendToContain(const T &p) + { + if (_empty) { + _min = p; + _max = p; + _empty = false; + return; + } + for (unsigned int i = 0; i < Point::dim(); i++) { + if (p[i] < _min[i]) + _min[i] = p[i]; + else if (p[i] > _max[i]) + _max[i] = p[i]; + } + _empty = false; + } + + inline void clear() + { + _empty = true; + } + + inline bool empty() const + { + return _empty; + } + + inline const Point &getMin() const + { + return _min; + } + + inline const Point &getMax() const + { + return _max; + } + + inline BBox &operator=(const BBox &b) + { + BLI_assert(!b.empty()); + _min = b.getMin(); + _max = b.getMax(); + _empty = false; + return *this; + } + + inline BBox &operator+=(const BBox &b) + { + BLI_assert(!b.empty()); + if (_empty) { + _min = b.getMin(); + _max = b.getMax(); + _empty = false; + } + else { + for (unsigned int i = 0; i < Point::dim(); i++) { + if (b.getMin()[i] < _min[i]) + _min[i] = b.getMin()[i]; + if (b.getMax()[i] > _max[i]) + _max[i] = b.getMax()[i]; + } + } + return *this; + } + + inline bool inside(const Point &p) + { + if (empty()) + return false; + for (unsigned int i = 0; i < Point::dim(); i++) { + if ((_min[i] > p[i]) || (_max[i] < p[i])) + return false; + } + return true; + } + + private: + Point _min; + Point _max; + bool _empty; #ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BBox") + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BBox") #endif }; -template -BBox& operator+(const BBox &b1, const BBox &b2) +template BBox &operator+(const BBox &b1, const BBox &b2) { - Point new_min; - Point new_max; + Point new_min; + Point new_max; - for (unsigned int i = 0; i < Point::dim(); i++) { - new_min[i] = b1.getMin()[i] < b2.getMin()[i] ? b1.getMin()[i] : b2.getMin()[i]; - new_max[i] = b1.getMax()[i] > b2.getMax()[i] ? b1.getMax()[i] : b2.getMax()[i]; - } + for (unsigned int i = 0; i < Point::dim(); i++) { + new_min[i] = b1.getMin()[i] < b2.getMin()[i] ? b1.getMin()[i] : b2.getMin()[i]; + new_max[i] = b1.getMax()[i] > b2.getMax()[i] ? b1.getMax()[i] : b2.getMax()[i]; + } - return BBox(new_min, new_max); + return BBox(new_min, new_max); } } /* namespace Freestyle */ -#endif // __BBOX_H__ +#endif // __BBOX_H__ -- cgit v1.2.3