OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::TreeSupport3D::RichInterfacePlacer Class Reference
Inheritance diagram for Slic3r::TreeSupport3D::RichInterfacePlacer:
Collaboration diagram for Slic3r::TreeSupport3D::RichInterfacePlacer:

Public Member Functions

 RichInterfacePlacer (const InterfacePlacer &interface_placer, const TreeModelVolumes &volumes, bool force_tip_to_roof, size_t num_support_layers, std::vector< SupportElements > &move_bounds)
void add_points_along_lines (LineInformations lines, LayerIndex insert_layer_idx, size_t roof_tip_layers, size_t supports_roof_layers, size_t dont_move_until)
SupportGeneratorLayersPtr & top_contacts_mutable ()
void add_roofs (std::vector< Polygons > &&new_roofs, const size_t insert_layer_idx)
void add_roof (Polygons &&new_roof, const size_t insert_layer_idx, const size_t dtt_tip)
void add_roof_build_plate (Polygons &&overhang_areas, size_t dtt_roof)
void add_roof_unguarded (Polygons &&new_roofs, const size_t insert_layer_idx, const size_t dtt_roof)

Public Attributes

const TreeModelVolumes & volumes
const bool force_tip_to_roof
bool min_xy_dist
const SlicingParameters & slicing_parameters
const SupportParameters & support_parameters
const TreeSupportSettings & config

Private Member Functions

void add_point_as_influence_area (std::pair< Point, LineStatus > p, LayerIndex insert_layer, size_t dont_move_until, bool roof, size_t roof_recovery_dtt, bool skip_ovalisation)

Private Attributes

std::vector< SupportElements > & move_bounds
coord_t m_base_radius
Polygon m_base_circle
std::mutex m_mutex_movebounds
std::vector< std::unordered_set< Point, PointHash > > m_already_inserted
SupportGeneratorLayerStorage & layer_storage
SupportGeneratorLayersPtr & top_contacts
SupportGeneratorLayersPtr & top_interfaces
SupportGeneratorLayersPtr & top_base_interfaces
std::mutex m_mutex_layer_storage

Detailed Description

Constructor & Destructor Documentation

◆ RichInterfacePlacer()

Slic3r::TreeSupport3D::RichInterfacePlacer::RichInterfacePlacer ( const InterfacePlacer & interface_placer,
const TreeModelVolumes & volumes,
bool force_tip_to_roof,
size_t num_support_layers,
std::vector< SupportElements > & move_bounds )
inline
906 :
907 InterfacePlacer(interface_placer),
909 {
910 m_already_inserted.assign(num_support_layers, {});
911 this->min_xy_dist = this->config.xy_distance > this->config.xy_min_distance;
914
915 }
InterfacePlacer(const SlicingParameters &slicing_parameters, const SupportParameters &support_parameters, const TreeSupportSettings &config, SupportGeneratorLayerStorage &layer_storage, SupportGeneratorLayersPtr &top_contacts, SupportGeneratorLayersPtr &top_interfaces, SupportGeneratorLayersPtr &top_base_interfaces)
Definition TreeSupportCommon.hpp:716
const TreeSupportSettings & config
Definition TreeSupportCommon.hpp:735
Polygon m_base_circle
Definition TreeSupport3D.cpp:1057
const bool force_tip_to_roof
Definition TreeSupport3D.cpp:918
bool min_xy_dist
Definition TreeSupport3D.cpp:919
coord_t m_base_radius
Definition TreeSupport3D.cpp:1056
std::vector< SupportElements > & move_bounds
Definition TreeSupport3D.cpp:1053
const TreeModelVolumes & volumes
Definition TreeSupport3D.cpp:916
std::vector< std::unordered_set< Point, PointHash > > m_already_inserted
Definition TreeSupport3D.cpp:1061
BoundingBox scaled(const BoundingBoxf &bb)
Definition BoundingBox.hpp:284
Polygon make_circle(double radius, double error)
Definition Polygon.cpp:789
static constexpr const size_t SUPPORT_TREE_CIRCLE_RESOLUTION
Definition TreeSupportCommon.hpp:40
Slic3r::Polygon Polygon
Definition Emboss.cpp:101

