mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 02:37:51 -06:00
Finished porting LayerRegion to C++
This commit is contained in:
parent
5b8ed7367a
commit
9fcec10737
28 changed files with 319 additions and 203 deletions
|
@ -47,7 +47,7 @@ PerimeterGenerator::process()
|
|||
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
|
||||
short loop_number = this->config->perimeters + surface->extra_perimeters;
|
||||
signed short loop_number = this->config->perimeters + surface->extra_perimeters;
|
||||
loop_number--; // 0-indexed loops
|
||||
|
||||
Polygons gaps;
|
||||
|
@ -60,7 +60,7 @@ PerimeterGenerator::process()
|
|||
Polylines thin_walls;
|
||||
|
||||
// we loop one time more than needed in order to find gaps after the last perimeter was applied
|
||||
for (unsigned short i = 0; i <= loop_number+1; ++i) { // outer loop is 0
|
||||
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:
|
||||
|
@ -166,16 +166,16 @@ PerimeterGenerator::process()
|
|||
}
|
||||
|
||||
// nest loops: holes first
|
||||
for (unsigned short d = 0; d <= loop_number; ++d) {
|
||||
for (signed short d = 0; d <= loop_number; ++d) {
|
||||
PerimeterGeneratorLoops &holes_d = holes[d];
|
||||
|
||||
// loop through all holes having depth == d
|
||||
for (unsigned short i = 0; i < holes_d.size(); ++i) {
|
||||
for (signed short i = 0; i < holes_d.size(); ++i) {
|
||||
const PerimeterGeneratorLoop &loop = holes_d[i];
|
||||
|
||||
// find the hole loop that contains this one, if any
|
||||
for (unsigned short t = d+1; t <= loop_number; ++t) {
|
||||
for (unsigned short j = 0; j < holes[t].size(); ++j) {
|
||||
for (signed short t = d+1; t <= loop_number; ++t) {
|
||||
for (signed short j = 0; j < holes[t].size(); ++j) {
|
||||
PerimeterGeneratorLoop &candidate_parent = holes[t][j];
|
||||
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
||||
candidate_parent.children.push_back(loop);
|
||||
|
@ -187,8 +187,8 @@ PerimeterGenerator::process()
|
|||
}
|
||||
|
||||
// if no hole contains this hole, find the contour loop that contains it
|
||||
for (short t = loop_number; t >= 0; --t) {
|
||||
for (unsigned short j = 0; j < contours[t].size(); ++j) {
|
||||
for (signed short t = loop_number; t >= 0; --t) {
|
||||
for (signed short j = 0; j < contours[t].size(); ++j) {
|
||||
PerimeterGeneratorLoop &candidate_parent = contours[t][j];
|
||||
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
||||
candidate_parent.children.push_back(loop);
|
||||
|
@ -203,16 +203,16 @@ PerimeterGenerator::process()
|
|||
}
|
||||
|
||||
// nest contour loops
|
||||
for (short d = loop_number; d >= 1; --d) {
|
||||
for (signed short d = loop_number; d >= 1; --d) {
|
||||
PerimeterGeneratorLoops &contours_d = contours[d];
|
||||
|
||||
// loop through all contours having depth == d
|
||||
for (unsigned short i = 0; i < contours_d.size(); ++i) {
|
||||
for (signed short i = 0; i < contours_d.size(); ++i) {
|
||||
const PerimeterGeneratorLoop &loop = contours_d[i];
|
||||
|
||||
// find the contour loop that contains it
|
||||
for (short t = d-1; t >= 0; --t) {
|
||||
for (unsigned short j = 0; j < contours[t].size(); ++j) {
|
||||
for (signed short t = d-1; t >= 0; --t) {
|
||||
for (signed short j = 0; j < contours[t].size(); ++j) {
|
||||
PerimeterGeneratorLoop &candidate_parent = contours[t][j];
|
||||
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
||||
candidate_parent.children.push_back(loop);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue