Inlined Surface::any_internal_contains / any_bottom_contains
This commit is contained in:
parent
7c1350d007
commit
41f50b246c
@ -1928,8 +1928,7 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string
|
||||
return gcode;
|
||||
}
|
||||
|
||||
bool
|
||||
GCode::needs_retraction(const Polyline &travel, ExtrusionRole role)
|
||||
bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role)
|
||||
{
|
||||
if (travel.length() < scale_(EXTRUDER_CONFIG(retract_before_travel))) {
|
||||
// skip retraction if the move is shorter than the configured threshold
|
||||
@ -1946,14 +1945,12 @@ GCode::needs_retraction(const Polyline &travel, ExtrusionRole role)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_config.only_retract_when_crossing_perimeters && m_layer != nullptr) {
|
||||
if (m_config.fill_density.value > 0
|
||||
&& m_layer->any_internal_region_slice_contains(travel)) {
|
||||
/* skip retraction if travel is contained in an internal slice *and*
|
||||
internal infill is enabled (so that stringing is entirely not visible) */
|
||||
if (m_config.only_retract_when_crossing_perimeters && m_layer != nullptr &&
|
||||
m_config.fill_density.value > 0 && m_layer->any_internal_region_slice_contains(travel))
|
||||
// Skip retraction if travel is contained in an internal slice *and*
|
||||
// internal infill is enabled (so that stringing is entirely not visible).
|
||||
//FIXME any_internal_region_slice_contains() is potentionally very slow, it shall test for the bounding boxes first.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// retract if only_retract_when_crossing_perimeters is disabled or doesn't apply
|
||||
return true;
|
||||
|
@ -70,27 +70,6 @@ void Layer::merge_slices()
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Layer::any_internal_region_slice_contains(const T &item) const
|
||||
{
|
||||
FOREACH_LAYERREGION(this, layerm) {
|
||||
if ((*layerm)->slices.any_internal_contains(item)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
template bool Layer::any_internal_region_slice_contains<Polyline>(const Polyline &item) const;
|
||||
|
||||
template <class T>
|
||||
bool Layer::any_bottom_region_slice_contains(const T &item) const
|
||||
{
|
||||
FOREACH_LAYERREGION(this, layerm) {
|
||||
if ((*layerm)->slices.any_bottom_contains(item)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
template bool Layer::any_bottom_region_slice_contains<Polyline>(const Polyline &item) const;
|
||||
|
||||
|
||||
// Here the perimeters are created cummulatively for all layer regions sharing the same parameters influencing the perimeters.
|
||||
// The perimeter paths and the thin fills (ExtrusionEntityCollection) are assigned to the first compatible layer region.
|
||||
// The resulting fill surface is split back among the originating regions.
|
||||
|
@ -115,8 +115,14 @@ public:
|
||||
|
||||
void make_slices();
|
||||
void merge_slices();
|
||||
template <class T> bool any_internal_region_slice_contains(const T &item) const;
|
||||
template <class T> bool any_bottom_region_slice_contains(const T &item) const;
|
||||
template <class T> bool any_internal_region_slice_contains(const T &item) const {
|
||||
for (const LayerRegion *layerm : this->regions) if (layerm->slices.any_internal_contains(item)) return true;
|
||||
return false;
|
||||
}
|
||||
template <class T> bool any_bottom_region_slice_contains(const T &item) const {
|
||||
for (const LayerRegion *layerm : this->regions) if (layerm->slices.any_bottom_contains(item)) return true;
|
||||
return false;
|
||||
}
|
||||
void make_perimeters();
|
||||
void make_fills();
|
||||
|
||||
|
@ -54,28 +54,6 @@ SurfaceCollection::group(std::vector<SurfacesPtr> *retval)
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
SurfaceCollection::any_internal_contains(const T &item) const
|
||||
{
|
||||
for (Surfaces::const_iterator surface = this->surfaces.begin(); surface != this->surfaces.end(); ++surface) {
|
||||
if (surface->is_internal() && surface->expolygon.contains(item)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
template bool SurfaceCollection::any_internal_contains<Polyline>(const Polyline &item) const;
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
SurfaceCollection::any_bottom_contains(const T &item) const
|
||||
{
|
||||
for (Surfaces::const_iterator surface = this->surfaces.begin(); surface != this->surfaces.end(); ++surface) {
|
||||
if (surface->is_bottom() && surface->expolygon.contains(item)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
template bool SurfaceCollection::any_bottom_contains<Polyline>(const Polyline &item) const;
|
||||
|
||||
SurfacesPtr
|
||||
SurfaceCollection::filter_by_type(const SurfaceType type)
|
||||
{
|
||||
|
@ -19,8 +19,14 @@ public:
|
||||
operator ExPolygons() const;
|
||||
void simplify(double tolerance);
|
||||
void group(std::vector<SurfacesPtr> *retval);
|
||||
template <class T> bool any_internal_contains(const T &item) const;
|
||||
template <class T> bool any_bottom_contains(const T &item) const;
|
||||
template <class T> bool any_internal_contains(const T &item) const {
|
||||
for (const Surface &surface : this->surfaces) if (surface.is_internal() && surface.expolygon.contains(item)) return true;
|
||||
return false;
|
||||
}
|
||||
template <class T> bool any_bottom_contains(const T &item) const {
|
||||
for (const Surface &surface : this->surfaces) if (surface.is_bottom() && surface.expolygon.contains(item)) return true;
|
||||
return false;
|
||||
}
|
||||
SurfacesPtr filter_by_type(const SurfaceType type);
|
||||
SurfacesPtr filter_by_types(const SurfaceType *types, int ntypes);
|
||||
void keep_type(const SurfaceType type);
|
||||
|
@ -87,10 +87,6 @@
|
||||
|
||||
void make_slices();
|
||||
void merge_slices();
|
||||
bool any_internal_region_slice_contains_polyline(Polyline* polyline)
|
||||
%code%{ RETVAL = THIS->any_internal_region_slice_contains(*polyline); %};
|
||||
bool any_bottom_region_slice_contains_polyline(Polyline* polyline)
|
||||
%code%{ RETVAL = THIS->any_bottom_region_slice_contains(*polyline); %};
|
||||
void make_perimeters();
|
||||
void make_fills();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user