References Slic3r::TreeSupport3D::InterfacePlacer::InterfacePlacer(), force_tip_to_roof, m_already_inserted, m_base_circle, m_base_radius, Slic3r::make_circle(), min_xy_dist, move_bounds, Slic3r::scaled(), Slic3r::SUPPORT_TREE_CIRCLE_RESOLUTION, volumes, Slic3r::TreeSupport3D::TreeSupportSettings::xy_distance, and Slic3r::TreeSupport3D::TreeSupportSettings::xy_min_distance.

Here is the call graph for this function:

Member Function Documentation

◆ add_point_as_influence_area()

void Slic3r::TreeSupport3D::RichInterfacePlacer::add_point_as_influence_area ( std::pair< Point, LineStatus > p,
LayerIndex insert_layer,
size_t dont_move_until,
bool roof,
size_t roof_recovery_dtt,
bool skip_ovalisation )
inlineprivate
1010 {
1011 bool to_bp = p.second == LineStatus::TO_BP || p.second == LineStatus::TO_BP_SAFE;
1012 bool gracious = to_bp || p.second == LineStatus::TO_MODEL_GRACIOUS || p.second == LineStatus::TO_MODEL_GRACIOUS_SAFE;
1013 bool safe_radius = p.second == LineStatus::TO_BP_SAFE || p.second == LineStatus::TO_MODEL_GRACIOUS_SAFE;
1014 if (! config.support_rests_on_model && ! to_bp) {
1015 BOOST_LOG_TRIVIAL(warning) << "Tried to add an invalid support point";
1016 tree_supports_show_error("Unable to add tip. Some overhang may not be supported correctly."sv, true);
1017 return;
1018 }
1019 Polygons circle{ m_base_circle };
1020 circle.front().translate(p.first);
1021 {
1022 Point hash_pos = p.first / ((config.min_radius + 1) / 10);
1023 std::lock_guard<std::mutex> critical_section_movebounds(m_mutex_movebounds);
1024 if (!m_already_inserted[insert_layer].count(hash_pos)) {
1025 // normalize the point a bit to also catch points which are so close that inserting it would achieve nothing
1026 m_already_inserted[insert_layer].emplace(hash_pos);
1027 static constexpr const size_t dtt = 0;
1028 SupportElementState state;
1029 state.target_height = insert_layer;
1030 state.target_position = p.first;
1031 state.next_position = p.first;
1032 state.layer_idx = insert_layer;
1033 state.effective_radius_height = dtt;
1034 state.to_buildplate = to_bp;
1035 state.distance_to_top = dtt;
1036 state.result_on_layer = p.first;
1037 assert(state.result_on_layer_is_set());
1038 state.increased_to_model_radius = 0;
1039 state.to_model_gracious = gracious;
1040 state.elephant_foot_increases = 0;
1041 state.use_min_xy_dist = min_xy_dist;
1042 state.supports_roof = roof;
1043 state.dont_move_until = dont_move_until;
1044 state.can_use_safe_radius = safe_radius;
1045 state.set_pending_roof_recovery(force_tip_to_roof ? dont_move_until : 0, roof_recovery_dtt);
1046 state.skip_ovalisation = skip_ovalisation;
1047 move_bounds[insert_layer].emplace_back(state, std::move(circle));
1048 }
1049 }
1050 }
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
std::mutex m_mutex_movebounds
Definition TreeSupport3D.cpp:1060
void tree_supports_show_error(std::string_view message, bool critical)
Definition TreeSupportCommon.hpp:611
@ TO_BP
Definition TreeSupportCommon.hpp:801
@ TO_BP_SAFE
Definition TreeSupportCommon.hpp:802
@ TO_MODEL_GRACIOUS_SAFE
Definition TreeSupportCommon.hpp:800
@ TO_MODEL_GRACIOUS
Definition TreeSupportCommon.hpp:799
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
std::vector< Polygon, PointsAllocator< Polygon > > Polygons
Definition Polygon.hpp:22

