diff options
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 0bda3b266b8..f2cd695d64a 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -820,8 +820,8 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas /* this is for float inaccuracy */ if (t < knots[0]) t = knots[0]; - else - if (t > knots[opp2]) t = knots[opp2]; + else if (t > knots[opp2]) + t = knots[opp2]; /* this part is order '1' */ o2 = order + 1; @@ -1050,10 +1050,13 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu, MEM_freeN(jend); } +/** + * \param coord_array Has to be 3 * 4 * pntsu * resolu in size and zero-ed + * \param tilt_array set when non-NULL + * \param radius_array set when non-NULL + */ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride) -/* coord_array has to be 3*4*pntsu*resolu in size and zero-ed - * tilt_array and radius_array will be written to if valid */ { BPoint *bp; float u, ustart, uend, ustep, sumdiv; @@ -1114,12 +1117,12 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float * sumdiv += *fp; } if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) { - /* is normalizing needed? */ - fp = sum; - for (i = istart; i <= iend; i++, fp++) { - *fp /= sumdiv; - } + /* is normalizing needed? */ + fp = sum; + for (i = istart; i <= iend; i++, fp++) { + *fp /= sumdiv; } + } /* one! (1.0) real point */ fp = sum; @@ -1476,7 +1479,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende } } else if (cu->ext1 == 0.0f && cu->ext2 == 0.0f) { - ; + /* pass */ } else if (cu->ext2 == 0.0f) { dl = MEM_callocN(sizeof(DispList), "makebevelcurve2"); @@ -1945,7 +1948,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter) if (bl->poly == -1) { /* check its not cyclic */ /* skip the first point */ - /* bevp0= bevp1; */ + /* bevp0 = bevp1; */ bevp1 = bevp2; bevp2++; nr--; @@ -1974,7 +1977,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter) interp_qt_qtqt(bevp1->quat, bevp1->quat, q, 0.5); normalize_qt(bevp1->quat); - /* bevp0= bevp1; */ /* UNUSED */ + /* bevp0 = bevp1; */ /* UNUSED */ bevp1 = bevp2; bevp2++; } @@ -2109,7 +2112,7 @@ static void make_bevel_list_3D_tangent(BevList *bl) BevPoint *bevp2, *bevp1, *bevp0; /* standard for all make_bevel_list_3D_* funcs */ int nr; - float bevp0_tan[3], cross_tmp[3]; + float bevp0_tan[3]; bevel_list_calc_bisect(bl); if (bl->poly == -1) /* check its not cyclic */ @@ -2123,6 +2126,7 @@ static void make_bevel_list_3D_tangent(BevList *bl) nr = bl->nr; while (nr--) { + float cross_tmp[3]; cross_v3_v3v3(cross_tmp, bevp1->tan, bevp1->dir); cross_v3_v3v3(bevp1->tan, cross_tmp, bevp1->dir); normalize_v3(bevp1->tan); @@ -2150,7 +2154,7 @@ static void make_bevel_list_3D_tangent(BevList *bl) normalize_v3(cross_tmp); tri_to_quat(bevp1->quat, zero, cross_tmp, bevp1->tan); /* XXX - could be faster */ - /* bevp0= bevp1; */ /* UNUSED */ + /* bevp0 = bevp1; */ /* UNUSED */ bevp1 = bevp2; bevp2++; } @@ -2477,8 +2481,8 @@ void BKE_curve_bevelList_make(Object *ob) else bevp2 = bevp1 + 1; - inp = (bevp1->vec[0] - bevp0->vec[0]) * (bevp0->vec[1] - bevp2->vec[1]) + - (bevp0->vec[1] - bevp1->vec[1]) * (bevp0->vec[0] - bevp2->vec[0]); + inp = ((bevp1->vec[0] - bevp0->vec[0]) * (bevp0->vec[1] - bevp2->vec[1]) + + (bevp0->vec[1] - bevp1->vec[1]) * (bevp0->vec[0] - bevp2->vec[0])); if (inp > 0.0f) sd->dir = 1; |