mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00:00
Ported make_perimeters() to C++
This commit is contained in:
@@ -29,6 +29,9 @@ class ExtrusionEntityCollection : public ExtrusionEntity
|
||||
bool empty() const {
|
||||
return this->entities.empty();
|
||||
};
|
||||
void clear() {
|
||||
this->entities.clear();
|
||||
};
|
||||
void swap (ExtrusionEntityCollection &c);
|
||||
void append(const ExtrusionEntity &entity);
|
||||
void append(const ExtrusionEntitiesPtr &entities);
|
||||
|
||||
@@ -57,6 +57,7 @@ class LayerRegion
|
||||
Flow flow(FlowRole role, bool bridge = false, double width = -1) const;
|
||||
void merge_slices();
|
||||
void prepare_fill_surfaces();
|
||||
void make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces);
|
||||
|
||||
private:
|
||||
Layer *_layer;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Layer.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "PerimeterGenerator.hpp"
|
||||
#include "Print.hpp"
|
||||
#include "Surface.hpp"
|
||||
|
||||
@@ -53,6 +54,38 @@ LayerRegion::merge_slices()
|
||||
this->slices.surfaces.push_back(Surface(stInternal, *expoly));
|
||||
}
|
||||
|
||||
void
|
||||
LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces)
|
||||
{
|
||||
this->perimeters.clear();
|
||||
this->thin_fills.clear();
|
||||
|
||||
PerimeterGenerator g(
|
||||
// input:
|
||||
&slices,
|
||||
this->layer()->height,
|
||||
this->flow(frPerimeter),
|
||||
&this->region()->config,
|
||||
&this->layer()->object()->config,
|
||||
&this->layer()->object()->print()->config,
|
||||
|
||||
// output:
|
||||
&this->perimeters,
|
||||
&this->thin_fills,
|
||||
fill_surfaces
|
||||
);
|
||||
|
||||
if (this->layer()->lower_layer != NULL)
|
||||
g.lower_slices = &this->layer()->lower_layer->slices;
|
||||
|
||||
g.layer_id = this->layer()->id();
|
||||
g.ext_perimeter_flow = this->flow(frExternalPerimeter);
|
||||
g.overhang_flow = this->region()->flow(frPerimeter, -1, true, false, -1, *this->layer()->object());
|
||||
g.solid_infill_flow = this->flow(frSolidInfill);
|
||||
|
||||
g.process();
|
||||
}
|
||||
|
||||
void
|
||||
LayerRegion::prepare_fill_surfaces()
|
||||
{
|
||||
|
||||
@@ -30,8 +30,8 @@ class PerimeterGeneratorLoop {
|
||||
|
||||
class PerimeterGenerator {
|
||||
public:
|
||||
SurfaceCollection* slices;
|
||||
ExPolygonCollection* lower_slices;
|
||||
const SurfaceCollection* slices;
|
||||
const ExPolygonCollection* lower_slices;
|
||||
double layer_height;
|
||||
int layer_id;
|
||||
Flow perimeter_flow;
|
||||
@@ -45,7 +45,7 @@ class PerimeterGenerator {
|
||||
ExtrusionEntityCollection* gap_fill;
|
||||
SurfaceCollection* fill_surfaces;
|
||||
|
||||
PerimeterGenerator(SurfaceCollection* slices, double layer_height, Flow flow,
|
||||
PerimeterGenerator(const SurfaceCollection* slices, double layer_height, Flow flow,
|
||||
PrintRegionConfig* config, PrintObjectConfig* object_config,
|
||||
PrintConfig* print_config, ExtrusionEntityCollection* loops,
|
||||
ExtrusionEntityCollection* gap_fill, SurfaceCollection* fill_surfaces)
|
||||
|
||||
Reference in New Issue
Block a user