Add free functions to slice a TriangleMesh

This commit is contained in:
tamasmeszaros 2019-12-05 13:38:04 +01:00
parent 8604e19384
commit 514bb23c6c

View File

@ -198,6 +198,29 @@ private:
void make_expolygons(std::vector<IntersectionLine> &lines, const float closing_radius, ExPolygons* slices) const; void make_expolygons(std::vector<IntersectionLine> &lines, const float closing_radius, ExPolygons* slices) const;
}; };
inline void slice_mesh(
const TriangleMesh & mesh,
const std::vector<float> & z,
std::vector<Polygons> & layers,
TriangleMeshSlicer::throw_on_cancel_callback_type thr = nullptr)
{
if (mesh.empty()) return;
TriangleMeshSlicer slicer(&mesh);
slicer.slice(z, &layers, thr);
}
inline void slice_mesh(
const TriangleMesh & mesh,
const std::vector<float> & z,
std::vector<ExPolygons> & layers,
float closing_radius,
TriangleMeshSlicer::throw_on_cancel_callback_type thr = nullptr)
{
if (mesh.empty()) return;
TriangleMeshSlicer slicer(&mesh);
slicer.slice(z, closing_radius, &layers, thr);
}
TriangleMesh make_cube(double x, double y, double z); TriangleMesh make_cube(double x, double y, double z);
// Generate a TriangleMesh of a cylinder // Generate a TriangleMesh of a cylinder