[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15738] branches/harmonic-skeleton/source/ blender/blenlib/intern/graph.c: Axial symmetry stability bug fix.

Martin Poirier theeth at yahoo.com
Thu Jul 24 21:12:30 CEST 2008


Revision: 15738
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15738
Author:   theeth
Date:     2008-07-24 21:12:30 +0200 (Thu, 24 Jul 2008)

Log Message:
-----------
Axial symmetry stability bug fix.

Axial symmetry tagging was depending on the order of the nodes, so it might tag left side as right and vice versa depending on the order. Stability test ensures the tagging is order independant (what it tags as right and left might not be the real right and left, but at least they are consistant between mesh graph and armature graph, so it doesn't flip limbs)

Modified Paths:
--------------
    branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c

Modified: branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c
===================================================================
--- branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c	2008-07-24 18:00:46 UTC (rev 15737)
+++ branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c	2008-07-24 19:12:30 UTC (rev 15738)
@@ -714,15 +714,28 @@
 {
 	float nor[3], vec[3], p[3];
 
-	VecSubf(vec, node1->p, root_node->p);
-	Normalize(vec);
+	VecSubf(p, node1->p, root_node->p);
+	Crossf(nor, p, axis);
+
 	VecSubf(p, root_node->p, node2->p);
-	Normalize(p);
-	VecAddf(p, p, vec);
-
 	Crossf(vec, p, axis);
+	VecAddf(vec, vec, nor);
+	
 	Crossf(nor, vec, axis);
 	
+	if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0)
+	{
+		VecMulf(nor, -1);
+	}
+	else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0)
+	{
+		VecMulf(nor, -1);
+	}
+	else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0)
+	{
+		VecMulf(nor, -1);
+	}
+	
 	/* mirror node2 along axis */
 	VECCOPY(p, node2->p);
 	BLI_mirrorAlongAxis(p, root_node->p, nor);





More information about the Bf-blender-cvs mailing list