[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45232] trunk/blender/source/blender/ editors: code cleanup: Ctrl+Click extrude - replace inline axis/ angle to matrix conversion with a call to axis_angle_to_mat3()

Campbell Barton ideasman42 at gmail.com
Wed Mar 28 08:34:27 CEST 2012


Revision: 45232
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45232
Author:   campbellbarton
Date:     2012-03-28 06:34:18 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
code cleanup: Ctrl+Click extrude - replace inline axis/angle to matrix conversion with a call to axis_angle_to_mat3()

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editmesh_tools.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2012-03-28 05:44:38 UTC (rev 45231)
+++ trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2012-03-28 06:34:18 UTC (rev 45232)
@@ -805,29 +805,23 @@
 		/* calculate rotation */
 		unit_m3(mat);
 		if (done) {
-			float dot;
+			float angle;
 
-			copy_v3_v3(vec, min);
-			normalize_v3(vec);
-			dot = dot_v3v3(vec, nor);
+			normalize_v3_v3(vec, min);
 
-			if (fabsf(dot) < 0.999f) {
-				float cross[3], si, q1[4];
+			angle = angle_normalized_v3v3(vec, nor);
 
-				cross_v3_v3v3(cross, nor, vec);
-				normalize_v3(cross);
-				dot = 0.5f * saacos(dot);
+			if (angle != 0.0f) {
+				float axis[3];
 
+				cross_v3_v3v3(axis, nor, vec);
+
 				/* halve the rotation if its applied twice */
-				if (rot_src) dot *= 0.5f;
+				if (rot_src) {
+					angle *= 0.5f;
+				}
 
-				si = sinf(dot);
-				q1[0] = cosf(dot);
-				q1[1] = cross[0] * si;
-				q1[2] = cross[1] * si;
-				q1[3] = cross[2] * si;
-				normalize_qt(q1);
-				quat_to_mat3(mat, q1);
+				axis_angle_to_mat3(mat, axis, angle);
 			}
 		}
 		

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2012-03-28 05:44:38 UTC (rev 45231)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2012-03-28 06:34:18 UTC (rev 45232)
@@ -103,7 +103,8 @@
 
 /* Sculpt mode handles multires differently from regular meshes, but only if
  * it's the last modifier on the stack and it is not on the first level */
-struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob){
+struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
+{
 	Mesh *me = (Mesh *)ob->data;
 	ModifierData *md;
 




More information about the Bf-blender-cvs mailing list