mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Surface / Surface Collection - optimization routines for filtering,
routines for visualization.
This commit is contained in:
parent
a506030082
commit
4a13efd081
5 changed files with 204 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
enum SurfaceType { stTop, stBottom, stBottomBridge, stInternal, stInternalSolid, stInternalBridge, stInternalVoid };
|
||||
enum SurfaceType { stTop, stBottom, stBottomBridge, stInternal, stInternalSolid, stInternalBridge, stInternalVoid, stPerimeter };
|
||||
|
||||
class Surface
|
||||
{
|
||||
|
@ -34,10 +34,43 @@ class Surface
|
|||
typedef std::vector<Surface> Surfaces;
|
||||
typedef std::vector<Surface*> SurfacesPtr;
|
||||
|
||||
inline Polygons to_polygons(const SurfacesPtr &src)
|
||||
{
|
||||
Polygons polygons;
|
||||
for (SurfacesPtr::const_iterator it = src.begin(); it != src.end(); ++it) {
|
||||
polygons.push_back((*it)->expolygon.contour);
|
||||
for (Polygons::const_iterator ith = (*it)->expolygon.holes.begin(); ith != (*it)->expolygon.holes.end(); ++ith) {
|
||||
polygons.push_back(*ith);
|
||||
}
|
||||
}
|
||||
return polygons;
|
||||
}
|
||||
|
||||
#if SLIC3R_CPPVER > 11
|
||||
inline Polygons to_polygons(SurfacesPtr &&src)
|
||||
{
|
||||
Polygons polygons;
|
||||
for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++it) {
|
||||
polygons.push_back(std::move((*it)->expolygon.contour));
|
||||
for (Polygons::const_iterator ith = (*it)->expolygon.holes.begin(); ith != (*it)->expolygon.holes.end(); ++ith) {
|
||||
polygons.push_back(std::move(*ith));
|
||||
}
|
||||
}
|
||||
return polygons;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern BoundingBox get_extents(const Surface &surface);
|
||||
extern BoundingBox get_extents(const Surfaces &surfaces);
|
||||
extern BoundingBox get_extents(const SurfacesPtr &surfaces);
|
||||
|
||||
class SVG;
|
||||
|
||||
extern const char* surface_type_to_color_name(const SurfaceType surface_type);
|
||||
extern void export_surface_type_legend_to_svg(SVG &svg, const Point &pos);
|
||||
extern Point export_surface_type_legend_to_svg_box_size();
|
||||
extern bool export_to_svg(const char *path, const Surfaces &surfaces, const float transparency = 1.f);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue