Fix T80742: curve bevel fails with zero length handles at end-point

Initialize the direction on the first/last points of the curve.

The fix from 23a4149778 exposed this error.
This commit is contained in:
Campbell Barton 2020-11-05 18:15:45 +11:00
parent 60c3ef3d61
commit 4987b7d347
Notes: blender-bot 2023-02-14 10:18:56 +01:00
Referenced by commit 5f1a155a5e, Fix T83117: Curve bevel not handle aligned at end-points
Referenced by commit 71ff935fd6, Revert "Fix T80742: curve bevel fails with zero length handles at end-point"
Referenced by issue #80742, Bezier incorrect behavior during transformations
1 changed files with 16 additions and 0 deletions

View File

@ -2202,6 +2202,22 @@ static void bevel_list_calc_bisect(BevList *bl)
bevp1 = bevp2;
bevp2++;
}
if (is_cyclic == false) {
bevp0 = &bl->bevpoints[0];
bevp1 = &bl->bevpoints[1];
sub_v3_v3v3(bevp0->dir, bevp1->vec, bevp0->vec);
if (normalize_v3(bevp0->dir) == 0.0f) {
copy_v3_v3(bevp0->dir, bevp1->dir);
}
bevp0 = &bl->bevpoints[bl->nr - 2];
bevp1 = &bl->bevpoints[bl->nr - 1];
sub_v3_v3v3(bevp1->dir, bevp1->vec, bevp0->vec);
if (normalize_v3(bevp1->dir) == 0.0f) {
copy_v3_v3(bevp1->dir, bevp0->dir);
}
}
}
static void bevel_list_flip_tangents(BevList *bl)
{