[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45331] trunk/blender/source/blender: code cleanup: replace inline axis angle conversion with axis_angle_to_mat3 ()
Campbell Barton
ideasman42 at gmail.com
Mon Apr 2 08:43:31 CEST 2012
Revision: 45331
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45331
Author: campbellbarton
Date: 2012-04-02 06:43:16 +0000 (Mon, 02 Apr 2012)
Log Message:
-----------
code cleanup: replace inline axis angle conversion with axis_angle_to_mat3()
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/math_rotation.c
trunk/blender/source/blender/bmesh/operators/bmo_dupe.c
Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c 2012-04-02 06:26:52 UTC (rev 45330)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c 2012-04-02 06:43:16 UTC (rev 45331)
@@ -708,7 +708,10 @@
quat_to_axis_angle(axis, angle, q);
}
-/* axis angle to 3x3 matrix - safer version (normalization of axis performed) */
+/* axis angle to 3x3 matrix - safer version (normalization of axis performed)
+ *
+ * note: we may want a normalized and non normalized version of this function.
+ */
void axis_angle_to_mat3(float mat[3][3], const float axis[3], const float angle)
{
float nor[3], nsi[3], co, si, ico;
@@ -818,7 +821,7 @@
/****************************** Vector/Rotation ******************************/
/* TODO: the following calls should probably be depreceated sometime */
-/* axis angle to 3x3 matrix */
+/* ODO, replace use of this function with axis_angle_to_mat3() */
void vec_rot_to_mat3(float mat[][3], const float vec[3], const float phi)
{
/* rotation of phi radials around vec */
Modified: trunk/blender/source/blender/bmesh/operators/bmo_dupe.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_dupe.c 2012-04-02 06:26:52 UTC (rev 45330)
+++ trunk/blender/source/blender/bmesh/operators/bmo_dupe.c 2012-04-02 06:43:16 UTC (rev 45331)
@@ -464,9 +464,8 @@
BMOperator dupop, extop;
float cent[3], dvec[3];
float axis[3] = {0.0f, 0.0f, 1.0f};
- float q[4];
float rmat[3][3];
- float phi, si;
+ float phi;
int steps, do_dupli, a, usedvec;
BMO_slot_vec_get(op, "cent", cent);
@@ -475,16 +474,10 @@
BMO_slot_vec_get(op, "dvec", dvec);
usedvec = !is_zero_v3(dvec);
steps = BMO_slot_int_get(op, "steps");
- phi = BMO_slot_float_get(op, "ang") * (float)M_PI / (360.0f * steps);
+ phi = BMO_slot_float_get(op, "ang") * DEG2RADF(1.0f) / steps;
do_dupli = BMO_slot_bool_get(op, "do_dupli");
- /* BMESH_TODO - can replace this with BLI_math? */
- si = (float)sin(phi);
- q[0] = (float)cos(phi);
- q[1] = axis[0] * si;
- q[2] = axis[1] * si;
- q[3] = axis[2] * si;
- quat_to_mat3(rmat, q);
+ axis_angle_to_mat3(rmat, axis, phi);
BMO_slot_copy(op, op, "geom", "lastout");
for (a = 0; a < steps; a++) {
More information about the Bf-blender-cvs
mailing list