diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-09-17 08:11:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-09-24 08:55:02 +0400 |
commit | 3a40aed3d52aeb24973385d3aa8e0c2234bf0435 (patch) | |
tree | a4a51efdc304420f0163ea40e1a14a4e206e3828 /source/blender/editors | |
parent | e7f495d8a076c35d2088d73fac0ed2eeb5ea1fbb (diff) |
Cleanup: use float versions of functions when in/output are floats
Diffstat (limited to 'source/blender/editors')
13 files changed, 51 insertions, 51 deletions
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index e4ba8728e55..75fa4a5433f 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -245,7 +245,7 @@ int join_armature_exec(bContext *C, wmOperator *op) invert_m4_m4(imat, premat); mul_m4_m4m4(difmat, imat, postmat); - curbone->roll -= (float)atan2(difmat[2][0], difmat[2][2]); + curbone->roll -= atan2f(difmat[2][0], difmat[2][2]); } /* Fix Constraints and Other Links to this Bone and Armature */ diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 5cd6b1e2b4c..11b9b9c83cc 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2172,8 +2172,8 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * glVertex2f(centx, centy); for (a = 0; a <= tot; a++, ang += radstep) { - float si = sin(ang); - float co = cos(ang); + float si = sinf(ang); + float co = cosf(ang); ui_hsvcircle_vals_from_pos(hsv, hsv + 1, rect, centx + co * radius, centy + si * radius); @@ -3841,7 +3841,7 @@ void ui_draw_pie_center(uiBlock *block) int subd = 40; - float angle = atan2(pie_dir[1], pie_dir[0]); + float angle = atan2f(pie_dir[1], pie_dir[0]); float range = (block->pie_data.flags & UI_PIE_DEGREES_RANGE_LARGE) ? ((float)M_PI / 2.0f) : ((float)M_PI / 4.0f); glPushMatrix(); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 5401cef8351..76344b77dd3 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -319,7 +319,7 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra) if (pset->flag & PE_FADE_TIME && pset->selectmode==SCE_SELECT_POINT) { LOOP_POINTS { LOOP_KEYS { - if (fabs(cfra-*key->time) < pset->fade_frames) + if (fabsf(cfra - *key->time) < pset->fade_frames) key->flag &= ~PEK_HIDE; else { key->flag |= PEK_HIDE; @@ -463,7 +463,7 @@ static bool key_inside_circle(PEData *data, float rad, const float co[3], float dx= data->mval[0] - screen_co[0]; dy= data->mval[1] - screen_co[1]; - dist= sqrt(dx*dx + dy*dy); + dist = sqrtf(dx * dx + dy * dy); if (dist > rad) return 0; @@ -2932,7 +2932,7 @@ static void brush_cut(PEData *data, int pa_index) d= dv * rad2 - d*d; if (d > 0.0f) { - d= sqrt(d); + d= sqrtf(d); cut_time= -(v0*xo0 + v1*xo1 + d); @@ -3678,7 +3678,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) pset->flag &= ~PE_LOCK_FIRST; if (((pset->brushtype == PE_BRUSH_ADD) ? - (sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0)) || bedit->first) + (sqrtf(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0)) || bedit->first) { PEData data= bedit->data; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 165888b3c09..5530f947b8c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1564,7 +1564,7 @@ void paint_2d_gradient_fill( sub_v2_v2v2(tangent, image_final, image_init); line_len = len_squared_v2(tangent); line_len_sq_inv = 1.0f / line_len; - line_len = sqrt(line_len); + line_len = sqrtf(line_len); do_float = (ibuf->rect_float != NULL); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index e9d1d5487a0..ee9181b7d3f 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -4077,7 +4077,7 @@ static void *do_projectpaint_thread(void *ph_v) sub_v2_v2v2(tangent, pos, lastpos); line_len = len_squared_v2(tangent); line_len_sq_inv = 1.0f / line_len; - line_len = sqrt(line_len); + line_len = sqrtf(line_len); switch (brush->gradient_fill_mode) { case BRUSH_GRADIENT_LINEAR: diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 9eaaf5fe122..dc6be9caa53 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -667,7 +667,7 @@ static void stencil_set_target(StencilControlData *scd) scd->lenorig = len_v2(mdiff); - scd->init_angle = atan2(mdiff[1], mdiff[0]); + scd->init_angle = atan2f(mdiff[1], mdiff[0]); } static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -763,7 +763,7 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2] { float angle; sub_v2_v2v2(mdiff, mvalf, scd->pos_target); - angle = atan2(mdiff[1], mdiff[0]); + angle = atan2f(mdiff[1], mdiff[0]); angle = scd->init_rot + angle - scd->init_angle; if (angle < 0.0f) angle += (float)(2 * M_PI); @@ -916,7 +916,7 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op) stencil_area = br->stencil_dimension[0] * br->stencil_dimension[1]; } - factor = sqrt(stencil_area / orig_area); + factor = sqrtf(stencil_area / orig_area); if (do_mask) { br->mask_stencil_dimension[0] = factor * aspx; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 8f189b49aa6..1ed5ad8160c 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -283,9 +283,9 @@ static bool paint_brush_update(bContext *C, const float dx = mouse[0] - stroke->initial_mouse[0]; const float dy = mouse[1] - stroke->initial_mouse[1]; - ups->anchored_size = ups->pixel_radius = sqrt(dx * dx + dy * dy); + ups->anchored_size = ups->pixel_radius = sqrtf(dx * dx + dy * dy); - ups->brush_rotation = atan2(dx, dy) + M_PI; + ups->brush_rotation = atan2f(dx, dy) + M_PI; if (brush->flag & BRUSH_EDGE_TO_EDGE) { halfway[0] = dx * 0.5f + stroke->initial_mouse[0]; @@ -498,7 +498,7 @@ static float paint_stroke_overlapped_curve(Brush *br, float x, float spacing) for (i = 0; i < n; i++) { float xx; - xx = fabs(x0 + i * h); + xx = fabsf(x0 + i * h); if (xx < 1.0f) sum += BKE_brush_curve_strength(br, xx, 1); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 33d0510c08a..7e518242b00 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -550,7 +550,7 @@ static bool sculpt_brush_test(SculptBrushTest *test, const float co[3]) if (sculpt_brush_test_clipping(test, co)) { return 0; } - test->dist = sqrt(distsq); + test->dist = sqrtf(distsq); return 1; } else { @@ -2553,7 +2553,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist), + const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2626,7 +2626,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist), + const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2792,7 +2792,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength(ss, brush, vd.co, - sqrt(test.dist), + sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2856,7 +2856,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength(ss, brush, vd.co, - sqrt(test.dist), + sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2899,7 +2899,7 @@ static void do_gravity(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, fl BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if (sculpt_brush_test_sq(&test, vd.co)) { - const float fade = tex_strength(ss, brush, vd.co, sqrt(test.dist), vd.no, + const float fade = tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], offset, fade); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 292d6236bab..5b46e5c3a59 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -273,7 +273,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, Temp_UVData *tmp_uvdata; float diff[2]; int i; - float radius_root = sqrt(radius); + float radius_root = sqrtf(radius); Brush *brush = BKE_paint_brush(sculptdata->uvsculpt); tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data"); @@ -316,7 +316,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter)); sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter)); @@ -345,7 +345,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul Temp_UVData *tmp_uvdata; float diff[2]; int i; - float radius_root = sqrt(radius); + float radius_root = sqrtf(radius); Brush *brush = BKE_paint_brush(sculptdata->uvsculpt); tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data"); @@ -380,7 +380,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0]; sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1]; @@ -434,7 +434,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e /* We will compare squares to save some computation */ radius = radius * radius; - radius_root = sqrt(radius); + radius_root = sqrtf(radius); /* * Pinch Tool @@ -455,7 +455,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); normalize_v2(diff); sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001f; @@ -803,7 +803,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm aspectRatio = width / (float)height; radius /= (width * zoomx); radius = radius * radius; - radius_root = sqrt(radius); + radius_root = sqrtf(radius); /* Allocate selection stack */ data->initial_stroke = MEM_mallocN(sizeof(*data->initial_stroke), "uv_sculpt_initial_stroke"); @@ -829,7 +829,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm diff[1] /= aspectRatio; if ((dist = dot_v2v2(diff, diff)) <= radius) { float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); data->initial_stroke->initialSelection[counter].uv = i; data->initial_stroke->initialSelection[counter].strength = strength; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index db675b09896..cff6761d628 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1037,8 +1037,8 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) * - dragged. */ phi = si * (float)(M_PI / 2.0); - q1[0] = cos(phi); - mul_v3_fl(q1 + 1, sin(phi)); + q1[0] = cosf(phi); + mul_v3_fl(q1 + 1, sinf(phi)); mul_qt_qtqt(vod->viewquat, q1, vod->oldquat); viewrotate_apply_dyn_ofs(vod, vod->viewquat); @@ -1448,7 +1448,7 @@ static void view3d_ndof_orbit(const struct wmNDOFMotionData *ndof, ScrArea *sa, /* Perform the up/down rotation */ angle = ndof->dt * rot[0]; quat[0] = cosf(angle); - mul_v3_v3fl(quat + 1, xvec, sin(angle)); + mul_v3_v3fl(quat + 1, xvec, sinf(angle)); mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, quat); /* Perform the orbital rotation */ diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 7bdf39d6768..c54948b23c6 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -961,7 +961,7 @@ static int walkApply(bContext *C, WalkInfo *walk) /* clamp the angle limits */ /* it ranges from 90.0f to -90.0f */ - angle = -asin(rv3d->viewmat[2][2]); + angle = -asinf(rv3d->viewmat[2][2]); if (angle > WALK_TOP_LIMIT && y > 0.0f) y = 0.0f; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index abef2c9fc30..fcdebad02d1 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -872,9 +872,9 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3]) cross_v3_v3v3(tmp, start, end); if (dot_v3v3(tmp, axis) < 0.0f) - angle = -acos(dot_v3v3(start, end)); + angle = -acosf(dot_v3v3(start, end)); else - angle = acos(dot_v3v3(start, end)); + angle = acosf(dot_v3v3(start, end)); } else { float mtx[3][3]; @@ -884,7 +884,7 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3]) mul_m3_v3(mtx, end); mul_m3_v3(mtx, start); - angle = atan2(start[1], start[0]) - atan2(end[1], end[0]); + angle = atan2f(start[1], start[0]) - atan2f(end[1], end[0]); } if (angle > (float)M_PI) { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 5f22a201600..79f53e1d971 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -372,7 +372,7 @@ static float p_vec_angle(float *v1, float *v2, float *v3) else if (dot >= 1.0f) return 0.0f; else - return (float)acos(dot); + return acosf(dot); } static float p_vec2_angle(float *v1, float *v2, float *v3) @@ -433,7 +433,7 @@ static float p_edge_length(PEdge *e) d[1] = v2->co[1] - v1->co[1]; d[2] = v2->co[2] - v1->co[2]; - return sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + return sqrtf(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); } static float p_edge_uv_length(PEdge *e) @@ -444,7 +444,7 @@ static float p_edge_uv_length(PEdge *e) d[0] = v2->uv[0] - v1->uv[0]; d[1] = v2->uv[1] - v1->uv[1]; - return sqrt(d[0] * d[0] + d[1] * d[1]); + return sqrtf(d[0] * d[0] + d[1] * d[1]); } static void p_chart_uv_bbox(PChart *chart, float minv[2], float maxv[2]) @@ -2353,8 +2353,8 @@ static void p_abf_compute_sines(PAbfSystem *sys) float *sine = sys->sine, *cosine = sys->cosine, *alpha = sys->alpha; for (i = 0; i < sys->nangles; i++, sine++, cosine++, alpha++) { - *sine = sin(*alpha); - *cosine = cos(*alpha); + *sine = sinf(*alpha); + *cosine = cosf(*alpha); } } @@ -3163,9 +3163,9 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart) SWAP(PVert *, v2, v3); } - sina1 = sin(a1); - sina2 = sin(a2); - sina3 = sin(a3); + sina1 = sinf(a1); + sina2 = sinf(a2); + sina3 = sinf(a3); sinmax = max_fff(sina1, sina2, sina3); @@ -3314,7 +3314,7 @@ static float p_face_stretch(PFace *f) a = dot_v3v3(Ps, Ps); c = dot_v3v3(Pt, Pt); - T = sqrt(0.5f * (a + c)); + T = sqrtf(0.5f * (a + c)); if (f->flag & PFACE_FILLED) T *= 0.2f; @@ -3630,8 +3630,8 @@ static float p_chart_minimum_area_angle(PChart *chart) static void p_chart_rotate_minimum_area(PChart *chart) { float angle = p_chart_minimum_area_angle(chart); - float sine = sin(angle); - float cosine = cos(angle); + float sine = sinf(angle); + float cosine = cosf(angle); PVert *v; for (v = chart->verts; v; v = v->nextlink) { @@ -4045,7 +4045,7 @@ static void p_smooth(PChart *chart) diff[0] = p[0] - oldp[0]; diff[1] = p[1] - oldp[1]; - length = sqrt(diff[0] * diff[0] + diff[1] * diff[1]); + length = len_v2(diff); d = max_ff(d, length); moved += length; } @@ -4559,7 +4559,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate) box->index = i; /* warning this index skips PCHART_NOPACK boxes */ if (margin > 0.0f) - area += sqrt(box->w * box->h); + area += sqrtf(box->w * box->h); } if (margin > 0.0f) { @@ -4661,7 +4661,7 @@ void param_average(ParamHandle *handle) /* Move center to 0,0 */ p_chart_uv_translate(chart, trans); - p_chart_uv_scale(chart, sqrt(fac / tot_fac)); + p_chart_uv_scale(chart, sqrtf(fac / tot_fac)); /* Move to original center */ trans[0] = -trans[0]; |