References Slic3r::TreeSupport3D::SupportElementStateBits::can_use_safe_radius, Slic3r::TreeSupport3D::InterfacePlacer::config, count, Slic3r::TreeSupport3D::SupportElementState::distance_to_top, Slic3r::TreeSupport3D::SupportElementState::dont_move_until, Slic3r::TreeSupport3D::SupportElementState::effective_radius_height, Slic3r::TreeSupport3D::SupportElementState::elephant_foot_increases, force_tip_to_roof, Slic3r::TreeSupport3D::SupportElementState::increased_to_model_radius, Slic3r::TreeSupport3D::SupportElementState::layer_idx, m_already_inserted, m_base_circle, m_mutex_movebounds, min_xy_dist, move_bounds, Slic3r::TreeSupport3D::SupportElementState::next_position, Slic3r::TreeSupport3D::SupportElementState::result_on_layer, Slic3r::TreeSupport3D::SupportElementState::result_on_layer_is_set(), Slic3r::TreeSupport3D::SupportElementState::set_pending_roof_recovery(), Slic3r::TreeSupport3D::SupportElementStateBits::skip_ovalisation, Slic3r::TreeSupport3D::SupportElementStateBits::supports_roof, Slic3r::TreeSupport3D::SupportElementState::target_height, Slic3r::TreeSupport3D::SupportElementState::target_position, Slic3r::TreeSupport3D::TO_BP, Slic3r::TreeSupport3D::TO_BP_SAFE, Slic3r::TreeSupport3D::SupportElementStateBits::to_buildplate, Slic3r::TreeSupport3D::TO_MODEL_GRACIOUS, Slic3r::TreeSupport3D::SupportElementStateBits::to_model_gracious, Slic3r::TreeSupport3D::TO_MODEL_GRACIOUS_SAFE, Slic3r::TreeSupport3D::tree_supports_show_error(), and Slic3r::TreeSupport3D::SupportElementStateBits::use_min_xy_dist.

Referenced by add_points_along_lines().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_points_along_lines()

