[Bf-blender-cvs] [2c6d3ab6787] soc-2021-adaptive-cloth: adaptive_cloth: Sizing: get edge size squared
ishbosamiya
noreply at git.blender.org
Mon Jul 19 17:35:44 CEST 2021
Commit: 2c6d3ab678799e82d7257202d5b4f8c5c90eeadf
Author: ishbosamiya
Date: Fri Jul 16 22:02:29 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB2c6d3ab678799e82d7257202d5b4f8c5c90eeadf
adaptive_cloth: Sizing: get edge size squared
===================================================================
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 eafe6fda1f6..145adaa08c7 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -125,6 +125,31 @@ class Sizing {
{
return this->m;
}
+
+ /**
+ * Returns the squared edge size
+ *
+ * @param other Sizing of the other vertex along the edge
+ * @param u_i Material space coorindates (uv coords) of the `this`
+ * vert
+ * @param u_j Material space coorindates (uv coords) of the `other`
+ * vert
+ */
+ float get_edge_size_sq(const Sizing &other, const float2 &u_i, const float2 &u_j) const
+ {
+ /* The edge size is given by
+ * s(i, j)^2 = transpose(uv_ij) * ((m_i + m_j) / 2) * uv_ij
+ *
+ * This means that the "size" requires a sqrt but since the "size" of
+ * the edge is generally used only to check against 1.0, it is more
+ * performant to not do the sqrt operation.
+ */
+ const float2 u_ij = u_i - u_j;
+
+ const float2x2 m_avg = (this->m + other.m) * 0.5;
+
+ return float2::dot(u_ij, m_avg * u_ij);
+ }
};
class VertData {
More information about the Bf-blender-cvs
mailing list