diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2016-11-26 15:45:58 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2016-12-08 16:28:09 +0300 |
commit | 70a9de085b1ad4519eeb142125b42da96e135222 (patch) | |
tree | 4c5830ec5d633338426c6c44723ca52a734a9d68 /xs/src/libslic3r/TriangleMesh.hpp | |
parent | e9290252d60edbe28c86e0bc80a6229d932f04a8 (diff) |
Parallelize TriangleMeshSlicer::slice(), cherry picked from @alexrj 83ad123d951c6ee663d2f3b02e095c203ca794e7
Diffstat (limited to 'xs/src/libslic3r/TriangleMesh.hpp')
-rw-r--r-- | xs/src/libslic3r/TriangleMesh.hpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/xs/src/libslic3r/TriangleMesh.hpp b/xs/src/libslic3r/TriangleMesh.hpp index cf129809a..ec08f0d7c 100644 --- a/xs/src/libslic3r/TriangleMesh.hpp +++ b/xs/src/libslic3r/TriangleMesh.hpp @@ -3,7 +3,9 @@ #include "libslic3r.h" #include <admesh/stl.h> +#include <queue> #include <vector> +#include <boost/thread.hpp> #include "BoundingBox.hpp" #include "Line.hpp" #include "Point.hpp" @@ -88,19 +90,25 @@ class TriangleMeshSlicer TriangleMesh* mesh; TriangleMeshSlicer(TriangleMesh* _mesh); ~TriangleMeshSlicer(); - void slice(const std::vector<float> &z, std::vector<Polygons>* layers); - void slice(const std::vector<float> &z, std::vector<ExPolygons>* layers); - void slice_facet(float slice_z, const stl_facet &facet, const int &facet_idx, const float &min_z, const float &max_z, std::vector<IntersectionLine>* lines) const; - void cut(float z, TriangleMesh* upper, TriangleMesh* lower); + void slice(const std::vector<float> &z, std::vector<Polygons>* layers) const; + void slice(const std::vector<float> &z, std::vector<ExPolygons>* layers) const; + void slice_facet(float slice_z, const stl_facet &facet, const int &facet_idx, + const float &min_z, const float &max_z, std::vector<IntersectionLine>* lines, + boost::mutex* lines_mutex = NULL) const; + void cut(float z, TriangleMesh* upper, TriangleMesh* lower) const; private: typedef std::vector< std::vector<int> > t_facets_edges; t_facets_edges facets_edges; stl_vertex* v_scaled_shared; - void make_loops(std::vector<IntersectionLine> &lines, Polygons* loops); - void make_expolygons(const Polygons &loops, ExPolygons* slices); - void make_expolygons_simple(std::vector<IntersectionLine> &lines, ExPolygons* slices); - void make_expolygons(std::vector<IntersectionLine> &lines, ExPolygons* slices); + void _slice_do(std::queue<size_t>* queue, boost::mutex* queue_mutex, + std::vector<IntersectionLines>* lines, boost::mutex* lines_mutex, const std::vector<float> &z) const; + void _make_loops_do(std::queue<size_t>* queue, boost::mutex* queue_mutex, + std::vector<IntersectionLines>* lines, std::vector<Polygons>* layers) const; + void make_loops(std::vector<IntersectionLine> &lines, Polygons* loops) const; + void make_expolygons(const Polygons &loops, ExPolygons* slices) const; + void make_expolygons_simple(std::vector<IntersectionLine> &lines, ExPolygons* slices) const; + void make_expolygons(std::vector<IntersectionLine> &lines, ExPolygons* slices) const; }; } |