mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 05:39:09 +08:00
Improved const-correctness, removed extra includes
This commit is contained in:
parent
86812fa5dd
commit
6b94d25cc2
@ -3,7 +3,6 @@
|
|||||||
///|/
|
///|/
|
||||||
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
||||||
///|/
|
///|/
|
||||||
#include "libslic3r.h"
|
|
||||||
#include "ConflictChecker.hpp"
|
#include "ConflictChecker.hpp"
|
||||||
|
|
||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
@ -255,14 +254,14 @@ ExtrusionPaths getExtrusionPathsFromLayer(LayerRegionPtrs layerRegionPtrs)
|
|||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtrusionPaths getExtrusionPathsFromSupportLayer(SupportLayer *supportLayer)
|
ExtrusionPaths getExtrusionPathsFromSupportLayer(const SupportLayer *supportLayer)
|
||||||
{
|
{
|
||||||
ExtrusionPaths paths;
|
ExtrusionPaths paths;
|
||||||
getExtrusionPathsFromEntity(&supportLayer->support_fills, paths);
|
getExtrusionPathsFromEntity(&supportLayer->support_fills, paths);
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::vector<ExtrusionPaths>, std::vector<ExtrusionPaths>> getAllLayersExtrusionPathsFromObject(PrintObject *obj)
|
std::pair<std::vector<ExtrusionPaths>, std::vector<ExtrusionPaths>> getAllLayersExtrusionPathsFromObject(const PrintObject *obj)
|
||||||
{
|
{
|
||||||
std::vector<ExtrusionPaths> objPaths, supportPaths;
|
std::vector<ExtrusionPaths> objPaths, supportPaths;
|
||||||
|
|
||||||
@ -293,7 +292,7 @@ ConflictComputeOpt ConflictChecker::find_inter_of_lines(const LineWithIDs &lines
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ConflictResultOpt ConflictChecker::find_inter_of_lines_in_diff_objs(PrintObjectPtrs objs,
|
ConflictResultOpt ConflictChecker::find_inter_of_lines_in_diff_objs(SpanOfConstPtrs<PrintObject> objs,
|
||||||
const WipeTowerData& wipe_tower_data) // find the first intersection point of lines in different objects
|
const WipeTowerData& wipe_tower_data) // find the first intersection point of lines in different objects
|
||||||
{
|
{
|
||||||
if (objs.empty() || (objs.size() == 1 && objs.front()->instances().size() == 1)) { return {}; }
|
if (objs.empty() || (objs.size() == 1 && objs.front()->instances().size() == 1)) { return {}; }
|
||||||
@ -309,7 +308,7 @@ ConflictResultOpt ConflictChecker::find_inter_of_lines_in_diff_objs(PrintObjectP
|
|||||||
std::vector<ExtrusionPaths> wtpaths = getFakeExtrusionPathsFromWipeTower(wipe_tower_data);
|
std::vector<ExtrusionPaths> wtpaths = getFakeExtrusionPathsFromWipeTower(wipe_tower_data);
|
||||||
conflictQueue.emplace_back_bucket(std::move(wtpaths), &wtptr, Points{Point(plate_origin)});
|
conflictQueue.emplace_back_bucket(std::move(wtpaths), &wtptr, Points{Point(plate_origin)});
|
||||||
}
|
}
|
||||||
for (PrintObject *obj : objs) {
|
for (const PrintObject *obj : objs) {
|
||||||
std::pair<std::vector<ExtrusionPaths>, std::vector<ExtrusionPaths>> layers = getAllLayersExtrusionPathsFromObject(obj);
|
std::pair<std::vector<ExtrusionPaths>, std::vector<ExtrusionPaths>> layers = getAllLayersExtrusionPathsFromObject(obj);
|
||||||
|
|
||||||
Points instances_shifts;
|
Points instances_shifts;
|
||||||
|
@ -6,10 +6,7 @@
|
|||||||
#ifndef slic3r_ConflictChecker_hpp_
|
#ifndef slic3r_ConflictChecker_hpp_
|
||||||
#define slic3r_ConflictChecker_hpp_
|
#define slic3r_ConflictChecker_hpp_
|
||||||
|
|
||||||
#include "../Utils.hpp"
|
#include "libslic3r/Print.hpp"
|
||||||
#include "../Model.hpp"
|
|
||||||
#include "../Print.hpp"
|
|
||||||
#include "../Layer.hpp"
|
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -124,7 +121,7 @@ using ConflictObjName = std::optional<std::pair<std::string, std::string>>;
|
|||||||
|
|
||||||
struct ConflictChecker
|
struct ConflictChecker
|
||||||
{
|
{
|
||||||
static ConflictResultOpt find_inter_of_lines_in_diff_objs(PrintObjectPtrs objs, const WipeTowerData& wtd);
|
static ConflictResultOpt find_inter_of_lines_in_diff_objs(SpanOfConstPtrs<PrintObject> objs, const WipeTowerData& wtd);
|
||||||
static ConflictComputeOpt find_inter_of_lines(const LineWithIDs &lines);
|
static ConflictComputeOpt find_inter_of_lines(const LineWithIDs &lines);
|
||||||
static ConflictComputeOpt line_intersect(const LineWithID &l1, const LineWithID &l2);
|
static ConflictComputeOpt line_intersect(const LineWithID &l1, const LineWithID &l2);
|
||||||
};
|
};
|
||||||
|
@ -1013,11 +1013,11 @@ void Print::process()
|
|||||||
|
|
||||||
if (this->has_wipe_tower()) {
|
if (this->has_wipe_tower()) {
|
||||||
// These values have to be updated here, not during wipe tower generation.
|
// These values have to be updated here, not during wipe tower generation.
|
||||||
// When the wipe tower is moved, it is not regenerated.
|
// When the wipe tower is moved/rotated, it is not regenerated.
|
||||||
m_wipe_tower_data.position = { m_config.wipe_tower_x, m_config.wipe_tower_y };
|
m_wipe_tower_data.position = { m_config.wipe_tower_x, m_config.wipe_tower_y };
|
||||||
m_wipe_tower_data.rotation_angle = m_config.wipe_tower_rotation_angle;
|
m_wipe_tower_data.rotation_angle = m_config.wipe_tower_rotation_angle;
|
||||||
}
|
}
|
||||||
auto conflictRes = ConflictChecker::find_inter_of_lines_in_diff_objs(m_objects, m_wipe_tower_data);
|
auto conflictRes = ConflictChecker::find_inter_of_lines_in_diff_objs(objects(), m_wipe_tower_data);
|
||||||
|
|
||||||
m_conflict_result = conflictRes;
|
m_conflict_result = conflictRes;
|
||||||
if (conflictRes.has_value())
|
if (conflictRes.has_value())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user