diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 11:33:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 13:17:08 +0300 |
commit | f68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch) | |
tree | 2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/blenkernel/intern/curve.cc | |
parent | c7b247a118e302a3afc6473797e53b6af28b69e2 (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/blenkernel/intern/curve.cc')
-rw-r--r-- | source/blender/blenkernel/intern/curve.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/curve.cc b/source/blender/blenkernel/intern/curve.cc index 652315e74f9..ddd1f000644 100644 --- a/source/blender/blenkernel/intern/curve.cc +++ b/source/blender/blenkernel/intern/curve.cc @@ -1682,7 +1682,7 @@ void BKE_curve_calc_coords_axis(const BezTriple *bezt_array, bezt_next->vec[0][axis], bezt_next->vec[1][axis], r_points_offset, - (int)resolu, + int(resolu), stride); r_points_offset = (float *)POINTER_OFFSET(r_points_offset, resolu_stride); } @@ -1695,7 +1695,7 @@ void BKE_curve_calc_coords_axis(const BezTriple *bezt_array, bezt_next->vec[0][axis], bezt_next->vec[1][axis], r_points_offset, - (int)resolu, + int(resolu), stride); r_points_offset = (float *)POINTER_OFFSET(r_points_offset, resolu_stride); if (use_cyclic_duplicate_endpoint) { @@ -1719,7 +1719,7 @@ void BKE_curve_forward_diff_bezier( float rt0, rt1, rt2, rt3, f; int a; - f = (float)it; + f = float(it); rt0 = q0; rt1 = 3.0f * (q1 - q0) / f; f *= f; @@ -1747,7 +1747,7 @@ void BKE_curve_forward_diff_tangent_bezier( float rt0, rt1, rt2, f; int a; - f = 1.0f / (float)it; + f = 1.0f / float(it); rt0 = 3.0f * (q1 - q0); rt1 = f * (3.0f * (q3 - q0) + 9.0f * (q1 - q2)); @@ -1778,7 +1778,7 @@ static void forward_diff_bezier_cotangent(const float p0[3], * * This could also be optimized like BKE_curve_forward_diff_bezier */ for (int a = 0; a <= it; a++) { - float t = (float)a / (float)it; + float t = float(a) / float(it); for (int i = 0; i < 3; i++) { p[i] = (-6.0f * t + 6.0f) * p0[i] + (18.0f * t - 12.0f) * p1[i] + @@ -2005,7 +2005,7 @@ static void tilt_bezpart(const BezTriple *prevbezt, } fac = 0.0; - dfac = 1.0f / (float)resolu; + dfac = 1.0f / float(resolu); for (a = 0; a < resolu; a++, fac += dfac) { if (tilt_array) { @@ -2328,7 +2328,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl) nr = bl->nr; while (nr--) { - ang_fac = angle * (1.0f - ((float)nr / bl->nr)); /* also works */ + ang_fac = angle * (1.0f - (float(nr) / bl->nr)); /* also works */ axis_angle_to_quat(q, bevp1->dir, ang_fac); mul_qt_qtqt(bevp1->quat, q, bevp1->quat); @@ -2515,7 +2515,7 @@ static void make_bevel_list_2D(BevList *bl) /* first */ bevp = bl->bevpoints; - angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)M_PI_2; + angle = atan2f(bevp->dir[0], bevp->dir[1]) - float(M_PI_2); bevp->sina = sinf(angle); bevp->cosa = cosf(angle); vec_to_quat(bevp->quat, bevp->dir, 5, 1); @@ -2523,7 +2523,7 @@ static void make_bevel_list_2D(BevList *bl) /* last */ bevp = bl->bevpoints; bevp += (bl->nr - 1); - angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)M_PI_2; + angle = atan2f(bevp->dir[0], bevp->dir[1]) - float(M_PI_2); bevp->sina = sinf(angle); bevp->cosa = cosf(angle); vec_to_quat(bevp->quat, bevp->dir, 5, 1); @@ -5153,7 +5153,7 @@ bool BKE_curve_center_median(Curve *cu, float cent[3]) } if (total) { - mul_v3_fl(cent, 1.0f / (float)total); + mul_v3_fl(cent, 1.0f / float(total)); } return (total != 0); @@ -5392,7 +5392,7 @@ bool BKE_curve_material_index_validate(Curve *cu) void BKE_curve_material_remap(Curve *cu, const uint *remap, uint remap_len) { const int curvetype = BKE_curve_type_get(cu); - const short remap_len_short = (short)remap_len; + const short remap_len_short = short(remap_len); #define MAT_NR_REMAP(n) \ if (n < remap_len_short) { \ |