Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-10-17 15:36:30 +0300
committerbubnikv <bubnikv@gmail.com>2017-10-17 15:36:30 +0300
commita91d7cb2f73e62a84ca3f2c2d174cd0854e74f4d (patch)
treed9411f178022450186eee5780db63a9021a17351 /xs/src/libslic3r/BoundingBox.hpp
parenta191fbbec8d0794a23d0b1530f70b2bcf979f4ee (diff)
Redefined the ==, != operators of Point and BoundingBox classes
to become members of their respective classes to avoid type clashes through implicit casting operators of ConfigOption classes.
Diffstat (limited to 'xs/src/libslic3r/BoundingBox.hpp')
-rw-r--r--xs/src/libslic3r/BoundingBox.hpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/xs/src/libslic3r/BoundingBox.hpp b/xs/src/libslic3r/BoundingBox.hpp
index 1731bd2f1..90179d3f9 100644
--- a/xs/src/libslic3r/BoundingBox.hpp
+++ b/xs/src/libslic3r/BoundingBox.hpp
@@ -15,7 +15,7 @@ typedef Pointf3 Sizef3;
template <class PointClass>
class BoundingBoxBase
{
- public:
+public:
PointClass min;
PointClass max;
bool defined;
@@ -42,12 +42,14 @@ class BoundingBoxBase
return ! (this->max.x < other.min.x || this->min.x > other.max.x ||
this->max.y < other.min.y || this->min.y > other.max.y);
}
+ bool operator==(const BoundingBoxBase<PointClass> &rhs) { return this->min == rhs.min && this->max == rhs.max; }
+ bool operator!=(const BoundingBoxBase<PointClass> &rhs) { return ! (*this == rhs); }
};
template <class PointClass>
class BoundingBox3Base : public BoundingBoxBase<PointClass>
{
- public:
+public:
BoundingBox3Base() : BoundingBoxBase<PointClass>() {};
BoundingBox3Base(const PointClass &pmin, const PointClass &pmax) :
BoundingBoxBase<PointClass>(pmin, pmax)
@@ -66,7 +68,7 @@ class BoundingBox3Base : public BoundingBoxBase<PointClass>
class BoundingBox : public BoundingBoxBase<Point>
{
- public:
+public:
void polygon(Polygon* polygon) const;
Polygon polygon() const;
BoundingBox rotated(double angle) const;
@@ -87,6 +89,7 @@ class BoundingBox : public BoundingBoxBase<Point>
class BoundingBox3 : public BoundingBox3Base<Point3>
{
+public:
BoundingBox3() : BoundingBox3Base<Point3>() {};
BoundingBox3(const Point3 &pmin, const Point3 &pmax) : BoundingBox3Base<Point3>(pmin, pmax) {};
BoundingBox3(const std::vector<Point3> &points) : BoundingBox3Base<Point3>(points) {};
@@ -109,18 +112,6 @@ public:
};
template<typename VT>
-inline bool operator==(const BoundingBoxBase<VT> &bb1, const BoundingBoxBase<VT> &bb2)
-{
- return bb1.min == bb2.min && bb1.max == bb2.max;
-}
-
-template<typename VT>
-inline bool operator!=(const BoundingBoxBase<VT> &bb1, const BoundingBoxBase<VT> &bb2)
-{
- return !(bb1 == bb2);
-}
-
-template<typename VT>
inline bool empty(const BoundingBoxBase<VT> &bb)
{
return ! bb.defined || bb.min.x >= bb.max.x || bb.min.y >= bb.max.y;