code cleanup: replace inline axis angle conversion with axis_angle_to_mat3()

This commit is contained in:
Campbell Barton
2012-04-02 06:43:16 +00:00
parent e23f752184
commit d2d2b8c2f2
2 changed files with 8 additions and 12 deletions

View File

@@ -708,7 +708,10 @@ void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const s
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 @@ void single_axis_angle_to_mat3(float mat[3][3], const char axis, const float ang
/****************************** 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 */

View File

@@ -464,9 +464,8 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
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 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
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++) {