12{
16
17 if (!config.belt_printer.value)
18 return false;
19
20
21
22
23
26 return false;
27
28 const double angle_deg = config.belt_frame_tilt_decouple.value
29 ? config.belt_frame_tilt_angle.value
30 : config.belt_slice_rotation_angle.value;
31 if (std::abs(angle_deg) <=
EPSILON)
32 return false;
33
35 const double sin_a = std::sin(angle_rad);
37 return false;
38 const double cot_a = std::cos(angle_rad) / sin_a;
39 const double inv_sin = 1.0 / std::abs(sin_a);
40
41
42
43
44
45
46
47
48
49
50 Matrix3d shear = Matrix3d::Identity();
53 shear(2, 1) = cot_a;
54 scale(1, 1) = inv_sin;
55 } else {
56 shear(2, 0) = -cot_a;
57 scale(0, 0) = inv_sin;
58 }
59
60
61
62
64 combined.linear() =
scale * shear;
65
66 if (combined.isApprox(Transform3d::Identity()))
67 return false;
68
72 return true;
73}
#define EPSILON
Definition ColorUtils.cpp:64
int scale(const int val)
Definition WipeTowerDialog.cpp:58
constexpr T deg2rad(const T angle)
Definition Geometry.hpp:312
BeltRotationAxis
Definition PrintConfig.hpp:341
@ X
Definition PrintConfig.hpp:343
@ Z
Definition PrintConfig.hpp:345
@ None
Definition PrintConfig.hpp:342
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