diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-24 14:25:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-24 14:26:16 +0400 |
commit | 1decd824f3edcb612acd7251ebaa3b2884398b19 (patch) | |
tree | 593dcef16ad71ec9275ae77510cc130dbcf6e95b /source/blender/bmesh | |
parent | 0c7d2de38219641fc41d468eec675933e26a3602 (diff) |
Code Cleanup: use math functions and reduce View3d axis drawing into a loop
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/operators/bmo_primitive.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 6a540928d43..01948403f84 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -301,8 +301,9 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) BMVert *eve, *preveve; BMEdge *e; BMIter iter; - float vec[3], mat[4][4], cmat[3][3], phi, q[4]; - float phid; + const float axis[3] = {0, 0, 1}; + float vec[3], mat[4][4], cmat[3][3]; + float phi, phid; int a; BMO_slot_mat4_get(op->slots_in, "matrix", mat); @@ -331,11 +332,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) } /* extrude and rotate; negative phi to make normals face outward */ - phi = -M_PI / seg; - q[0] = cosf(phi); - q[3] = sinf(phi); - q[1] = q[2] = 0.0f; - quat_to_mat3(cmat, q); + axis_angle_to_mat3(cmat, axis, -(M_PI * 2) / seg); for (a = 0; a < seg; a++) { if (a) { |