[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33553] trunk/blender/source/blender/ blenlib/intern/math_rotation.c: edits to last commit, only report quat errors with DEBUG builds - as with assert()'s, and print the size.

Campbell Barton ideasman42 at gmail.com
Wed Dec 8 11:52:45 CET 2010


Revision: 33553
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33553
Author:   campbellbarton
Date:     2010-12-08 11:52:44 +0100 (Wed, 08 Dec 2010)

Log Message:
-----------
edits to last commit, only report quat errors with DEBUG builds - as with assert()'s, and print the size.

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-12-08 09:57:21 UTC (rev 33552)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c	2010-12-08 10:52:44 UTC (rev 33553)
@@ -183,11 +183,12 @@
 
 void quat_to_mat3(float m[][3], const float q[4])
 {
-	/* throw an error if the quat isn't normalized */
+#ifdef DEBUG
 	float f;
 	if(!((f=dot_qtqt(q, q))==0.0 || (fabs(f-1.0) < QUAT_EPSILON))) {
-		fprintf(stderr, "Warning! quat_to_mat3() called with non-normalized quat *** report a bug ***\n");
+		fprintf(stderr, "Warning! quat_to_mat3() called with non-normalized: size %.8f *** report a bug ***\n", f);
 	}
+#endif
 
 	quat_to_mat3_no_error(m, q);
 }
@@ -196,10 +197,11 @@
 {
 	double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc;
 
-	/* throw an error if the quat isn't normalized */
+#ifdef DEBUG
 	if(!((q0=dot_qtqt(q, q))==0.0 || (fabs(q0-1.0) < QUAT_EPSILON))) {
-		fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized quat *** report a bug ***\n");
+		fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
 	}
+#endif
 
 	q0= M_SQRT2 * q[0];
 	q1= M_SQRT2 * q[1];
@@ -649,9 +651,11 @@
 {
 	float ha, si;
 
+#ifdef DEBUG
 	if(!((ha=dot_qtqt(q, q))==0.0 || (fabs(ha-1.0) < QUAT_EPSILON))) {
-		fprintf(stderr, "Warning! quat_to_mat3() called with non-normalized quat *** report a bug ***\n");
+		fprintf(stderr, "Warning! quat_to_axis_angle() called with non-normalized: size %.8f *** report a bug ***\n", ha);
 	}
+#endif
 
 	/* calculate angle/2, and sin(angle/2) */
 	ha= (float)acos(q[0]);





More information about the Bf-blender-cvs mailing list