Tech ENABLE_WORLD_COORDINATE - Revisited rotation of single volume

This commit is contained in:
enricoturri1966 2022-02-14 12:48:51 +01:00
parent d836418b1d
commit 387544fb29
3 changed files with 11 additions and 10 deletions

View file

@ -563,8 +563,7 @@ void ObjectManipulation::update_ui_from_settings()
}
m_check_inch->SetValue(m_imperial_units);
if (m_use_colors != (wxGetApp().app_config->get("color_mapinulation_panel") == "1"))
{
if (m_use_colors != (wxGetApp().app_config->get("color_mapinulation_panel") == "1")) {
m_use_colors = wxGetApp().app_config->get("color_mapinulation_panel") == "1";
// update colors for edit-boxes
int axis_id = 0;
@ -624,11 +623,10 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
#if ENABLE_WORLD_COORDINATE
if (is_world_coordinates()) {
m_new_position = volume->get_instance_offset();
m_new_rotate_label_string = L("Rotate");
#else
if (m_world_coordinates) {
m_new_rotate_label_string = L("Rotate");
#endif // ENABLE_WORLD_COORDINATE
m_new_rotate_label_string = L("Rotate");
m_new_rotation = Vec3d::Zero();
m_new_size = selection.get_scaled_instance_bounding_box().size();
m_new_scale = m_new_size.cwiseProduct(selection.get_unscaled_instance_bounding_box().size().cwiseInverse()) * 100.0;
@ -671,23 +669,25 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
#else
const Vec3d& offset = trafo.get_offset();
#endif // ENABLE_WORLD_COORDINATE_VOLUMES_LOCAL_OFFSET
// const Vec3d& mirror = trafo.get_mirror();
m_new_position = offset;
m_new_rotation = trafo.get_rotation() * (180.0 / M_PI);
m_new_rotate_label_string = L("Rotate");
m_new_rotation = Vec3d::Zero();
m_new_size = volume->transformed_convex_hull_bounding_box(trafo.get_matrix()).size();
m_new_scale = m_new_size.cwiseProduct(volume->transformed_convex_hull_bounding_box(volume->get_instance_transformation().get_matrix() * volume->get_volume_transformation().get_matrix(false, false, true, false)).size().cwiseInverse()) * 100.0;
}
else if (is_local_coordinates()) {
m_new_move_label_string = L("Translate");
m_new_position = Vec3d::Zero();
m_new_rotation = Vec3d::Zero();
m_new_rotation = volume->get_volume_rotation() * (180.0 / M_PI);
m_new_scale = volume->get_volume_scaling_factor() * 100.0;
m_new_size = volume->get_volume_scaling_factor().cwiseProduct(volume->bounding_box().size());
}
else {
#endif // ENABLE_WORLD_COORDINATE
m_new_position = volume->get_volume_offset();
m_new_rotation = volume->get_volume_rotation() * (180.0 / M_PI);
m_new_rotate_label_string = L("Rotate");
m_new_rotation = Vec3d::Zero();
#if ENABLE_WORLD_COORDINATE
m_new_size = volume->transformed_convex_hull_bounding_box(volume->get_volume_transformation().get_matrix()).size();
m_new_scale = m_new_size.cwiseProduct(volume->transformed_convex_hull_bounding_box(volume->get_volume_transformation().get_matrix(false, false, true, false)).size().cwiseInverse()) * 100.0;

View file

@ -660,7 +660,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
default:
case ECoordinatesType::World: { transformation_type = TransformationType::World_Relative_Joint; break; }
case ECoordinatesType::Instance: { transformation_type = TransformationType::Instance_Relative_Joint; break; }
case ECoordinatesType::Local: { transformation_type = TransformationType::Local_Relative_Joint; break; }
case ECoordinatesType::Local: { transformation_type = TransformationType::Local_Absolute_Joint; break; }
}
#else
TransformationType transformation_type(TransformationType::World_Relative_Joint);

View file

@ -901,7 +901,8 @@ void Selection::rotate(const Vec3d& rotation, TransformationType transformation_
else if (is_single_volume_or_modifier()) {
if (transformation_type.local()) {
const Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
v.set_volume_rotation(Geometry::extract_euler_angles(m_cache.volumes_data[i].get_volume_rotation_matrix() * m));
const Vec3d new_rotation = transformation_type.absolute() ? rotation : Geometry::extract_euler_angles(m_cache.volumes_data[i].get_volume_rotation_matrix() * m);
v.set_volume_rotation(new_rotation);
}
else if (transformation_type.instance()) {
const Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);