[Bf-blender-cvs] [66d773c2e7c] master: Fix cloth triangle area calculation being wrong

Sebastian Parborg noreply at git.blender.org
Thu Dec 19 16:14:31 CET 2019


Commit: 66d773c2e7c595a65454ce1f0ca8f131a03125ed
Author: Sebastian Parborg
Date:   Thu Dec 19 16:14:21 2019 +0100
Branches: master
https://developer.blender.org/rB66d773c2e7c595a65454ce1f0ca8f131a03125ed

Fix cloth triangle area calculation being wrong

Before the area calculated was for the resulting quad, not the triangle.
So just simply divide the result by 2.

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

M	source/blender/physics/intern/implicit_blender.c
M	source/blender/physics/intern/implicit_eigen.cpp

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

diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c
index 02d7fd50797..fd9903baa41 100644
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@ -1455,7 +1455,7 @@ static float calc_nor_area_tri(float nor[3],
   sub_v3_v3v3(n2, v2, v3);
 
   cross_v3_v3v3(nor, n1, n2);
-  return normalize_v3(nor);
+  return normalize_v3(nor) / 2.0f;
 }
 
 /* XXX does not support force jacobians yet, since the effector system does not provide them either
diff --git a/source/blender/physics/intern/implicit_eigen.cpp b/source/blender/physics/intern/implicit_eigen.cpp
index 9e1c03638d7..b801e851b90 100644
--- a/source/blender/physics/intern/implicit_eigen.cpp
+++ b/source/blender/physics/intern/implicit_eigen.cpp
@@ -830,7 +830,7 @@ static float calc_nor_area_tri(float nor[3],
   sub_v3_v3v3(n2, v2, v3);
 
   cross_v3_v3v3(nor, n1, n2);
-  return normalize_v3(nor);
+  return normalize_v3(nor) / 2.0f;
 }
 
 /* XXX does not support force jacobians yet,



More information about the Bf-blender-cvs mailing list