diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 80482952d..b6e39ec8e 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -179,6 +179,8 @@ add_library(libslic3r STATIC ${LIBDIR}/libslic3r/SVG.hpp ${LIBDIR}/libslic3r/TriangleMesh.cpp ${LIBDIR}/libslic3r/TriangleMesh.hpp + ${LIBDIR}/libslic3r/SLASupportPool.hpp + ${LIBDIR}/libslic3r/SLASupportPool.cpp # ${LIBDIR}/libslic3r/utils.cpp ${LIBDIR}/libslic3r/Utils.hpp diff --git a/xs/src/libslic3r/SLASupportPool.cpp b/xs/src/libslic3r/SLASupportPool.cpp new file mode 100644 index 000000000..12dae72d4 --- /dev/null +++ b/xs/src/libslic3r/SLASupportPool.cpp @@ -0,0 +1,33 @@ + +#include "SLASupportPool.hpp" +#include "ExPolygon.hpp" +#include "TriangleMesh.hpp" +#include "boost/geometry.hpp" + +namespace Slic3r { namespace sla { + +void ground_layer(const Mesh3D &mesh, GroundLayer &output) +{ + Mesh3D m = mesh; + TriangleMeshSlicer slicer(&m); + + std::vector tmp; + + slicer.slice({0.1f}, &tmp); + + output = tmp.front(); +} + +void create_base_pool(const GroundLayer &ground_layer, Mesh3D& out) +{ + // 1: Offset the ground layer + ExPolygon in; + ExPolygon chull; + boost::geometry::convex_hull(in, chull); + + // 2: triangulate the ground layer + +} + +} +} diff --git a/xs/src/libslic3r/SLASupportPool.hpp b/xs/src/libslic3r/SLASupportPool.hpp new file mode 100644 index 000000000..c23949384 --- /dev/null +++ b/xs/src/libslic3r/SLASupportPool.hpp @@ -0,0 +1,26 @@ +#ifndef SLASUPPORTPOOL_HPP +#define SLASUPPORTPOOL_HPP + +#include + +namespace Slic3r { + +class ExPolygon; +class TriangleMesh; + +namespace sla { + +using Mesh3D = TriangleMesh; +using GroundLayer = std::vector; + +/// Calculate the polygon representing the slice of the lowest layer of mesh +void ground_layer(const Mesh3D& mesh, GroundLayer& output); + +/// Calculate the pool for the mesh for SLA printing +void create_base_pool(const GroundLayer& ground_layer, Mesh3D& output_mesh); + +} + +} + +#endif // SLASUPPORTPOOL_HPP