From 6021d1211038cf6cfe7bd7acd1f6b205ea17448f Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Mon, 16 Oct 2023 15:34:06 +0800 Subject: [PATCH] FIX:cut reset failed after setted rotation Y=90 Jira: STUDIO-4814 Change-Id: I9f8c89744ddf0f48245c45af35f3193ff2cf929b --- src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp | 11 +++++++++-- src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp index 235e47e67..31c1a2cc2 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp @@ -374,6 +374,7 @@ void GLGizmoAdvancedCut::reset_cut_plane() m_transformed_bounding_box = transformed_bounding_box(m_bb_center); set_center(m_bb_center); m_start_dragging_m = m_rotate_matrix = Transform3d::Identity(); + update_plane_normal(); m_ar_plane_center = m_plane_center; reset_cut_by_contours(); @@ -1008,18 +1009,24 @@ void GLGizmoAdvancedCut::put_connectors_on_cut_plane(const Vec3d &cp_normal, dou } } -void GLGizmoAdvancedCut::update_clipper() +void GLGizmoAdvancedCut::update_plane_normal() { // update cut_normal Vec3d normal = m_rotate_matrix * Vec3d::UnitZ(); m_plane_normal = normal; // core m_plane_x_direction = m_rotate_matrix * Vec3d::UnitX(); // core + m_clp_normal = normal; +} + +void GLGizmoAdvancedCut::update_clipper() +{ + update_plane_normal(); + auto normal = m_plane_normal; // calculate normal and offset for clipping plane Vec3d beg = m_bb_center; beg[Z] -= m_radius; rotate_vec3d_around_plane_center(beg, m_rotate_matrix, m_plane_center); - m_clp_normal = normal; double offset = normal.dot(m_plane_center); double dist = normal.dot(beg); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp index c7a7ac2b3..046a43896 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp @@ -278,6 +278,7 @@ private: // update the connectors position so that the connectors are on the cut plane void put_connectors_on_cut_plane(const Vec3d &cp_normal, double cp_offset); + void update_plane_normal(); void update_clipper(); // on render void render_cut_plane_and_grabbers();