[Bf-blender-cvs] [c47d67260e5] soc-2021-adaptive-cloth: adaptive_cloth: Mesh: add checked loose edge

ishbosamiya noreply at git.blender.org
Mon Aug 30 09:15:08 CEST 2021


Commit: c47d67260e55a7b15196b0c9ae97a859bf3d02d8
Author: ishbosamiya
Date:   Sat Aug 28 16:04:20 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBc47d67260e55a7b15196b0c9ae97a859bf3d02d8

adaptive_cloth: Mesh: add checked loose edge

Adds a loose edge to the mesh with the given vert indices and ensures
that these vert indices do not already have an edge between them and
that they exist.

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

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 cf58d8970c8..43ea4bd793d 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2945,6 +2945,22 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
     }
   }
 
+  Edge<EED> &add_checked_loose_edge(const VertIndex v1_index, const VertIndex v2_index)
+  {
+    /* Checks to ensure v1 and v2 are valid */
+    {
+      BLI_assert(this->has_vert(v1_index));
+      BLI_assert(this->has_vert(v2_index));
+      BLI_assert(this->get_connecting_edge_index(v1_index, v2_index) == std::nullopt);
+    }
+
+    auto &new_edge = this->add_empty_edge();
+    new_edge.verts = std::make_tuple(v1_index, v2_index);
+    this->add_edge_ref_to_verts(new_edge);
+
+    return new_edge;
+  }
+
  private:
   /* all private static methods */
   /* all private non-static methods */



More information about the Bf-blender-cvs mailing list