mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-06 23:31:19 +00:00
The clang-tidy job on #14394 fails on 129 misc-include-cleaner findings:
the belt sources and tests use std::, Eigen, Point/PrintConfig and
BeltBrim symbols without including the header that provides them, which
only compiled because the precompiled header supplied it. Every include
the job names is added, in each file's existing include style ("../" in
the GCode/ and Support/ subdirectories, quoted libslic3r/ paths in the
GUI and tests). No code changes.
Verified with scripts/clang_tidy_diff.py -p build-tidy --base eb5b9a77b9
(SLIC3R_PCH=OFF compile database, clang-tidy 22.1.8): no findings left.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6Kg5igmmMU2YLoK6HrsWV
71 lines
2.9 KiB
C++
71 lines
2.9 KiB
C++
#include "BeltSliceStrategy.hpp"
|
|
#include "Model.hpp"
|
|
#include "BeltTransform.hpp"
|
|
#include "Point.hpp"
|
|
#include "PrintConfig.hpp"
|
|
|
|
#include <limits>
|
|
#include <algorithm>
|
|
|
|
namespace Slic3r {
|
|
|
|
void BeltSliceStrategy::apply_preslice_transforms(Transform3d &trafo,
|
|
const PrintConfig &config,
|
|
const ModelVolumePtrs &model_volumes,
|
|
double *out_belt_min_z)
|
|
{
|
|
// 1. Standalone pre-slice axis remap (works without belt mode).
|
|
const bool has_remap = BeltTransformPipeline::has_preslice_remap(config);
|
|
if (has_remap)
|
|
trafo = BeltTransformPipeline::build_preslice_remap(config) * trafo;
|
|
|
|
// 2. Belt rotation — the sole mesh-side belt transform (matching
|
|
// BeltTransformPipeline::build_forward_transform). Only active in
|
|
// belt-printer mode.
|
|
bool has_rotation = false;
|
|
if (config.belt_printer.value) {
|
|
const Matrix3d rot = BeltTransformPipeline::build_rotation_matrix(config, &has_rotation);
|
|
if (has_rotation) {
|
|
Transform3d belt_xform = Transform3d::Identity();
|
|
belt_xform.linear() = rot;
|
|
trafo = belt_xform * trafo;
|
|
}
|
|
}
|
|
|
|
if (!has_remap && !has_rotation)
|
|
return;
|
|
|
|
// 3. Z-shift — detect if the mesh clips below the build plate after the
|
|
// transforms and lift it. Each mesh vertex must be brought into object space
|
|
// via mv->get_matrix() before applying the full trafo (which is in object
|
|
// space). Missing this on assemblies (where per-volume get_matrix() positions
|
|
// each volume within the object) would compute min_z against mesh-local vertex
|
|
// coordinates rather than object-space coordinates, so volumes translated along
|
|
// the slicer's Z axis would be silently excluded from the bound check.
|
|
|
|
double min_z = std::numeric_limits<double>::max();
|
|
for (const ModelVolume *mv : model_volumes) {
|
|
if (!mv->is_model_part()) continue;
|
|
Transform3d vol_trafo = trafo * mv->get_matrix();
|
|
const auto &its = mv->mesh().its;
|
|
for (const stl_vertex &v : its.vertices) {
|
|
Vec3d vm = v.cast<double>();
|
|
Vec3d pt = vol_trafo * vm;
|
|
min_z = std::min(min_z, pt.z());
|
|
}
|
|
}
|
|
const double z_shift_val = (min_z < 0. && min_z != std::numeric_limits<double>::max()) ? -min_z : 0.;
|
|
if (z_shift_val > 0.) {
|
|
Transform3d z_shift = Transform3d::Identity();
|
|
z_shift.matrix()(2, 3) = z_shift_val;
|
|
trafo = z_shift * trafo;
|
|
}
|
|
// out_belt_min_z is only meaningful in belt mode; the standalone-remap path
|
|
// never reported it.
|
|
if (out_belt_min_z && config.belt_printer.value) {
|
|
*out_belt_min_z = (min_z != std::numeric_limits<double>::max()) ? min_z : 0.;
|
|
}
|
|
}
|
|
|
|
} // namespace Slic3r
|