From 61f0a9e4da8358f6a8d1a176f431ac4de3f6d413 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 4 Nov 2015 23:11:30 +0100 Subject: [PATCH] Replace the flip word with mirror. #3060 --- lib/Slic3r/GUI/Plater.pm | 24 ++++++++++++------------ xs/src/libslic3r/Model.cpp | 4 ++-- xs/src/libslic3r/Model.hpp | 2 +- xs/src/libslic3r/TriangleMesh.cpp | 14 +++++++------- xs/src/libslic3r/TriangleMesh.hpp | 8 ++++---- xs/t/01_trianglemesh.t | 2 +- xs/xsp/Model.xsp | 2 +- xs/xsp/TriangleMesh.xsp | 6 +++--- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 184e21615..54860092e 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -783,7 +783,7 @@ sub rotate { $self->schedule_background_process; } -sub flip { +sub mirror { my ($self, $axis) = @_; my ($obj_idx, $object) = $self->selected_object; @@ -792,13 +792,13 @@ sub flip { my $model_object = $self->{model}->objects->[$obj_idx]; my $model_instance = $model_object->instances->[0]; - # apply Z rotation before flipping + # apply Z rotation before mirroring if ($model_instance->rotation != 0) { $model_object->rotate($model_instance->rotation, Z); $_->set_rotation(0) for @{ $model_object->instances }; } - $model_object->flip($axis); + $model_object->mirror($axis); $model_object->update_bounding_box; # realign object to Z = 0 @@ -1688,17 +1688,17 @@ sub object_menu { $self->rotate(undef, Z); }); - my $flipMenu = Wx::Menu->new; - my $flipMenuItem = $menu->AppendSubMenu($flipMenu, "Flip", 'Mirror the selected object'); - $frame->_set_menu_item_icon($flipMenuItem, 'shape_flip_horizontal.png'); - $frame->_append_menu_item($flipMenu, "Along X axis…", 'Mirror the selected object along the X axis', sub { - $self->flip(X); + my $mirrorMenu = Wx::Menu->new; + my $mirrorMenuItem = $menu->AppendSubMenu($mirrorMenu, "Mirror", 'Mirror the selected object'); + $frame->_set_menu_item_icon($mirrorMenuItem, 'shape_flip_horizontal.png'); + $frame->_append_menu_item($mirrorMenu, "Along X axis…", 'Mirror the selected object along the X axis', sub { + $self->mirror(X); }); - $frame->_append_menu_item($flipMenu, "Along Y axis…", 'Mirror the selected object along the Y axis', sub { - $self->flip(Y); + $frame->_append_menu_item($mirrorMenu, "Along Y axis…", 'Mirror the selected object along the Y axis', sub { + $self->mirror(Y); }); - $frame->_append_menu_item($flipMenu, "Along Z axis…", 'Mirror the selected object along the Z axis', sub { - $self->flip(Z); + $frame->_append_menu_item($mirrorMenu, "Along Z axis…", 'Mirror the selected object along the Z axis', sub { + $self->mirror(Z); }); my $scaleMenu = Wx::Menu->new; diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index f31bd9b25..01c907fad 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -529,10 +529,10 @@ ModelObject::rotate(float angle, const Axis &axis) } void -ModelObject::flip(const Axis &axis) +ModelObject::mirror(const Axis &axis) { for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) { - (*v)->mesh.flip(axis); + (*v)->mesh.mirror(axis); } this->origin_translation = Pointf3(0,0,0); this->invalidate_bounding_box(); diff --git a/xs/src/libslic3r/Model.hpp b/xs/src/libslic3r/Model.hpp index e5683cb57..d802ae8e7 100644 --- a/xs/src/libslic3r/Model.hpp +++ b/xs/src/libslic3r/Model.hpp @@ -130,7 +130,7 @@ class ModelObject void translate(coordf_t x, coordf_t y, coordf_t z); void scale(const Pointf3 &versor); void rotate(float angle, const Axis &axis); - void flip(const Axis &axis); + void mirror(const Axis &axis); size_t materials_count() const; size_t facets_count() const; bool needed_repair() const; diff --git a/xs/src/libslic3r/TriangleMesh.cpp b/xs/src/libslic3r/TriangleMesh.cpp index 743bf4584..6df4eba5c 100644 --- a/xs/src/libslic3r/TriangleMesh.cpp +++ b/xs/src/libslic3r/TriangleMesh.cpp @@ -230,7 +230,7 @@ void TriangleMesh::rotate_z(float angle) this->rotate(angle, Z); } -void TriangleMesh::flip(const Axis &axis) +void TriangleMesh::mirror(const Axis &axis) { if (axis == X) { stl_mirror_yz(&this->stl); @@ -242,19 +242,19 @@ void TriangleMesh::flip(const Axis &axis) stl_invalidate_shared_vertices(&this->stl); } -void TriangleMesh::flip_x() +void TriangleMesh::mirror_x() { - this->flip(X); + this->mirror(X); } -void TriangleMesh::flip_y() +void TriangleMesh::mirror_y() { - this->flip(Y); + this->mirror(Y); } -void TriangleMesh::flip_z() +void TriangleMesh::mirror_z() { - this->flip(Z); + this->mirror(Z); } void TriangleMesh::align_to_origin() diff --git a/xs/src/libslic3r/TriangleMesh.hpp b/xs/src/libslic3r/TriangleMesh.hpp index ff12e8427..8fd92863c 100644 --- a/xs/src/libslic3r/TriangleMesh.hpp +++ b/xs/src/libslic3r/TriangleMesh.hpp @@ -36,10 +36,10 @@ class TriangleMesh void rotate_x(float angle); void rotate_y(float angle); void rotate_z(float angle); - void flip(const Axis &axis); - void flip_x(); - void flip_y(); - void flip_z(); + void mirror(const Axis &axis); + void mirror_x(); + void mirror_y(); + void mirror_z(); void align_to_origin(); void rotate(double angle, Point* center); TriangleMeshPtrs split() const; diff --git a/xs/t/01_trianglemesh.t b/xs/t/01_trianglemesh.t index cc140aa5a..fd57cf805 100644 --- a/xs/t/01_trianglemesh.t +++ b/xs/t/01_trianglemesh.t @@ -100,7 +100,7 @@ my $cube = { my $slices = $m->slice([ 5, 10 ]); is $slices->[0][0]->area, $slices->[1][0]->area, 'slicing a top tangent plane includes its area'; } - $m->flip_z; + $m->mirror_z; { # this second test also checks that performing a second slice on a mesh after # a transformation works properly (shared_vertices is correctly invalidated); diff --git a/xs/xsp/Model.xsp b/xs/xsp/Model.xsp index cf9b974f4..183890967 100644 --- a/xs/xsp/Model.xsp +++ b/xs/xsp/Model.xsp @@ -183,7 +183,7 @@ ModelMaterial::attributes() void scale_xyz(Pointf3* versor) %code{% THIS->scale(*versor); %}; void rotate(float angle, Axis axis); - void flip(Axis axis); + void mirror(Axis axis); Model* cut(double z) %code%{ diff --git a/xs/xsp/TriangleMesh.xsp b/xs/xsp/TriangleMesh.xsp index d87030693..c4f249f34 100644 --- a/xs/xsp/TriangleMesh.xsp +++ b/xs/xsp/TriangleMesh.xsp @@ -23,9 +23,9 @@ void rotate_x(float angle); void rotate_y(float angle); void rotate_z(float angle); - void flip_x(); - void flip_y(); - void flip_z(); + void mirror_x(); + void mirror_y(); + void mirror_z(); void align_to_origin(); void rotate(double angle, Point* center); TriangleMeshPtrs split();