[Bf-blender-cvs] [632f2af] strand_nodes: New (stub) method for solving constrained hair editing with Lagrange multipliers.

Lukas Tönne noreply at git.blender.org
Sun Aug 7 10:39:50 CEST 2016


Commit: 632f2afa6c85effc19534b7b4cdfa885d473f2d0
Author: Lukas Tönne
Date:   Tue Aug 2 14:12:40 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB632f2afa6c85effc19534b7b4cdfa885d473f2d0

New (stub) method for solving constrained hair editing with Lagrange multipliers.

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

M	source/blender/physics/intern/strands.cpp

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

diff --git a/source/blender/physics/intern/strands.cpp b/source/blender/physics/intern/strands.cpp
index cafe444..0fde614 100644
--- a/source/blender/physics/intern/strands.cpp
+++ b/source/blender/physics/intern/strands.cpp
@@ -56,6 +56,10 @@ extern "C" {
 
 /* === constraints === */
 
+//#define STRAND_CONSTRAINT_EDGERELAX
+//#define STRAND_CONSTRAINT_IK
+#define STRAND_CONSTRAINT_LAGRANGEMULT
+
 static int strand_count_vertices(BMVert *root)
 {
 	BMVert *v;
@@ -100,6 +104,7 @@ static void strands_apply_root_locations(BMEditStrands *edit)
 	}
 }
 
+#ifdef STRAND_CONSTRAINT_EDGERELAX
 static void strands_adjust_segment_lengths(BMesh *bm)
 {
 	BMVert *root, *v, *vprev;
@@ -193,7 +198,9 @@ static void strands_solve_edge_relaxation(BMEditStrands *edit)
 	
 	strands_adjust_segment_lengths(bm);
 }
+#endif
 
+#ifdef STRAND_CONSTRAINT_IK
 typedef struct IKTarget {
 	BMVert *vertex;
 	float weight;
@@ -411,22 +418,18 @@ static void strands_solve_inverse_kinematics(Object *ob, BMEditStrands *edit, fl
 #endif
 	}
 }
+#endif
+
+static void strands_solve_lagrange_multipliers(Object *ob, BMEditStrands *edit, float (*orig)[3])
+{
+	
+}
 
 void BPH_strands_solve_constraints(Scene *scene, Object *ob, BMEditStrands *edit, float (*orig)[3])
 {
 	HairEditSettings *settings = &scene->toolsettings->hair_edit;
 	BLI_assert(orig);
 	
-	strands_apply_root_locations(edit);
-	
-	if (true) {
-		strands_solve_edge_relaxation(edit);
-	}
-	else {
-		strands_solve_inverse_kinematics(ob, edit, orig);
-	}
-	
-	
 	/* Deflection */
 	if (settings->flag & HAIR_EDIT_USE_DEFLECT) {
 		CollisionContactCache *contacts = BKE_collision_cache_create();
@@ -447,4 +450,16 @@ void BPH_strands_solve_constraints(Scene *scene, Object *ob, BMEditStrands *edit
 		
 		BKE_collision_cache_free(contacts);
 	}
+	
+	strands_apply_root_locations(edit);
+	
+#ifdef STRAND_CONSTRAINT_EDGERELAX
+	strands_solve_edge_relaxation(edit);
+#endif
+#ifdef STRAND_CONSTRAINT_IK
+	strands_solve_inverse_kinematics(ob, edit, orig);
+#endif
+#ifdef STRAND_CONSTRAINT_LAGRANGEMULT
+	strands_solve_lagrange_multipliers(ob, edit, orig);
+#endif
 }




More information about the Bf-blender-cvs mailing list