void Slic3r::TreeSupport3D::RichInterfacePlacer::add_points_along_lines ( LineInformations lines,
LayerIndex insert_layer_idx,
size_t roof_tip_layers,
size_t supports_roof_layers,
size_t dont_move_until )
inline
934 {
935 validate_range(lines);
936 // Add tip area as roof (happens when minimum roof area > minimum tip area) if possible
937 size_t dtt_roof_tip;
938 for (dtt_roof_tip = 0; dtt_roof_tip < roof_tip_layers && insert_layer_idx - dtt_roof_tip >= 1; ++ dtt_roof_tip) {
939 size_t this_layer_idx = insert_layer_idx - dtt_roof_tip;
940 const size_t roof_recovery_depth = dtt_roof_tip + supports_roof_layers;
941 auto evaluateRoofWillGenerate = [&](const std::pair<Point, LineStatus> &p) {
942 //FIXME Vojtech: The circle is just shifted, it has a known size, the infill should fit all the time!
943 #if 0
944 Polygon roof_circle;
945 for (Point corner : base_circle)
946 roof_circle.points.emplace_back(p.first + corner * config.min_radius);
947 return !generate_support_infill_lines({ roof_circle }, config, true, insert_layer_idx - dtt_roof_tip, config.support_roof_line_distance).empty();
948 #else
949 return true;
950 #endif
951 };
952
953 {
954 std::pair<LineInformations, LineInformations> split =
955 // keep all lines that are still valid on the next layer
956 split_lines(lines, [this, this_layer_idx](const std::pair<Point, LineStatus> &p)
957 { return evaluate_point_for_next_layer_function(volumes, config, this_layer_idx, p); });
958 LineInformations points = std::move(split.second);
959 // Not all roofs are guaranteed to actually generate lines, so filter these out and add them as points.
960 split = split_lines(split.first, evaluateRoofWillGenerate);
961 lines = std::move(split.first);
962 append(points, split.second);
963 // add all points that would not be valid
964 for (const LineInformation &line : points)
965 for (const std::pair<Point, LineStatus> &point_data : line)
966 add_point_as_influence_area(point_data, this_layer_idx,
967 // don't move until
968 roof_tip_layers - dtt_roof_tip,
969 // supports roof
970 roof_recovery_depth > 0,
971 // recovered roof/contact depth for this slice
972 roof_recovery_depth,
973 // disable ovalization
974 false);
975 }
976
977 // add all tips as roof to the roof storage
978 Polygons new_roofs;
979 for (const LineInformation &line : lines)
980 //FIXME sweep the tip radius along the line?
981 for (const std::pair<Point, LineStatus> &p : line) {
982 Polygon roof_circle{ m_base_circle };
983 roof_circle.scale(config.min_radius / m_base_radius);
984 roof_circle.translate(p.first);
985 new_roofs.emplace_back(std::move(roof_circle));
986 }
987 this->add_roof(std::move(new_roofs), this_layer_idx, roof_recovery_depth);
988 }
989
990 const size_t roof_recovery_depth = dtt_roof_tip + supports_roof_layers;
991 for (const LineInformation &line : lines) {
992 // If a line consists of enough tips, the assumption is that it is not a single tip, but part of a simulated support pattern.
993 // Ovalisation should be disabled for these to improve the quality of the lines when tip_diameter=line_width
994 bool disable_ovalistation = config.min_radius < 3 * config.support_line_width && roof_tip_layers == 0 && dtt_roof_tip == 0 && line.size() > 5;
995 for (const std::pair<Point, LineStatus> &point_data : line)
996 add_point_as_influence_area(point_data, insert_layer_idx - dtt_roof_tip,
997 // don't move until
998 dont_move_until > dtt_roof_tip ? dont_move_until - dtt_roof_tip : 0,
999 // supports roof
1000 roof_recovery_depth > 0,
1001 // recovered roof/contact depth for this slice
1002 roof_recovery_depth,
1003 disable_ovalistation);
1004 }
1005 }
Points points
Definition MultiPoint.hpp:22
void scale(double factor)
Definition MultiPoint.cpp:17
void add_roof(Polygons &&new_roof, const size_t insert_layer_idx, const size_t dtt_tip)
Definition TreeSupportCommon.hpp:750
void add_point_as_influence_area(std::pair< Point, LineStatus > p, LayerIndex insert_layer, size_t dont_move_until, bool roof, size_t roof_recovery_dtt, bool skip_ovalisation)
Definition TreeSupport3D.cpp:1009
static Polylines generate_support_infill_lines(const Polygons &polygon, const SupportParameters &support_params, bool roof, LayerIndex layer_idx, coord_t support_infill_distance)
Returns Polylines representing the (infill) lines that will result in slicing the given area.
Definition TreeSupport3D.cpp:703
std::vector< std::pair< Point, LineStatus > > LineInformation
Definition TreeSupport3D.cpp:99
std::vector< LineInformation > LineInformations
Definition TreeSupport3D.cpp:100
static std::pair< LineInformations, LineInformations > split_lines(const LineInformations &lines, EvaluatePointFn evaluatePoint)
Evaluates which points of some lines are not valid one layer below and which are. Assumes all points ...
Definition TreeSupport3D.cpp:517
static void validate_range(const Point &pt)
Definition TreeSupport3D.cpp:103
static bool evaluate_point_for_next_layer_function(const TreeModelVolumes &volumes, const TreeSupportSettings &config, size_t current_layer, const std::pair< Point, LineStatus > &p)
Evaluates if a point has to be added now. Required for a split_lines call in generate_initial_areas()...
Definition TreeSupport3D.cpp:492
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:157
bool empty(const BoundingBoxBase< PointType, PointsType > &bb)
Definition BoundingBox.hpp:273

