Lazily generates tree guidance volumes. More...
#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Support/TreeSupport.hpp>
Classes | |
| struct | RadiusLayerPair |
| Convenience typedef for the keys to the caches. More... | |
| struct | RadiusLayerPairEquality |
| struct | RadiusLayerPairHash |
Public Member Functions | |
| TreeSupportData ()=default | |
| TreeSupportData (const PrintObject &object, coordf_t xy_distance, coordf_t radius_sample_resolution) | |
| Construct the TreeSupportData object. | |
| ~TreeSupportData () | |
| TreeSupportData (TreeSupportData &&)=delete | |
| TreeSupportData & | operator= (TreeSupportData &&)=delete |
| TreeSupportData (const TreeSupportData &)=delete | |
| TreeSupportData & | operator= (const TreeSupportData &)=delete |
| const ExPolygons & | get_collision (coordf_t radius, size_t layer_idx) const |
| Creates the areas that have to be avoided by the tree's branches. | |
| const ExPolygons & | get_avoidance (coordf_t radius, size_t layer_idx, int recursions=0) const |
| Creates the areas that have to be avoided by the tree's branches in order to reach the build plate. | |
| Polygons | get_contours (size_t layer_nr) const |
| Polygons | get_contours_with_holes (size_t layer_nr) const |
| SupportNode * | create_node (const Point position, const int distance_to_top, const int obj_layer_nr, const int support_roof_layers_below, const bool to_buildplate, SupportNode *parent, coordf_t print_z_, coordf_t height_, coordf_t dist_mm_to_top_=0, coordf_t radius_=0) |
| void | clear_nodes () |
Public Attributes | |
| std::vector< LayerHeightData > | layer_heights |
| std::vector< std::unique_ptr< SupportNode > > | contact_nodes |
| bool | is_slim = false |
| coordf_t | m_xy_distance |
| The required clearance between the model and the tree branches. | |
| double | branch_scale_factor = 1.0 |
| coordf_t | m_radius_sample_resolution |
| Sample resolution for radius values. | |
| std::vector< ExPolygons > | m_layer_outlines |
| Storage for layer outlines of the meshes. | |
| std::vector< ExPolygons > | m_layer_outlines_below |
| std::vector< double > | m_max_move_distances |
| tbb::concurrent_unordered_map< RadiusLayerPair, ExPolygons, RadiusLayerPairHash, RadiusLayerPairEquality > | m_collision_cache |
| Caches for the collision, avoidance and internal model polygons at given radius and layer indices. | |
| tbb::concurrent_unordered_map< RadiusLayerPair, ExPolygons, RadiusLayerPairHash, RadiusLayerPairEquality > | m_avoidance_cache |
| friend | TreeSupport |
Private Member Functions | |
| coordf_t | ceil_radius (coordf_t radius) const |
Round radius upwards to a multiple of m_radius_sample_resolution. | |
| const ExPolygons & | calculate_collision (const RadiusLayerPair &key) const |
Calculate the collision areas at the radius and layer indicated by key. | |
| const ExPolygons & | calculate_avoidance (const RadiusLayerPair &key) const |
Calculate the avoidance areas at the radius and layer indicated by key. | |
Private Attributes | |
| tbb::spin_mutex | m_mutex |
Lazily generates tree guidance volumes.
| struct Slic3r::TreeSupportData::RadiusLayerPair |
Convenience typedef for the keys to the caches.
| Class Members | ||
|---|---|---|
| size_t | layer_nr | |
| coordf_t | radius | |
| int | recursions | |
|
default |
Referenced by TreeSupportData(), TreeSupportData(), TreeSupportData(), operator=(), and operator=().
| Slic3r::TreeSupportData::TreeSupportData | ( | const PrintObject & | object, |
| coordf_t | xy_distance, | ||
| coordf_t | radius_sample_resolution ) |
Construct the TreeSupportData object.
| xy_distance | The required clearance between the model and the tree branches. |
| radius_sample_resolution | Sample size used to round requested node radii. |
References TreeSupportData(), branch_scale_factor, clear_nodes(), Slic3r::Layer::height, Slic3r::Layer::lslices, m_layer_outlines, m_layer_outlines_below, m_max_move_distances, M_PI, m_radius_sample_resolution, m_xy_distance, scale_, and Slic3r::union_ex().
|
inline |
|
delete |
|
delete |
|
private |
Calculate the avoidance areas at the radius and layer indicated by key.
| key | The radius and layer of the node of interest |
References get_avoidance(), get_collision(), Slic3r::TreeSupportData::RadiusLayerPair::layer_nr, m_avoidance_cache, m_max_move_distances, Slic3r::offset_ex(), Slic3r::TreeSupportData::RadiusLayerPair::radius, scale_, and Slic3r::union_ex().
Referenced by get_avoidance().
|
private |
Calculate the collision areas at the radius and layer indicated by key.
| key | The radius and layer of the node of interest |
References Slic3r::expolygons_simplify(), Slic3r::TreeSupportData::RadiusLayerPair::layer_nr, m_collision_cache, m_layer_outlines, m_radius_sample_resolution, m_xy_distance, Slic3r::offset_ex(), Slic3r::TreeSupportData::RadiusLayerPair::radius, and scale_.
Referenced by get_collision().
Round radius upwards to a multiple of m_radius_sample_resolution.
| radius | The radius of the node of interest |
References EPSILON, and m_radius_sample_resolution.
Referenced by get_avoidance(), and get_collision().
| void Slic3r::TreeSupportData::clear_nodes | ( | ) |
References contact_nodes, and m_mutex.
Referenced by TreeSupportData(), and ~TreeSupportData().
| SupportNode * Slic3r::TreeSupportData::create_node | ( | const Point | position, |
| const int | distance_to_top, | ||
| const int | obj_layer_nr, | ||
| const int | support_roof_layers_below, | ||
| const bool | to_buildplate, | ||
| SupportNode * | parent, | ||
| coordf_t | print_z_, | ||
| coordf_t | height_, | ||
| coordf_t | dist_mm_to_top_ = 0, | ||
| coordf_t | radius_ = 0 ) |
References contact_nodes, m_mutex, Slic3r::SupportNode::movement, and Slic3r::SupportNode::position.
| const ExPolygons & Slic3r::TreeSupportData::get_avoidance | ( | coordf_t | radius, |
| size_t | layer_idx, | ||
| int | recursions = 0 ) const |
Creates the areas that have to be avoided by the tree's branches in order to reach the build plate.
The result is a 2D area that would cause nodes of radius radius to collide with the model or be unable to reach the build platform.
The input collision areas are inset by the maximum move distance and propagated upwards.
| radius | The radius of the node of interest |
| layer | The layer of interest |
References calculate_avoidance(), ceil_radius(), m_avoidance_cache, Slic3r::profiler, and Slic3r::STAGE_GET_AVOIDANCE.
Referenced by calculate_avoidance().
| const ExPolygons & Slic3r::TreeSupportData::get_collision | ( | coordf_t | radius, |
| size_t | layer_idx ) const |
Creates the areas that have to be avoided by the tree's branches.
The result is a 2D area that would cause nodes of radius radius to collide with the model.
| radius | The radius of the node of interest |
| layer | The layer of interest |
References calculate_collision(), ceil_radius(), m_collision_cache, Slic3r::profiler, and Slic3r::STAGE_get_collision.
Referenced by calculate_avoidance().
| Polygons Slic3r::TreeSupportData::get_contours | ( | size_t | layer_nr | ) | const |
References m_layer_outlines.
| Polygons Slic3r::TreeSupportData::get_contours_with_holes | ( | size_t | layer_nr | ) | const |
References m_layer_outlines.
|
delete |
|
delete |
| double Slic3r::TreeSupportData::branch_scale_factor = 1.0 |
Referenced by TreeSupportData().
| std::vector<std::unique_ptr<SupportNode> > Slic3r::TreeSupportData::contact_nodes |
Referenced by clear_nodes(), and create_node().
| bool Slic3r::TreeSupportData::is_slim = false |
| std::vector<LayerHeightData> Slic3r::TreeSupportData::layer_heights |
|
mutable |
Referenced by calculate_avoidance(), and get_avoidance().
|
mutable |
Caches for the collision, avoidance and internal model polygons at given radius and layer indices.
These are mutable to allow modification from const function. This is generally considered OK as the functions are still logically const (ie there is no difference in behaviour for the user betweeen calculating the values each time vs caching the results).
coconut: previously stl::unordered_map is used which seems problematic with tbb::parallel_for. So we change to tbb::concurrent_unordered_map
Referenced by calculate_collision(), and get_collision().
| std::vector<ExPolygons> Slic3r::TreeSupportData::m_layer_outlines |
Storage for layer outlines of the meshes.
Referenced by TreeSupportData(), calculate_collision(), get_contours(), and get_contours_with_holes().
| std::vector<ExPolygons> Slic3r::TreeSupportData::m_layer_outlines_below |
Referenced by TreeSupportData().
| std::vector<double> Slic3r::TreeSupportData::m_max_move_distances |
Referenced by TreeSupportData(), and calculate_avoidance().
|
private |
Referenced by clear_nodes(), and create_node().
| coordf_t Slic3r::TreeSupportData::m_radius_sample_resolution |
Sample resolution for radius values.
The radius will be rounded (upwards) to multiples of this value before calculations are done when collision, avoidance and internal model Polygons are requested.
Referenced by TreeSupportData(), calculate_collision(), and ceil_radius().
| coordf_t Slic3r::TreeSupportData::m_xy_distance |
The required clearance between the model and the tree branches.
Referenced by TreeSupportData(), and calculate_collision().
| friend Slic3r::TreeSupportData::TreeSupport |