16{
17
18
19
20 bool has_rotation = false;
21 if (config.belt_printer.value) {
23 if (has_rotation) {
25 belt_xform.linear() = rot;
26 trafo = belt_xform * trafo;
27 }
28 }
29
30 if (!has_rotation)
31 return;
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 BeltTransformPipeline::BeltFloorParams floor;
55 double min_z = std::numeric_limits<double>::max();
56 for (const ModelVolume *mv : model_volumes) {
57 if (!mv->is_model_part()) continue;
59 const auto &its = mv->mesh().its;
60 for (const stl_vertex &v : its.vertices) {
61 Vec3d vm = v.cast<
double>();
62 Vec3d pt = vol_trafo * vm;
63 min_z = std::min(min_z, pt.z());
64 if (has_floor)
65 min_z = std::min(min_z, floor.shear_factor * (floor.from_axis == 0 ? pt.x() : pt.y()));
66 }
67 }
68 if (has_floor && min_z != std::numeric_limits<double>::max())
70 const double z_shift_val = (min_z < 0. && min_z != std::numeric_limits<double>::max()) ? -min_z : 0.;
71 if (z_shift_val > 0.) {
73 z_shift.matrix()(2, 3) = z_shift_val;
74 trafo = z_shift * trafo;
75 }
76
77 if (out_belt_min_z && config.belt_printer.value) {
78 *out_belt_min_z = (min_z != std::numeric_limits<double>::max()) ? min_z : 0.;
79 }
80}
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96
Eigen::Matrix< double, 3, 3, Eigen::DontAlign > Matrix3d
Definition Point.hpp:86