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:
authorbubnikv <bubnikv@gmail.com>2016-09-13 14:30:00 +0300
committerbubnikv <bubnikv@gmail.com>2016-09-13 14:30:00 +0300
commit620c6c7378c4799980f63794669548c104b9bcea (patch)
treefc7aea3342539018bb19d27abd1144956eb00b4d /xs/src/libslic3r/Surface.cpp
parenta5b7f14dfa291039fd6971a356efd011fab84440 (diff)
Ported from the playground branch. Various documentation and optimization.
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;
+}
+
}