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-03-13 18:03:11 +0300
committerbubnikv <bubnikv@gmail.com>2017-03-13 18:03:11 +0300
commitc96d7946040d4bb6f943fd596bc42e5c063bc06a (patch)
tree6ecd0901f406bd399b6e3c737e44419078d96ea1 /xs/src/libslic3r/BoundingBox.hpp
parente6fddd364d876c3970a440a7c37f8a6221388fea (diff)
BoundingBox, Print - methods inlined, added const accessors.
Diffstat (limited to 'xs/src/libslic3r/BoundingBox.hpp')
-rw-r--r--xs/src/libslic3r/BoundingBox.hpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/xs/src/libslic3r/BoundingBox.hpp b/xs/src/libslic3r/BoundingBox.hpp
index 232dada80..8a562c789 100644
--- a/xs/src/libslic3r/BoundingBox.hpp
+++ b/xs/src/libslic3r/BoundingBox.hpp
@@ -30,11 +30,18 @@ class BoundingBoxBase
void scale(double factor);
PointClass size() const;
double radius() const;
- void translate(coordf_t x, coordf_t y);
+ void translate(coordf_t x, coordf_t y) { this->min.translate(x, y); this->max.translate(x, y); }
+ void translate(const Pointf &pos) { this->translate(pos.x, pos.y); }
void offset(coordf_t delta);
PointClass center() const;
- bool contains(const PointClass &point) const;
- bool overlap(const BoundingBoxBase<PointClass> &other) const;
+ bool contains(const PointClass &point) const {
+ return point.x >= this->min.x && point.x <= this->max.x
+ && point.y >= this->min.y && point.y <= this->max.y;
+ }
+ bool overlap(const BoundingBoxBase<PointClass> &other) const {
+ 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);
+ }
};
template <class PointClass>
@@ -51,7 +58,8 @@ class BoundingBox3Base : public BoundingBoxBase<PointClass>
void merge(const BoundingBox3Base<PointClass> &bb);
PointClass size() const;
double radius() const;
- void translate(coordf_t x, coordf_t y, coordf_t z);
+ void translate(coordf_t x, coordf_t y, coordf_t z) { this->min.translate(x, y, z); this->max.translate(x, y, z); }
+ void translate(const Pointf3 &pos) { this->translate(pos.x, pos.y, pos.z); }
void offset(coordf_t delta);
PointClass center() const;
};