[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32776] trunk/blender/source/blender/ blenlib/intern/math_rotation.c: Fix for [#24458] Problem with Axis Angle rotation

Janne Karhu jhkarh at gmail.com
Sat Oct 30 19:42:08 CEST 2010


Revision: 32776
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32776
Author:   jhk
Date:     2010-10-30 19:42:08 +0200 (Sat, 30 Oct 2010)

Log Message:
-----------
Fix for [#24458] Problem with Axis Angle rotation
* Added checks to handle zero axis vector.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/math_rotation.c

Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c	2010-10-30 17:34:24 UTC (rev 32775)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c	2010-10-30 17:42:08 UTC (rev 32776)
@@ -592,8 +592,11 @@
 	float nor[3];
 	float si;
 
-	normalize_v3_v3(nor, axis);
-	
+	if(normalize_v3_v3(nor, axis) == 0.0f) {
+		unit_qt(q);
+		return;
+	}
+
 	angle /= 2;
 	si = (float)sin(angle);
 	q[0] = (float)cos(angle);
@@ -649,7 +652,10 @@
 	float nor[3], nsi[3], co, si, ico;
 	
 	/* normalise the axis first (to remove unwanted scaling) */
-	normalize_v3_v3(nor, axis);
+	if(normalize_v3_v3(nor, axis) == 0.0f) {
+		unit_m3(mat);
+		return;
+	}
 	
 	/* now convert this to a 3x3 matrix */
 	co= (float)cos(angle);		





More information about the Bf-blender-cvs mailing list