diff --git a/xs/src/libslic3r/BoundingBox.cpp b/xs/src/libslic3r/BoundingBox.cpp index 75ece90bf3..f268bb3fbc 100644 --- a/xs/src/libslic3r/BoundingBox.cpp +++ b/xs/src/libslic3r/BoundingBox.cpp @@ -203,23 +203,6 @@ BoundingBox3Base::radius() const } template double BoundingBox3Base::radius() const; -template void -BoundingBoxBase::translate(coordf_t x, coordf_t y) -{ - this->min.translate(x, y); - this->max.translate(x, y); -} -template void BoundingBoxBase::translate(coordf_t x, coordf_t y); -template void BoundingBoxBase::translate(coordf_t x, coordf_t y); - -template void -BoundingBox3Base::translate(coordf_t x, coordf_t y, coordf_t z) -{ - this->min.translate(x, y, z); - this->max.translate(x, y, z); -} -template void BoundingBox3Base::translate(coordf_t x, coordf_t y, coordf_t z); - template void BoundingBoxBase::offset(coordf_t delta) { @@ -259,25 +242,6 @@ BoundingBox3Base::center() const } template Pointf3 BoundingBox3Base::center() const; -template bool -BoundingBoxBase::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; -} -template bool BoundingBoxBase::contains(const Point &point) const; -template bool BoundingBoxBase::contains(const Pointf &point) const; - -template bool -BoundingBoxBase::overlap(const BoundingBoxBase &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 bool BoundingBoxBase::overlap(const BoundingBoxBase &point) const; -template bool BoundingBoxBase::overlap(const BoundingBoxBase &point) const; - - // Align a coordinate to a grid. The coordinate may be negative, // the aligned value will never be bigger than the original one. static inline coord_t _align_to_grid(const coord_t coord, const coord_t spacing) { diff --git a/xs/src/libslic3r/BoundingBox.hpp b/xs/src/libslic3r/BoundingBox.hpp index 232dada802..8a562c789c 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 &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 &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 @@ -51,7 +58,8 @@ class BoundingBox3Base : public BoundingBoxBase void merge(const BoundingBox3Base &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; }; diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 4c14599c95..18b01fea39 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -36,12 +36,6 @@ Print::clear_objects() this->clear_regions(); } -PrintObject* -Print::get_object(size_t idx) -{ - return objects.at(idx); -} - void Print::delete_object(size_t idx) { diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index 6dd9a8094d..3398260e39 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -198,7 +198,7 @@ typedef std::vector PrintRegionPtrs; // The complete print tray with possibly multiple objects. class Print { - public: +public: PrintConfig config; PrintObjectConfig default_object_config; PrintRegionConfig default_region_config; @@ -218,7 +218,9 @@ class Print // methods for handling objects void clear_objects(); - PrintObject* get_object(size_t idx); + PrintObject* get_object(size_t idx) { return objects.at(idx); } + const PrintObject* get_object(size_t idx) const { return objects.at(idx); } + void delete_object(size_t idx); void reload_object(size_t idx); bool reload_model_instances(); @@ -258,7 +260,7 @@ class Print std::string output_filename(); std::string output_filepath(const std::string &path); - private: +private: void clear_regions(); void delete_region(size_t idx); PrintRegionConfig _region_config_from_model_volume(const ModelVolume &volume);