References add_point_as_influence_area(), Slic3r::TreeSupport3D::InterfacePlacer::add_roof(), Slic3r::append(), Slic3r::TreeSupport3D::InterfacePlacer::config, Slic3r::empty(), Slic3r::TreeSupport3D::evaluate_point_for_next_layer_function(), Slic3r::TreeSupport3D::generate_support_infill_lines(), m_base_circle, m_base_radius, Slic3r::MultiPoint::points, Slic3r::MultiPoint::scale(), Slic3r::TreeSupport3D::split_lines(), Slic3r::MultiPoint::translate(), Slic3r::TreeSupport3D::validate_range(), and volumes.

Referenced by Slic3r::TreeSupport3D::sample_overhang_area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_roof()

void Slic3r::TreeSupport3D::InterfacePlacer::add_roof ( Polygons && new_roof,
const size_t insert_layer_idx,
const size_t dtt_tip )
inlineinherited
751 {
752 std::lock_guard<std::mutex> lock(m_mutex_layer_storage);
753 add_roof_unguarded(std::move(new_roof), insert_layer_idx, dtt_tip);
754 }
void add_roof_unguarded(Polygons &&new_roofs, const size_t insert_layer_idx, const size_t dtt_roof)
Definition TreeSupportCommon.hpp:763
std::mutex m_mutex_layer_storage
Definition TreeSupportCommon.hpp:792
@ lock
Definition GLGizmoEmboss.cpp:209

References add_roof_unguarded(), and m_mutex_layer_storage.

Referenced by Slic3r::TreeSupport3D::RichInterfacePlacer::add_points_along_lines(), and Slic3r::TreeSupport3D::recover_pending_branch_roofs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_roof_build_plate()

void Slic3r::TreeSupport3D::InterfacePlacer::add_roof_build_plate ( Polygons && overhang_areas,
size_t dtt_roof )
inlineinherited
758 {
759 std::lock_guard<std::mutex> lock(m_mutex_layer_storage);
760 this->add_roof_unguarded(std::move(overhang_areas), 0, std::min(dtt_roof, this->support_parameters.num_top_interface_layers));
761 }
const SupportParameters & support_parameters
Definition TreeSupportCommon.hpp:734

References add_roof_unguarded(), m_mutex_layer_storage, and Slic3r::SupportParameters::num_top_interface_layers.

Referenced by Slic3r::TreeSupport3D::sample_overhang_area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_roof_unguarded()

void Slic3r::TreeSupport3D::InterfacePlacer::add_roof_unguarded ( Polygons && new_roofs,
const size_t insert_layer_idx,
const size_t dtt_roof )
inlineinherited
764 {
765 assert(support_parameters.has_top_contacts);
766 assert(dtt_roof <= support_parameters.num_top_interface_layers);
767 // ORCA: Reserve one top interface layer but only when top base-interface layers exist.
768 // This prevents all interface layers from being classified as base-interface layers
769 // and preserves correct top contact and interface behavior.
770 size_t interface_threshold = support_parameters.num_top_interface_layers_only();
771 if (interface_threshold > 0 && support_parameters.num_top_base_interface_layers > 0)
772 --interface_threshold;
774 dtt_roof == 0 ? this->top_contacts :
775 dtt_roof <= interface_threshold ? this->top_interfaces : this->top_base_interfaces;
776 SupportGeneratorLayer*& l = layers[insert_layer_idx];
777 if (l == nullptr)
779 slicing_parameters, config, insert_layer_idx);
780 // will be unioned in finalize_interface_and_support_areas()
781 append(l->polygons, std::move(new_roofs));
782 }
const SlicingParameters & slicing_parameters
Definition TreeSupportCommon.hpp:733
SupportGeneratorLayersPtr & top_interfaces
Definition TreeSupportCommon.hpp:788
SupportGeneratorLayersPtr & top_contacts
Definition TreeSupportCommon.hpp:787
SupportGeneratorLayerStorage & layer_storage
Definition TreeSupportCommon.hpp:786
SupportGeneratorLayersPtr & top_base_interfaces
Definition TreeSupportCommon.hpp:789
SupportGeneratorLayer & layer_allocate_unguarded(SupportGeneratorLayerStorage &layer_storage, SupporLayerType layer_type, const SlicingParameters &slicing_params, const TreeSupportSettings &config, size_t layer_idx)
Definition TreeSupportCommon.hpp:691
@ TopInterface
Definition SupportLayer.hpp:34
@ TopContact
Definition SupportLayer.hpp:36
std::vector< SupportGeneratorLayer * > SupportGeneratorLayersPtr
Definition SupportLayer.hpp:146

