Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/CuraEngine.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjspijker <j.spijker@ultimaker.com>2022-11-07 19:09:53 +0300
committerjspijker <j.spijker@ultimaker.com>2022-11-07 19:09:53 +0300
commitbd589e6ca3adf815474096a1a5b2d5edd498ba7e (patch)
treead392120344b9bf486902a7f16f9e232c304f4d7
parent7d24d684c0aef7a2916bc6d4890e02f76958a595 (diff)
parent2d38392d50babc3cf586403dd0977e5aaf85ad64 (diff)
Merge branch 'main' into CURA-9486_Hide_Seam_is_printed_more_randomly_CURA-9486_Hide_Seam_is_printed_more_randomly_
-rw-r--r--.github/workflows/unit-test.yml14
-rw-r--r--include/PathOrderOptimizer.h51
2 files changed, 29 insertions, 36 deletions
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
index acaa8ab23..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)
@@ -94,19 +93,20 @@ jobs:
- name: Install Linux system requirements
if: ${{ runner.os == 'Linux' }}
run: |
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
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: Install GCC-12 on ubuntu
+ - name: Use GCC-10 on ubuntu as default
if: ${{ runner.os == 'Linux' }}
run: |
- sudo apt install g++-12 gcc-12 -y
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
+ 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 8df78b647..ea95c14ee 100644
--- a/include/PathOrderOptimizer.h
+++ b/include/PathOrderOptimizer.h
@@ -528,51 +528,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;
@@ -581,7 +569,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);