[Bf-blender-cvs] [53033ffd11d] soc-2021-adaptive-cloth: adaptive_cloth: fix: Mesh: collapse edge: can lead to loose edges

ishbosamiya noreply at git.blender.org
Sun Aug 22 17:23:40 CEST 2021


Commit: 53033ffd11d2e04a4b90b6d1728c6213cd988725
Author: ishbosamiya
Date:   Sat Aug 14 14:48:31 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB53033ffd11d2e04a4b90b6d1728c6213cd988725

adaptive_cloth: fix: Mesh: collapse edge: can lead to loose edges

There are some edge cases (:P) that can lead to the creation of loose
edges when collapsing the edge.

Suppose v2 has an edge that contains only 1 face and this face also
contains v1, the face was deleted but the remaining edge between v2
and ov, remained. This causes the loose edge. The simple check and
deletion of such an edge fixes this bug.

===================================================================

M	source/blender/blenkernel/BKE_cloth_remesh.hh

===================================================================

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh b/source/blender/blenkernel/BKE_cloth_remesh.hh
index bee40696436..263f393deb2 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2018,6 +2018,21 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
         for (const auto &e_index : v1.get_edges()) {
           to_delete_edge_indices.add(e_index);
         }
+
+        /* If any edges around v2 that have only one face and that
+         * face contains v1, it will become a loose edge, so delete
+         * it */
+        const auto &v2 = this->get_checked_vert(v2_index);
+        for (const auto &v2_e_index : v2.get_edges()) {
+          const auto &v2_e = this->get_checked_edge(v2_e_index);
+          if (v2_e.get_faces().size() == 1) {
+            const auto &v2_e_f = this->get_checked_face(v2_e.get_faces()[0]);
+
+            if (v2_e_f.has_vert_index(v1_index)) {
+              to_delete_edge_indices.add(v2_e_index);
+            }
+          }
+        }
       }
 
       for (const auto &face_index : to_delete_face_indices) {



More information about the Bf-blender-cvs mailing list