Cleanup: use const, doc-string for BevList.poly & rename args

It wasn't clear that BevList.poly was used to check cyclic BevList's.
This commit is contained in:
Campbell Barton 2023-01-24 16:38:04 +11:00
parent 36a82314a0
commit 6279042d21
2 changed files with 11 additions and 9 deletions

View File

@ -2063,7 +2063,7 @@ static void bevel_list_calc_bisect(BevList *bl)
{
BevPoint *bevp2, *bevp1, *bevp0;
int nr;
bool is_cyclic = bl->poly != -1;
const bool is_cyclic = bl->poly != -1;
if (is_cyclic) {
bevp2 = bl->bevpoints;
@ -2229,19 +2229,19 @@ static void make_bevel_list_3D_zup(BevList *bl)
}
}
static void minimum_twist_between_two_points(BevPoint *current_point, BevPoint *previous_point)
static void minimum_twist_between_two_points(BevPoint *bevp_curr, const BevPoint *bevp_prev)
{
float angle = angle_normalized_v3v3(previous_point->dir, current_point->dir);
float q[4];
float angle = angle_normalized_v3v3(bevp_prev->dir, bevp_curr->dir);
if (angle > 0.0f) { /* otherwise we can keep as is */
float q[4];
float cross_tmp[3];
cross_v3_v3v3(cross_tmp, previous_point->dir, current_point->dir);
cross_v3_v3v3(cross_tmp, bevp_prev->dir, bevp_curr->dir);
axis_angle_to_quat(q, cross_tmp, angle);
mul_qt_qtqt(current_point->quat, q, previous_point->quat);
mul_qt_qtqt(bevp_curr->quat, q, bevp_prev->quat);
}
else {
copy_qt_qt(current_point->quat, previous_point->quat);
copy_qt_qt(bevp_curr->quat, bevp_prev->quat);
}
}
@ -2894,7 +2894,7 @@ void BKE_curve_bevelList_make(Object *ob, const ListBase *nurbs, const bool for_
/* Scale the threshold so high resolution shapes don't get over reduced, see: T49850. */
const float threshold_resolu = 0.00001f / resolu;
bool is_cyclic = bl->poly != -1;
const bool is_cyclic = bl->poly != -1;
nr = bl->nr;
if (is_cyclic) {
bevp1 = bl->bevpoints;

View File

@ -47,7 +47,9 @@ typedef struct BevPoint {
typedef struct BevList {
struct BevList *next, *prev;
int nr, dupe_nr;
int poly, hole;
/** Cyclic when set to any value besides -1. */
int poly;
int hole;
int charidx;
int *segbevcount;
float *seglen;