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
|
// BBS
|
||||||
void rotate(Matrix3d rotation_matrix) {
|
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();
|
||||||
auto R = m_transformation.get_rotation_matrix().matrix().block<3, 3>(0, 0);
|
|
||||||
auto R_new = rotation_matrix * R;
|
auto R_new = rotation_matrix * R;
|
||||||
auto euler_angles = Geometry::extract_euler_angles(R_new);
|
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);
|
set_rotation(euler_angles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,8 @@ void _orient(OrientMeshs& meshs_,
|
||||||
mesh_.orientation = orienter.process();
|
mesh_.orientation = orienter.process();
|
||||||
Geometry::rotation_from_two_vectors(mesh_.orientation, { 0,0,1 }, mesh_.axis, mesh_.angle, &mesh_.rotation_matrix);
|
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);
|
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