mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 20:15:55 +08:00
Transfer Copy constructor of KDTreeIndirect into copy function
Reason: During Linux testing "fff_print_tests" it Fails from time to time. ASAN version cause issue inside SeamPerimeters.hpp but I am not sure why.
This commit is contained in:
parent
7c2132bdc8
commit
fc6b8a4b65
@ -38,10 +38,12 @@ public:
|
|||||||
KDTreeIndirect(CoordinateFn coordinate, std::vector<size_t> indices) : coordinate(coordinate) { this->build(indices); }
|
KDTreeIndirect(CoordinateFn coordinate, std::vector<size_t> indices) : coordinate(coordinate) { this->build(indices); }
|
||||||
KDTreeIndirect(CoordinateFn coordinate, size_t num_indices) : coordinate(coordinate) { this->build(num_indices); }
|
KDTreeIndirect(CoordinateFn coordinate, size_t num_indices) : coordinate(coordinate) { this->build(num_indices); }
|
||||||
KDTreeIndirect(KDTreeIndirect &&rhs) : m_nodes(std::move(rhs.m_nodes)), coordinate(std::move(rhs.coordinate)) {}
|
KDTreeIndirect(KDTreeIndirect &&rhs) : m_nodes(std::move(rhs.m_nodes)), coordinate(std::move(rhs.coordinate)) {}
|
||||||
KDTreeIndirect(const KDTreeIndirect &rhs) : m_nodes(rhs.m_nodes), coordinate(rhs.coordinate) {}
|
|
||||||
KDTreeIndirect& operator=(KDTreeIndirect &&rhs) { m_nodes = std::move(rhs.m_nodes); coordinate = std::move(rhs.coordinate); return *this; }
|
KDTreeIndirect& operator=(KDTreeIndirect &&rhs) { m_nodes = std::move(rhs.m_nodes); coordinate = std::move(rhs.coordinate); return *this; }
|
||||||
void clear() { m_nodes.clear(); }
|
void clear() { m_nodes.clear(); }
|
||||||
const std::vector<size_t> &get_nodes() const { return m_nodes; }
|
const std::vector<size_t> &get_nodes() const { return m_nodes; }
|
||||||
|
// NOTE: Copy constructor cause failing FDM tests but not each run only from time to time.
|
||||||
|
// KDTreeIndirect(const KDTreeIndirect &rhs) : m_nodes(rhs.m_nodes), coordinate(rhs.coordinate) {}
|
||||||
|
KDTreeIndirect get_copy() const { KDTreeIndirect copy(coordinate); copy.m_nodes = m_nodes; return copy; }
|
||||||
void build(size_t num_indices)
|
void build(size_t num_indices)
|
||||||
{
|
{
|
||||||
std::vector<size_t> indices;
|
std::vector<size_t> indices;
|
||||||
|
@ -47,6 +47,12 @@ public:
|
|||||||
explicit NearPoints(LayerSupportPoints* supports_ptr)
|
explicit NearPoints(LayerSupportPoints* supports_ptr)
|
||||||
: m_points(supports_ptr), m_tree(m_points) {}
|
: m_points(supports_ptr), m_tree(m_points) {}
|
||||||
|
|
||||||
|
NearPoints get_copy(){
|
||||||
|
NearPoints copy(m_points.m_supports_ptr);
|
||||||
|
copy.m_tree = m_tree.get_copy(); // copy tree
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove support points from KD-Tree which lay out of expolygons
|
/// Remove support points from KD-Tree which lay out of expolygons
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -199,7 +205,7 @@ NearPoints create_near_points(
|
|||||||
NearPoints near_points = (prev_part_it->next_parts.size() == 1)?
|
NearPoints near_points = (prev_part_it->next_parts.size() == 1)?
|
||||||
std::move(prev_grids[index_of_prev_part]) :
|
std::move(prev_grids[index_of_prev_part]) :
|
||||||
// Need a copy there are multiple parts above previus one
|
// Need a copy there are multiple parts above previus one
|
||||||
prev_grids[index_of_prev_part]; // copy
|
prev_grids[index_of_prev_part].get_copy(); // copy
|
||||||
|
|
||||||
// merge other grid in case of multiple previous parts
|
// merge other grid in case of multiple previous parts
|
||||||
for (size_t i = 1; i < part.prev_parts.size(); ++i) {
|
for (size_t i = 1; i < part.prev_parts.size(); ++i) {
|
||||||
@ -208,7 +214,7 @@ NearPoints create_near_points(
|
|||||||
if (prev_part_it->next_parts.size() == 1) {
|
if (prev_part_it->next_parts.size() == 1) {
|
||||||
near_points.merge(std::move(prev_grids[index_of_prev_part]));
|
near_points.merge(std::move(prev_grids[index_of_prev_part]));
|
||||||
} else { // Need a copy there are multiple parts above previus one
|
} else { // Need a copy there are multiple parts above previus one
|
||||||
NearPoints grid_ = prev_grids[index_of_prev_part]; // copy
|
NearPoints grid_ = prev_grids[index_of_prev_part].get_copy(); // copy
|
||||||
near_points.merge(std::move(grid_));
|
near_points.merge(std::move(grid_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user