diff options
author | Rijk van Manen <r.vanmanen@ultimaker.com> | 2022-11-08 12:53:05 +0300 |
---|---|---|
committer | Rijk van Manen <r.vanmanen@ultimaker.com> | 2022-11-08 12:53:05 +0300 |
commit | 6e40a8d999720eed479ea0c0f67e451f52e7f9ca (patch) | |
tree | 7e730bdeb5dec7539c36c37f5e623f26ff249acc | |
parent | bd852d7f1284c1cc2bbe79339980937a662e768d (diff) | |
parent | 2d38392d50babc3cf586403dd0977e5aaf85ad64 (diff) |
Merge branch 'main' into CURA-9844_fix-disconnected-supportCURA-9844_fix-disconnected-support
-rw-r--r-- | .github/workflows/conan-package.yml | 8 | ||||
-rw-r--r-- | .github/workflows/unit-test.yml | 16 | ||||
-rw-r--r-- | include/PathOrderOptimizer.h | 51 |
3 files changed, 43 insertions, 32 deletions
diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index f95e89a3d..80e79cb57 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -78,6 +78,8 @@ jobs: uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main with: + project_name: curaengine + build_id: 3 recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} runs_on: 'macos-11' python_version: '3.10.x' @@ -90,6 +92,8 @@ jobs: uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main with: + project_name: curaengine + build_id: 4 recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} runs_on: 'windows-2022' python_version: '3.10.x' @@ -103,6 +107,8 @@ jobs: uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main with: + project_name: curaengine + build_id: 2 recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} runs_on: 'ubuntu-20.04' python_version: '3.10.x' @@ -115,6 +121,8 @@ jobs: uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main with: + project_name: curaengine + build_id: 1 recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} runs_on: 'ubuntu-22.04' python_version: '3.10.x' diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index d79bb81d4..cdc8f3031 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -75,7 +75,6 @@ jobs: - name: Install Python requirements and Create default Conan profile run: | pip install -r requirements-conan-package.txt - conan profile new default --detect working-directory: .github/workflows/ - name: Use Conan download cache (Bash) @@ -93,10 +92,21 @@ jobs: - name: Install Linux system requirements if: ${{ runner.os == 'Linux' }} - run: sudo apt install build-essential checkinstall zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev libxkbcommon-x11-dev -y + run: | + sudo apt update + sudo apt upgrade + sudo apt install build-essential checkinstall libegl-dev zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev libxkbcommon-x11-dev pkg-config -y + + - name: Use GCC-10 on ubuntu as default + if: ${{ runner.os == 'Linux' }} + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 - name: Get Conan configuration - run: conan config install https://github.com/Ultimaker/conan-config.git + run: | + conan profile new default --detect + conan config install https://github.com/Ultimaker/conan-config.git - name: Install dependencies run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -o enable_testing=True -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv diff --git a/include/PathOrderOptimizer.h b/include/PathOrderOptimizer.h index ea65bf367..f571d0fa1 100644 --- a/include/PathOrderOptimizer.h +++ b/include/PathOrderOptimizer.h @@ -524,51 +524,39 @@ protected: Point here = (*path.converted)[i % path.converted->size()]; - int previous_offset_index = i; - const std::function<Point(Point&)> find_previous_point = [previous_offset_index, path](Point& here) mutable + const int offset_index = i; + const std::function<Point(const int, const Point&)> find_neighbour_point = [&offset_index, &path](const int direction, const Point& here) { - previous_offset_index --; - Point previous = (*path.converted)[(previous_offset_index + path.converted->size()) % path.converted->size()]; - // find previous point that is at least min_edge_length units away from here - while (vSize2(here - previous) < min_edge_length2) + int offset_index_ = offset_index; + Point neighbour; + do { - previous_offset_index --; - previous = (*path.converted)[(previous_offset_index + path.converted->size()) % path.converted->size()]; + offset_index_ = (offset_index_ + path.converted->size() + direction) % path.converted->size(); + neighbour = (*path.converted)[offset_index_]; } - return previous; + while (vSize2(here - neighbour) < min_edge_length2 && offset_index_ != offset_index); // find previous point that is at least min_edge_length units away from here + return neighbour; }; - const std::function<coord_t(Point&, Point&, Point&)> iterate_to_previous_point = [&find_previous_point](Point& previous_, Point& here_, Point& next_) + + const std::function<coord_t(Point&, Point&, Point&)> iterate_to_previous_point = [&find_neighbour_point](Point& previous_, Point& here_, Point& next_) { const auto dist = vSize(here_ - next_); next_ = here_; here_ = previous_; - previous_ = find_previous_point(here_); + previous_ = find_neighbour_point(-1, here_); return dist; }; - Point previous = find_previous_point(here); + Point previous = find_neighbour_point(-1, here); - int next_offset_index = i; - const std::function<Point(Point&)> find_next_point = [next_offset_index, path](Point& here) mutable - { - next_offset_index ++; - Point next = (*path.converted)[(next_offset_index) % path.converted->size()]; - // find next point that is at least min_edge_length units away from here - while (vSize2(here - next) < min_edge_length2) - { - next_offset_index ++; - next = (*path.converted)[(next_offset_index) % path.converted->size()]; - } - return next; - }; - const std::function<coord_t(Point&, Point&, Point&)> iterate_to_next_point = [&find_next_point](Point& previous_, Point& here_, Point& next_) + const std::function<coord_t(Point&, Point&, Point&)> iterate_to_next_point = [&find_neighbour_point](Point& previous_, Point& here_, Point& next_) { const auto dist = vSize(here_ - previous_); previous_ = here_; here_ = next_; - next_ = find_next_point(here_); + next_ = find_neighbour_point(1, here_); return dist; }; - Point next = find_next_point(here); + Point next = find_neighbour_point(1, here); float corner_angle = LinearAlg2D::getAngleLeft(previous, here, next) - M_PI; @@ -577,7 +565,12 @@ protected: Point next_ = next; Point here_ = here; Point previous_ = previous; - for(coord_t distance_to_query = iterate_func(previous_, here_, next_); distance_to_query < angle_query_distance; distance_to_query += iterate_func(previous_, here_, next_)) + for + ( + coord_t distance_to_query = iterate_func(previous_, here_, next_); + distance_to_query < angle_query_distance && here_ != here; + distance_to_query += iterate_func(previous_, here_, next_) + ) { // angles further away from the query point are weighted less const float angle_weight = 1.0 - pow(distance_to_query / angle_query_distance, fall_off_strength); |