Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Rood <dev@lucarood.com>2016-12-06 02:39:29 +0300
committerLuca Rood <dev@lucarood.com>2018-08-31 17:39:43 +0300
commitb6f0f8a5b5a4871603755d4413e47f054ecd5b68 (patch)
tree50b10fa4e995a133c2ad42e31f8d6acb205ed552 /source/blender/blenkernel/BKE_cloth.h
parente3d31b8dfbdc3f4412e12fa1594927098ed0654d (diff)
Cloth: Implement angular bending springs
This implements angular bending springs for cloth simulation. This also adds shearing springs for n-gons. This angular spring implementation does not include Jacobian matrices, as the springs can exist between polygons of different vertex counts, rendering their relationships asymmetrical, and thus impossible to solve with the current implementation. This means that the bending component is solved explicitly. However, this is usually not a big problem, as bending springs contribute less to instability than structural springs. The the old linear bending model can still be used, and is the default for existing files, to keep compatibility. However, the new angular bending model is the default for any new simulation. This commit makes small breaking changes, in that shearing springs are now created on n-gons (also in linear bending mode), while n-gons were previously ignored. Reviewed By: brecht Differential Revision: http://developer.blender.org/D3662
Diffstat (limited to 'source/blender/blenkernel/BKE_cloth.h')
-rw-r--r--source/blender/blenkernel/BKE_cloth.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index a099ae46d78..baf60397504 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -133,11 +133,17 @@ ClothVertex;
typedef struct ClothSpring {
int ij; /* Pij from the paper, one end of the spring. */
int kl; /* Pkl from the paper, one end of the spring. */
- int mn;
- float restlen; /* The original length of the spring. */
- int type; /* types defined in BKE_cloth.h ("springType") */
- int flags; /* defined in BKE_cloth.h, e.g. deactivated due to tearing */
- float stiffness; /* stiffness factor from the vertex groups */
+ int mn; /* For hair springs: third vertex index; For bending springs: edge index; */
+ int *pa; /* Array of vert indices for poly a (for bending springs). */
+ int *pb; /* Array of vert indices for poly b (for bending springs). */
+ int la; /* Length of *pa. */
+ int lb; /* Length of *pb. */
+ float restlen; /* The original length of the spring. */
+ float restang; /* The original angle of the bending springs. */
+ int type; /* Types defined in BKE_cloth.h ("springType"). */
+ int flags; /* Defined in BKE_cloth.h, e.g. deactivated due to tearing. */
+ float lin_stiffness; /* Linear stiffness factor from the vertex groups. */
+ float ang_stiffness; /* Angular stiffness factor from the vertex groups. */
float editrestlen;
/* angular bending spring target and derivatives */
@@ -186,12 +192,12 @@ typedef enum {
/* Spring types as defined in the paper.*/
typedef enum {
- CLOTH_SPRING_TYPE_STRUCTURAL = (1 << 1),
- CLOTH_SPRING_TYPE_SHEAR = (1 << 2),
- CLOTH_SPRING_TYPE_BENDING = (1 << 3),
- CLOTH_SPRING_TYPE_GOAL = (1 << 4),
- CLOTH_SPRING_TYPE_SEWING = (1 << 5),
- CLOTH_SPRING_TYPE_BENDING_ANG = (1 << 6),
+ CLOTH_SPRING_TYPE_STRUCTURAL = (1 << 1),
+ CLOTH_SPRING_TYPE_SHEAR = (1 << 2),
+ CLOTH_SPRING_TYPE_BENDING = (1 << 3),
+ CLOTH_SPRING_TYPE_GOAL = (1 << 4),
+ CLOTH_SPRING_TYPE_SEWING = (1 << 5),
+ CLOTH_SPRING_TYPE_BENDING_HAIR = (1 << 6),
} CLOTH_SPRING_TYPES;
/* SPRING FLAGS */