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

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'xs/src/libslic3r/Surface.cpp')
-rw-r--r--xs/src/libslic3r/Surface.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/xs/src/libslic3r/Surface.cpp b/xs/src/libslic3r/Surface.cpp
index 4d2234e4d..5df2dd99a 100644
--- a/xs/src/libslic3r/Surface.cpp
+++ b/xs/src/libslic3r/Surface.cpp
@@ -1,3 +1,4 @@
+#include "BoundingBox.hpp"
#include "Surface.hpp"
namespace Slic3r {
@@ -54,4 +55,31 @@ Surface::is_bridge() const
|| this->surface_type == stInternalBridge;
}
+BoundingBox get_extents(const Surface &surface)
+{
+ return get_extents(surface.expolygon.contour);
+}
+
+BoundingBox get_extents(const Surfaces &surfaces)
+{
+ BoundingBox bbox;
+ if (! surfaces.empty()) {
+ bbox = get_extents(surfaces.front());
+ for (size_t i = 1; i < surfaces.size(); ++ i)
+ bbox.merge(get_extents(surfaces[i]));
+ }
+ return bbox;
+}
+
+BoundingBox get_extents(const SurfacesPtr &surfaces)
+{
+ BoundingBox bbox;
+ if (! surfaces.empty()) {
+ bbox = get_extents(*surfaces.front());
+ for (size_t i = 1; i < surfaces.size(); ++ i)
+ bbox.merge(get_extents(*surfaces[i]));
+ }
+ return bbox;
+}
+
}