本文整理汇总了C++中expolygons::const_iterator::simplify_p方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::simplify_p方法的具体用法?C++ const_iterator::simplify_p怎么用?C++ const_iterator::simplify_p使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类expolygons::const_iterator
的用法示例。
在下文中一共展示了const_iterator::simplify_p方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loop
void
PerimeterGenerator::process()
{
// other perimeters
this->_mm3_per_mm = this->perimeter_flow.mm3_per_mm();
coord_t pwidth = this->perimeter_flow.scaled_width();
coord_t pspacing = this->perimeter_flow.scaled_spacing();
// external perimeters
this->_ext_mm3_per_mm = this->ext_perimeter_flow.mm3_per_mm();
coord_t ext_pwidth = this->ext_perimeter_flow.scaled_width();
coord_t ext_pspacing = this->ext_perimeter_flow.scaled_spacing();
coord_t ext_pspacing2 = this->ext_perimeter_flow.scaled_spacing(this->perimeter_flow);
// overhang perimeters
this->_mm3_per_mm_overhang = this->overhang_flow.mm3_per_mm();
// solid infill
coord_t ispacing = this->solid_infill_flow.scaled_spacing();
coord_t gap_area_threshold = pwidth * pwidth;
// Calculate the minimum required spacing between two adjacent traces.
// This should be equal to the nominal flow spacing but we experiment
// with some tolerance in order to avoid triggering medial axis when
// some squishing might work. Loops are still spaced by the entire
// flow spacing; this only applies to collapsing parts.
// For ext_min_spacing we use the ext_pspacing calculated for two adjacent
// external loops (which is the correct way) instead of using ext_pspacing2
// which is the spacing between external and internal, which is not correct
// and would make the collapsing (thus the details resolution) dependent on
// internal flow which is unrelated.
coord_t min_spacing = pspacing * (1 - INSET_OVERLAP_TOLERANCE);
coord_t ext_min_spacing = ext_pspacing * (1 - INSET_OVERLAP_TOLERANCE);
// prepare grown lower layer slices for overhang detection
if (this->lower_slices != NULL && this->config->overhangs) {
// We consider overhang any part where the entire nozzle diameter is not supported by the
// lower layer, so we take lower slices and offset them by half the nozzle diameter used
// in the current layer
double nozzle_diameter = this->print_config->nozzle_diameter.get_at(this->config->perimeter_extruder-1);
this->_lower_slices_p = offset(*this->lower_slices, scale_(+nozzle_diameter/2));
}
// we need to process each island separately because we might have different
// extra perimeters for each one
for (Surfaces::const_iterator surface = this->slices->surfaces.begin();
surface != this->slices->surfaces.end(); ++surface) {
// detect how many perimeters must be generated for this island
signed short loop_number = this->config->perimeters + surface->extra_perimeters;
loop_number--; // 0-indexed loops
Polygons gaps;
Polygons last = surface->expolygon.simplify_p(SCALED_RESOLUTION);
if (loop_number >= 0) { // no loops = -1
std::vector<PerimeterGeneratorLoops> contours(loop_number+1); // depth => loops
std::vector<PerimeterGeneratorLoops> holes(loop_number+1); // depth => loops
Polylines thin_walls;
// we loop one time more than needed in order to find gaps after the last perimeter was applied
for (signed short i = 0; i <= loop_number+1; ++i) { // outer loop is 0
Polygons offsets;
if (i == 0) {
// the minimum thickness of a single loop is:
// ext_width/2 + ext_spacing/2 + spacing/2 + width/2
if (this->config->thin_walls) {
offsets = offset2(
last,
-(ext_pwidth/2 + ext_min_spacing/2 - 1),
+(ext_min_spacing/2 - 1)
);
} else {
offsets = offset(last, -ext_pwidth/2);
}
// look for thin walls
if (this->config->thin_walls) {
Polygons diffpp = diff(
last,
offset(offsets, +ext_pwidth/2),
true // medial axis requires non-overlapping geometry
);
// the following offset2 ensures almost nothing in @thin_walls is narrower than $min_width
// (actually, something larger than that still may exist due to mitering or other causes)
coord_t min_width = ext_pwidth / 2;
ExPolygons expp = offset2_ex(diffpp, -min_width/2, +min_width/2);
// the maximum thickness of our thin wall area is equal to the minimum thickness of a single loop
Polylines pp;
for (ExPolygons::const_iterator ex = expp.begin(); ex != expp.end(); ++ex)
ex->medial_axis(ext_pwidth + ext_pspacing2, min_width, &pp);
double threshold = ext_pwidth * 2;
for (Polylines::const_iterator p = pp.begin(); p != pp.end(); ++p) {
if (p->length() > threshold) {
thin_walls.push_back(*p);
}
//.........这里部分代码省略.........