Tech ENABLE_WORLD_COORDINATE - Fix of Selection::mirror()

This commit is contained in:
enricoturri1966 2022-12-02 09:16:37 +01:00
parent e8e50b50f1
commit a02fc6cb3e
3 changed files with 24 additions and 2 deletions

View File

@ -1755,7 +1755,20 @@ std::vector<int> GLCanvas3D::load_object(const Model& model, int obj_idx)
void GLCanvas3D::mirror_selection(Axis axis)
{
#if ENABLE_WORLD_COORDINATE
TransformationType transformation_type;
if (wxGetApp().obj_manipul()->is_local_coordinates())
transformation_type.set_local();
else if (wxGetApp().obj_manipul()->is_instance_coordinates())
transformation_type.set_instance();
transformation_type.set_relative();
m_selection.setup_cache();
m_selection.mirror(axis, transformation_type);
#else
m_selection.mirror(axis);
#endif // ENABLE_WORLD_COORDINATE
do_mirror(L("Mirror Object"));
wxGetApp().obj_manipul()->set_dirty();
}

View File

@ -1283,6 +1283,13 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume)
}
}
#if ENABLE_WORLD_COORDINATE
void Selection::mirror(Axis axis, TransformationType transformation_type)
{
const Vec3d mirror((axis == X) ? -1.0 : 1.0, (axis == Y) ? -1.0 : 1.0, (axis == Z) ? -1.0 : 1.0);
scale_and_translate(mirror, Vec3d::Zero(), transformation_type);
}
#else
void Selection::mirror(Axis axis)
{
if (!m_valid)
@ -1305,6 +1312,7 @@ void Selection::mirror(Axis axis)
set_bounding_boxes_dirty();
}
#endif // ENABLE_WORLD_COORDINATE
#if ENABLE_WORLD_COORDINATE
void Selection::scale_and_translate(const Vec3d& scale, const Vec3d& translation, TransformationType transformation_type)

View File

@ -402,11 +402,12 @@ public:
void flattening_rotate(const Vec3d& normal);
void scale(const Vec3d& scale, TransformationType transformation_type);
void scale_to_fit_print_volume(const BuildVolume& volume);
void mirror(Axis axis);
#if ENABLE_WORLD_COORDINATE
void scale_and_translate(const Vec3d& scale, const Vec3d& translation, TransformationType transformation_type);
void mirror(Axis axis, TransformationType transformation_type);
void reset_skew();
#else
void mirror(Axis axis);
void translate(unsigned int object_idx, const Vec3d& displacement);
#endif // ENABLE_WORLD_COORDINATE
void translate(unsigned int object_idx, unsigned int instance_idx, const Vec3d& displacement);