FIX: auto orient may not work with specific angle
jira: STUDIO-8579, STUDIO-8575 github: #5092 Change-Id: I89ec76661e82364b3fcc8ba799027debc02c503c
This commit is contained in:
parent
931e599c5a
commit
12ed0626a3
|
@ -1314,10 +1314,13 @@ public:
|
|||
|
||||
// BBS
|
||||
void rotate(Matrix3d rotation_matrix) {
|
||||
// note: must remove scaling from transformation, otherwise auto-orientation with scaled objects will have problem
|
||||
auto R = m_transformation.get_rotation_matrix().matrix().block<3, 3>(0, 0);
|
||||
auto R = m_transformation.get_rotation_matrix();
|
||||
auto R_new = rotation_matrix * R;
|
||||
auto euler_angles = Geometry::extract_euler_angles(R_new);
|
||||
//BOOST_LOG_TRIVIAL(debug) << "old R:\n"
|
||||
// << R.matrix() << "\nnew R:\n"
|
||||
// << R_new.matrix() << "\nold euler angles: " << m_transformation.get_rotation().transpose() << "\n"
|
||||
// << "new euler angles: " << euler_angles.transpose();
|
||||
set_rotation(euler_angles);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
params = params_;
|
||||
progressind = progressind_;
|
||||
params.ASCENT = cos(PI - orient_mesh->overhang_angle * PI / 180); // use per-object overhang angle
|
||||
|
||||
|
||||
// BOOST_LOG_TRIVIAL(info) << orient_mesh->name << ", angle=" << orient_mesh->overhang_angle << ", params.ASCENT=" << params.ASCENT;
|
||||
// std::cout << orient_mesh->name << ", angle=" << orient_mesh->overhang_angle << ", params.ASCENT=" << params.ASCENT;
|
||||
|
||||
|
@ -161,9 +161,9 @@ public:
|
|||
|
||||
for (int i = 1; i< results_vector.size()-1; i++) {
|
||||
if (abs(results_vector[i].second.unprintability - results_vector[0].second.unprintability) < EPSILON && abs(results_vector[0].first.dot(n1)-1) > EPSILON) {
|
||||
if (abs(results_vector[i].first.dot(n1)-1) < EPSILON*EPSILON) {
|
||||
if (abs(results_vector[i].first.dot(n1)-1) < EPSILON*EPSILON) {
|
||||
best_orientation = n1;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -385,7 +385,7 @@ public:
|
|||
auto bottom_condition = z_max.array() < total_min_z + this->params.FIRST_LAY_H - EPSILON;
|
||||
auto bottom_condition_hull = z_max_hull.array() < total_min_z + this->params.FIRST_LAY_H - EPSILON;
|
||||
auto bottom_condition_2nd = z_max.array() < total_min_z + this->params.FIRST_LAY_H/2.f - EPSILON;
|
||||
//The first layer is sliced on half of the first layer height.
|
||||
//The first layer is sliced on half of the first layer height.
|
||||
//The bottom area is measured by accumulating first layer area with the facets area below first layer height.
|
||||
//By combining these two factors, we can avoid the wrong orientation of large planar faces while not influence the
|
||||
//orientations of complex objects with small bottom areas.
|
||||
|
@ -497,7 +497,8 @@ void _orient(OrientMeshs& meshs_,
|
|||
mesh_.orientation = orienter.process();
|
||||
Geometry::rotation_from_two_vectors(mesh_.orientation, { 0,0,1 }, mesh_.axis, mesh_.angle, &mesh_.rotation_matrix);
|
||||
mesh_.euler_angles = Geometry::extract_euler_angles(mesh_.rotation_matrix);
|
||||
BOOST_LOG_TRIVIAL(debug) << "rotation_from_two_vectors: " << mesh_.orientation << "; " << mesh_.axis << "; " << mesh_.angle << "; euler: " << mesh_.euler_angles.transpose();
|
||||
BOOST_LOG_TRIVIAL(debug) << "rotation_from_two_vectors: " << mesh_.orientation.transpose() << "; axis: " << mesh_.axis.transpose() << "; angle: " << mesh_.angle
|
||||
<< "; euler: " << mesh_.euler_angles.transpose() << ", rotation_matrix:\n" << mesh_.rotation_matrix;
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue