From c93e127e7a2040f74655937fedb5a9d439c03aa9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Jan 2013 14:28:23 +0000 Subject: code cleanup: style and replace (float)sin, (float)cos with sinf, cosf --- source/blender/blenkernel/intern/curve.c | 2 +- source/blender/blenkernel/intern/font.c | 6 +++--- source/blender/blenkernel/intern/mesh.c | 6 +++--- source/blender/blenkernel/intern/tracking.c | 2 +- source/blender/blenlib/intern/math_matrix.c | 4 ++-- source/blender/blenlib/intern/math_rotation.c | 8 ++++---- source/blender/editors/mesh/editmesh_knife.c | 2 +- source/blender/editors/space_node/node_draw.c | 8 ++++---- .../editors/transform/transform_manipulator.c | 8 ++++---- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 20 ++++++++++---------- source/creator/creator.c | 2 +- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index fe8bd0cc5a4..a9c4a7dcdc2 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1746,7 +1746,7 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si else t02 = (saacos(t02)) / 2.0f; - t02 = (float)sin(t02); + t02 = sinf(t02); if (t02 == 0.0f) t02 = 1.0f; diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index d4634748c71..3e1e55132d8 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -962,9 +962,9 @@ makebreak: float si, co; ct = chartransdata + cu->pos; - si = (float)sin(ct->rot); - co = (float)cos(ct->rot); - + si = sinf(ct->rot); + co = cosf(ct->rot); + f = cu->editfont->textcurs[0]; f[0] = cu->fsize * (-0.1f * co + ct->xof); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index dec7556392f..267cf1738b0 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1360,7 +1360,7 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase, int i; for (i = 0; i < 3; i++, mloopuv++) { - mloopuv->uv[0] = (mloop[i].v - startvert)/(float)(dl->nr - 1); + mloopuv->uv[0] = (mloop[i].v - startvert) / (float)(dl->nr - 1); mloopuv->uv[1] = 0.0f; } } @@ -1430,8 +1430,8 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase, /* find uv based on vertex index into grid array */ int v = mloop[i].v - startvert; - mloopuv->uv[0] = (v / dl->nr)/(float)orco_sizev; - mloopuv->uv[1] = (v % dl->nr)/(float)orco_sizeu; + mloopuv->uv[0] = (v / dl->nr) / (float)orco_sizev; + mloopuv->uv[1] = (v % dl->nr) / (float)orco_sizeu; /* cyclic correction */ if ((i == 0 || i == 1) && mloopuv->uv[1] == 0.0f) diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 801fecc9f7c..3c5d94a21e4 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1660,7 +1660,7 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea /* real sampling requires libmv, but areas are supposing pattern would be * sampled if search area does exists, so we'll need to create empty * pattern area here to prevent adding NULL-checks all over just to deal - * with situation when lubmv is disabled + * with situation when libmv is disabled */ (void) frame_width; diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 02fc5b07d6d..6784c4145a5 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1245,8 +1245,8 @@ void rotate_m4(float mat[4][4], const char axis, const float angle) assert(axis >= 'X' && axis <= 'Z'); - cosine = (float)cos(angle); - sine = (float)sin(angle); + cosine = cosf(angle); + sine = sinf(angle); switch (axis) { case 'X': for (col = 0; col < 4; col++) diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 71f146e8131..dc54bf9ace3 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -589,10 +589,10 @@ void interp_qt_qtqt(float result[4], const float quat1[4], const float quat2[4], } if ((1.0f - cosom) > 0.0001f) { - omega = (float)acos(cosom); - sinom = (float)sin(omega); - sc1 = (float)sin((1 - t) * omega) / sinom; - sc2 = (float)sin(t * omega) / sinom; + omega = acosf(cosom); + sinom = sinf(omega); + sc1 = sinf((1.0f - t) * omega) / sinom; + sc2 = sinf(t * omega) / sinom; } else { sc1 = 1.0f - t; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index b880980b246..e49dc3c28f9 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1750,7 +1750,7 @@ static void knife_snap_angle(KnifeTool_OpData *kcd) if (dx == 0.0f) { kcd->angle_snapping = ANGLE_90; - kcd->curr.mval[0] =kcd->prev.mval[0]; + kcd->curr.mval[0] = kcd->prev.mval[0]; } w = dy / dx; diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index e1d5e4200b8..2b106377f4e 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -454,8 +454,8 @@ static void node_update_hidden(bNode *node) for (nsock = node->outputs.first; nsock; nsock = nsock->next) { if (!nodeSocketIsHidden(nsock)) { - nsock->locx = node->totr.xmax - hiddenrad + (float)sin(rad) * hiddenrad; - nsock->locy = node->totr.ymin + hiddenrad + (float)cos(rad) * hiddenrad; + nsock->locx = node->totr.xmax - hiddenrad + sinf(rad) * hiddenrad; + nsock->locy = node->totr.ymin + hiddenrad + cosf(rad) * hiddenrad; rad += drad; } } @@ -465,8 +465,8 @@ static void node_update_hidden(bNode *node) for (nsock = node->inputs.first; nsock; nsock = nsock->next) { if (!nodeSocketIsHidden(nsock)) { - nsock->locx = node->totr.xmin + hiddenrad + (float)sin(rad) * hiddenrad; - nsock->locy = node->totr.ymin + hiddenrad + (float)cos(rad) * hiddenrad; + nsock->locx = node->totr.xmin + hiddenrad + sinf(rad) * hiddenrad; + nsock->locy = node->totr.ymin + hiddenrad + cosf(rad) * hiddenrad; rad += drad; } } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 6b016bf4303..cd6035a232b 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -734,8 +734,8 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i float cos_phi, sin_phi, dist; phi += side_delta; - cos_phi = (float)cos(phi); - sin_phi = (float)sin(phi); + cos_phi = cosf(phi); + sin_phi = sinf(phi); dist = radhole + radring * cos_phi; glVertex3f(cos_theta1 * dist, -sin_theta1 * dist, radring * sin_phi); @@ -749,8 +749,8 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i float cos_phi, sin_phi, dist; phi += side_delta; - cos_phi = (float)cos(phi); - sin_phi = (float)sin(phi); + cos_phi = cosf(phi); + sin_phi = sinf(phi); dist = radhole + radring * cos_phi; glVertex3f(cos_theta1 * dist, -sin_theta1 * dist, radring * sin_phi); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 81f548b2b5d..90feaa77fe5 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -965,18 +965,18 @@ static void uv_map_rotation_matrix(float result[4][4], RegionView3D *rv3d, Objec /* this is "kanonen gegen spatzen", a few plus minus 1 will do here */ /* i wanted to keep the reason here, so we're rotating*/ sideangle = (float)M_PI * (sideangledeg + 180.0f) / 180.0f; - rotside[0][0] = (float)cos(sideangle); - rotside[0][1] = -(float)sin(sideangle); - rotside[1][0] = (float)sin(sideangle); - rotside[1][1] = (float)cos(sideangle); - rotside[2][2] = 1.0f; + rotside[0][0] = cosf(sideangle); + rotside[0][1] = -sinf(sideangle); + rotside[1][0] = sinf(sideangle); + rotside[1][1] = cosf(sideangle); + rotside[2][2] = 1.0f; upangle = (float)M_PI * upangledeg / 180.0f; - rotup[1][1] = (float)cos(upangle) / radius; - rotup[1][2] = -(float)sin(upangle) / radius; - rotup[2][1] = (float)sin(upangle) / radius; - rotup[2][2] = (float)cos(upangle) / radius; - rotup[0][0] = (float)1.0f / radius; + rotup[1][1] = cosf(upangle) / radius; + rotup[1][2] = -sinf(upangle) / radius; + rotup[2][1] = sinf(upangle) / radius; + rotup[2][2] = cosf(upangle) / radius; + rotup[0][0] = 1.0f / radius; /* calculate transforms*/ mul_serie_m4(result, rotup, rotside, viewmatrix, rotobj, NULL, NULL, NULL, NULL); diff --git a/source/creator/creator.c b/source/creator/creator.c index 4a2274180e7..70123187721 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -516,7 +516,7 @@ static void blender_crash_handler(int signum) fp = BLI_fopen(fname, "wb"); if (fp == NULL) { fprintf(stderr, "Unable to save '%s': %s\n", - fname, errno ? strerror(errno) : "Unknown error opening file"); + fname, errno ? strerror(errno) : "Unknown error opening file"); } else { if (wm) { -- cgit v1.2.3