diff --git a/src/libslic3r/EmbossShape.hpp b/src/libslic3r/EmbossShape.hpp index 9094d2ad5d..3e65120097 100644 --- a/src/libslic3r/EmbossShape.hpp +++ b/src/libslic3r/EmbossShape.hpp @@ -105,7 +105,6 @@ struct EmbossShape // Note: image is only cache it is not neccessary to store // Store file data as plain string - assert(file_data != nullptr); ar(path, path_in_3mf, (file_data != nullptr) ? *file_data : std::string("")); } template void load(Archive &ar) { diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 02586fbcb2..a6051296ff 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -475,7 +475,7 @@ static ClipperLib_Z::Paths clip_extrusion(const ClipperLib_Z::Path& subject, con end = e2top; } - assert(start.z() > 0 && end.z() > 0); + assert(start.z() >= 0 && end.z() >= 0); // Interpolate extrusion line width. double length_sqr = (end - start).cast().squaredNorm(); @@ -832,6 +832,8 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p if (extrusion->is_closed) { ExtrusionLoop extrusion_loop(std::move(paths), pg_extrusion.is_contour ? elrDefault : elrHole); extrusion_loop.make_counter_clockwise(); + // TODO: it seems in practice that ExtrusionLoops occasionally have significantly disconnected paths, + // triggering the asserts below. Is this a problem? for (auto it = std::next(extrusion_loop.paths.begin()); it != extrusion_loop.paths.end(); ++it) { assert(it->polyline.points.size() >= 2); assert(std::prev(it)->polyline.last_point() == it->polyline.first_point()); @@ -843,12 +845,11 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p else { // Because we are processing one ExtrusionLine all ExtrusionPaths should form one connected path. // But there is possibility that due to numerical issue there is poss - assert([&paths = std::as_const(paths)]() -> bool { - for (auto it = std::next(paths.begin()); it != paths.end(); ++it) - if (std::prev(it)->polyline.last_point() != it->polyline.first_point()) - return false; - return true; - }()); + // TODO: do we need some tolerance for disconnected paths below? + for (auto it = std::next(paths.begin()); it != paths.end(); ++it) { + assert(it->polyline.points.size() >= 2); + assert(std::prev(it)->polyline.last_point() == it->polyline.first_point()); + } ExtrusionMultiPath multi_path; multi_path.paths.emplace_back(std::move(paths.front())); diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index 8f6936ab8a..24970e1347 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -138,12 +138,6 @@ static std::vector>> group_me // as different settings in the same group may only occur in the tip, which uses the original settings objects from the meshes. for (size_t object_id : print_object_ids) { const PrintObject &print_object = *print.get_object(object_id); -#ifndef NDEBUG - const PrintObjectConfig &object_config = print_object.config(); -#endif // NDEBUG - // Support must be enabled and set to Tree style. - assert(object_config.enable_support || object_config.enforce_support_layers > 0); - assert(object_config.support_type == stTree || object_config.support_style == smsOrganic); bool found_existing_group = false; TreeSupportSettings next_settings{ TreeSupportMeshGroupSettings{ print_object }, print_object.slicing_parameters() }; @@ -3537,11 +3531,10 @@ static void generate_support_areas(Print &print, const BuildVolume &build_volume if (print_object.config().support_style.value != smsOrganic && // Orca: use organic as default - print_object.config().support_style.value != smsDefault) - draw_areas(*print.get_object(processing.second.front()), volumes, config, overhangs, move_bounds, - bottom_contacts, top_contacts, intermediate_layers, layer_storage, throw_on_cancel); - else { - assert(print_object.config().support_style == smsOrganic); + print_object.config().support_style.value != smsDefault) { + draw_areas(*print.get_object(processing.second.front()), volumes, config, overhangs, move_bounds, + bottom_contacts, top_contacts, intermediate_layers, layer_storage, throw_on_cancel); + } else { organic_draw_branches( *print.get_object(processing.second.front()), volumes, config, move_bounds, bottom_contacts, top_contacts, interface_placer, intermediate_layers, layer_storage, diff --git a/src/libslic3r/Support/TreeSupportCommon.cpp b/src/libslic3r/Support/TreeSupportCommon.cpp index 0ef8220381..34928a9182 100644 --- a/src/libslic3r/Support/TreeSupportCommon.cpp +++ b/src/libslic3r/Support/TreeSupportCommon.cpp @@ -23,7 +23,7 @@ TreeSupportMeshGroupSettings::TreeSupportMeshGroupSettings(const PrintObject &pr // Support must be enabled and set to Tree style. assert(config.enable_support || config.enforce_support_layers > 0); - assert(config.support_type == stTree || config.support_style == smsOrganic); + assert(is_tree(config.support_type)); // Calculate maximum external perimeter width over all printing regions, taking into account the default layer height. coordf_t external_perimeter_width = 0.; @@ -213,4 +213,4 @@ void tree_supports_show_error(std::string_view message, bool critical) #endif // TREE_SUPPORT_SHOW_ERRORS_WIN32 } -} // namespace Slic3r::FFFTreeSupport \ No newline at end of file +} // namespace Slic3r::FFFTreeSupport diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp index 92a5e5ecd6..481888bfa8 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp @@ -396,7 +396,7 @@ IconManager::VIcons init_icons(IconManager &mng, const GuiCfg &cfg) "reflection_y.svg", // reflection_y }; - assert(init_types.size() == static_cast(IconType::_count)); + assert(filenames.size() == static_cast(IconType::_count)); std::string path = resources_dir() + "/images/"; for (std::string &filename : filenames) filename = path + filename; diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 41e7bc9316..01f1c06502 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -2791,9 +2791,9 @@ static bool is_left_handed(const Transform3d& m) } #ifndef NDEBUG -static bool is_rotation_xy_synchronized(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to) +static bool is_rotation_xy_synchronized(const Transform3d &rot_xyz_from, const Transform3d &rot_xyz_to) { - const Eigen::AngleAxisd angle_axis(Geometry::rotation_xyz_diff(rot_xyz_from, rot_xyz_to)); + const Eigen::AngleAxisd angle_axis((rot_xyz_from * rot_xyz_to.inverse()).rotation()); const Vec3d axis = angle_axis.axis(); const double angle = angle_axis.angle(); if (std::abs(angle) < 1e-8) @@ -2817,10 +2817,10 @@ static void verify_instances_rotation_synchronized(const Model &model, const GLV //assert(idx_volume_first != -1); // object without instances? if (idx_volume_first == -1) continue; - const Vec3d &rotation0 = volumes[idx_volume_first]->get_instance_rotation(); + const Transform3d &rotation0 = volumes[idx_volume_first]->get_instance_transformation().get_matrix(); for (int i = idx_volume_first + 1; i < (int)volumes.size(); ++i) if (volumes[i]->object_idx() == idx_object) { - const Vec3d &rotation = volumes[i]->get_instance_rotation(); + const Transform3d &rotation = volumes[i]->get_instance_transformation().get_matrix(); assert(is_rotation_xy_synchronized(rotation, rotation0)); } }