References Slic3r::append(), config, Slic3r::TreeSupport3D::layer_allocate_unguarded(), layer_storage, Slic3r::SupportGeneratorLayer::polygons, slicing_parameters, support_parameters, top_base_interfaces, top_contacts, top_interfaces, Slic3r::TopContact, and Slic3r::TopInterface.

Referenced by add_roof(), add_roof_build_plate(), add_roofs(), and Slic3r::TreeSupport3D::generate_raft_contact().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_roofs()

void Slic3r::TreeSupport3D::InterfacePlacer::add_roofs ( std::vector< Polygons > && new_roofs,
const size_t insert_layer_idx )
inlineinherited
741 {
742 if (! new_roofs.empty()) {
743 std::lock_guard<std::mutex> lock(m_mutex_layer_storage);
744 for (size_t idx = 0; idx < new_roofs.size(); ++ idx)
745 if (! new_roofs[idx].empty())
746 add_roof_unguarded(std::move(new_roofs[idx]), insert_layer_idx - idx, idx);
747 }
748 }

References add_roof_unguarded(), Slic3r::empty(), and m_mutex_layer_storage.

Referenced by Slic3r::TreeSupport3D::sample_overhang_area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ top_contacts_mutable()

SupportGeneratorLayersPtr & Slic3r::TreeSupport3D::InterfacePlacer::top_contacts_mutable ( )
inlineinherited
736{ return this->top_contacts; }

References top_contacts.

Member Data Documentation

◆ config

◆ force_tip_to_roof

const bool Slic3r::TreeSupport3D::RichInterfacePlacer::force_tip_to_roof

◆ layer_storage

SupportGeneratorLayerStorage& Slic3r::TreeSupport3D::InterfacePlacer::layer_storage
privateinherited

◆ m_already_inserted

std::vector<std::unordered_set<Point, PointHash> > Slic3r::TreeSupport3D::RichInterfacePlacer::m_already_inserted
private

◆ m_base_circle

Polygon Slic3r::TreeSupport3D::RichInterfacePlacer::m_base_circle
private

◆ m_base_radius

coord_t Slic3r::TreeSupport3D::RichInterfacePlacer::m_base_radius
private

◆ m_mutex_layer_storage

std::mutex Slic3r::TreeSupport3D::InterfacePlacer::m_mutex_layer_storage
privateinherited

◆ m_mutex_movebounds

std::mutex Slic3r::TreeSupport3D::RichInterfacePlacer::m_mutex_movebounds
private

◆ min_xy_dist

bool Slic3r::TreeSupport3D::RichInterfacePlacer::min_xy_dist

◆ move_bounds

std::vector<SupportElements>& Slic3r::TreeSupport3D::RichInterfacePlacer::move_bounds
private

◆ slicing_parameters

const SlicingParameters& Slic3r::TreeSupport3D::InterfacePlacer::slicing_parameters
inherited

◆ support_parameters

◆ top_base_interfaces

SupportGeneratorLayersPtr& Slic3r::TreeSupport3D::InterfacePlacer::top_base_interfaces
privateinherited

◆ top_contacts

SupportGeneratorLayersPtr& Slic3r::TreeSupport3D::InterfacePlacer::top_contacts
privateinherited

◆ top_interfaces

SupportGeneratorLayersPtr& Slic3r::TreeSupport3D::InterfacePlacer::top_interfaces
privateinherited

◆ volumes

const TreeModelVolumes& Slic3r::TreeSupport3D::RichInterfacePlacer::volumes

The documentation for this class was generated from the following file: