WIP TreeSupports: Replaced cura namespace with Slic3r,

removed Cura includes.
This commit is contained in:
Vojtech Bubnik 2022-07-19 11:10:17 +02:00
parent 4c41311df3
commit f6ae93366a
4 changed files with 23 additions and 46 deletions

View File

@ -6,13 +6,10 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2021 Ultimaker B.V.
// CuraEngine is released under the terms of the AGPLv3 or higher. // CuraEngine is released under the terms of the AGPLv3 or higher.
#include "TreeModelVolumes.h" #include "TreeModelVolumes.hpp"
#include "TreeSupport.h" #include "TreeSupport.hpp"
#include "progress/Progress.h"
#include "sliceDataStorage.h" namespace Slic3r
#include "utils/algorithm.h"
#include "utils/logoutput.h"
namespace cura
{ {
TreeModelVolumes::TreeModelVolumes(const SliceDataStorage& storage, const coord_t max_move, const coord_t max_move_slow, size_t current_mesh_idx, double progress_multiplier, double progress_offset, const std::vector<Polygons>& additional_excluded_areas) : max_move_{ std::max(max_move - 2, coord_t(0)) }, max_move_slow_{ std::max(max_move_slow - 2, coord_t(0)) }, progress_multiplier{ progress_multiplier }, progress_offset{ progress_offset }, machine_border_{ calculateMachineBorderCollision(storage.getMachineBorder()) } // -2 to avoid rounding errors TreeModelVolumes::TreeModelVolumes(const SliceDataStorage& storage, const coord_t max_move, const coord_t max_move_slow, size_t current_mesh_idx, double progress_multiplier, double progress_offset, const std::vector<Polygons>& additional_excluded_areas) : max_move_{ std::max(max_move - 2, coord_t(0)) }, max_move_slow_{ std::max(max_move_slow - 2, coord_t(0)) }, progress_multiplier{ progress_multiplier }, progress_offset{ progress_offset }, machine_border_{ calculateMachineBorderCollision(storage.getMachineBorder()) } // -2 to avoid rounding errors

View File

@ -6,20 +6,14 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2021 Ultimaker B.V.
// CuraEngine is released under the terms of the AGPLv3 or higher. // CuraEngine is released under the terms of the AGPLv3 or higher.
#ifndef TREEMODELVOLUMES_H #ifndef slic3r_TreeModelVolumes_hpp
#define TREEMODELVOLUMES_H #define slic3r_TreeModelVolumes_hpp
#include <future>
#include <mutex> #include <mutex>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include "settings/EnumSettings.h" //To store whether X/Y or Z distance gets priority. namespace Slic3r
#include "settings/types/LayerIndex.h" //Part of the RadiusLayerPair.
#include "sliceDataStorage.h"
#include "utils/polygon.h" //For polygon parameters.
namespace cura
{ {
class TreeModelVolumes class TreeModelVolumes
@ -432,4 +426,4 @@ class TreeModelVolumes
} }
#endif //TREEMODELVOLUMES_H #endif //slic3r_TreeModelVolumes_hpp

View File

@ -6,26 +6,16 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2021 Ultimaker B.V.
// CuraEngine is released under the terms of the AGPLv3 or higher. // CuraEngine is released under the terms of the AGPLv3 or higher.
#include "TreeSupport.h" #include "TreeSupport.hpp"
#include "Application.h" //To get settings.
#include "infill.h"
#include "infill/SierpinskiFillProvider.h"
#include "progress/Progress.h"
#include "settings/EnumSettings.h"
#include "support.h" //For precomputeCrossInfillTree
#include "utils/logoutput.h"
#include "utils/math.h" //For round_up_divide and PI.
#include "utils/polygonUtils.h" //For moveInside.
#include <chrono> #include <chrono>
#include <fstream> #include <fstream>
#include <optional> #include <optional>
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include <thread>
#include <utils/algorithm.h>
#include <windows.h> //todo Remove! ONLY FOR PUBLIC BETA!! #include <windows.h> //todo Remove! ONLY FOR PUBLIC BETA!!
namespace cura namespace Slic3r
{ {
TreeSupport::TreeSupport(const SliceDataStorage& storage) TreeSupport::TreeSupport(const SliceDataStorage& storage)
@ -2279,7 +2269,7 @@ void TreeSupport::smoothBranchAreas(std::vector<std::unordered_map<SupportElemen
}); });
updated_last_iteration.clear(); updated_last_iteration.clear();
for (std::pair<cura::TreeSupport::SupportElement*, Polygons> data_pair : update_next) for (std::pair<Slic3r::TreeSupport::SupportElement*, Polygons> data_pair : update_next)
{ {
if (data_pair.first != nullptr) if (data_pair.first != nullptr)
{ {
@ -2486,4 +2476,4 @@ void TreeSupport::drawAreas(std::vector<std::set<SupportElement*>>& move_bounds,
} // namespace cura } // namespace Slic3r

View File

@ -6,15 +6,11 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2021 Ultimaker B.V.
// CuraEngine is released under the terms of the AGPLv3 or higher. // CuraEngine is released under the terms of the AGPLv3 or higher.
#ifndef TREESUPPORT_H #ifndef slic3r_TreeSupport_hpp
#define TREESUPPORT_H #define slic3r_TreeSupport_hpp
#include "TreeModelVolumes.h" #include "TreeModelVolumes.hpp"
#include "boost/functional/hash.hpp" // For combining hashes #include <boost/functional/hash.hpp> // For combining hashes
#include "polyclipping/clipper.hpp"
#include "settings/EnumSettings.h"
#include "sliceDataStorage.h"
#include "utils/polygon.h"
#define SUPPORT_TREE_CIRCLE_RESOLUTION 25 // The number of vertices in each circle. #define SUPPORT_TREE_CIRCLE_RESOLUTION 25 // The number of vertices in each circle.
@ -42,7 +38,7 @@
#define SUPPORT_TREE_MAX_DEVIATION 0 #define SUPPORT_TREE_MAX_DEVIATION 0
namespace cura namespace Slic3r
{ {
@ -1015,20 +1011,20 @@ class TreeSupport
}; };
} // namespace cura } // namespace Slic3r
namespace std namespace std
{ {
template <> template <>
struct hash<cura::TreeSupport::SupportElement> struct hash<Slic3r::TreeSupport::SupportElement>
{ {
size_t operator()(const cura::TreeSupport::SupportElement& node) const size_t operator()(const Slic3r::TreeSupport::SupportElement& node) const
{ {
size_t hash_node = hash<cura::Point>()(node.target_position); size_t hash_node = hash<Slic3r::Point>()(node.target_position);
boost::hash_combine(hash_node, size_t(node.target_height)); boost::hash_combine(hash_node, size_t(node.target_height));
return hash_node; return hash_node;
} }
}; };
} // namespace std } // namespace std
#endif /* TREESUPPORT_H */ #endif /* slic3r_TreeSupport_hpp */