[Bf-blender-cvs] [e4165cdcf99] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: fix: aspect ratio, wrong area

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


Commit: e4165cdcf99d53c2915c3e61461bc4e54b18ab9d
Author: ishbosamiya
Date:   Fri Aug 13 19:39:58 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBe4165cdcf99d53c2915c3e61461bc4e54b18ab9d

adaptive_cloth: AdaptiveMesh: fix: aspect ratio, wrong area

Must take the non directional area (absolute value of the area) since
the order of the verts of the face may not correspond to normal of the
face always. The aspect ratio calculation should not be doing the
inversion testing as well. (This could be used for inversion testing
but without proper math backing it, don't want to use it right now).

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

M	source/blender/blenkernel/intern/cloth_remesh.cc

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

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index 88c87362cf6..4b64ad4fc0e 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -859,7 +859,7 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
 
     const auto cross_2d = [](const float2 &a, const float2 &b) { return a.x * b.y - a.y * b.x; };
 
-    const auto area = cross_2d(p2 - p1, p3 - p1) * 0.5;
+    const auto area = fabs(cross_2d(p2 - p1, p3 - p1)) * 0.5;
 
     return 4.0 * M_SQRT3 * area / (l_max * (l1 + l2 + l3));
   }



More information about the Bf-blender-cvs mailing list