Fix #36467: ends of curves - 2D differs to 3D
This is getting confused, why bevel is handled different for 2D and 3D curves? Anyway, made bevel work for 2D case nice again, but it's probably nice to unify 2D and 3D cases.
This commit is contained in:
parent
2c2206a272
commit
9e42f76bab
|
@ -2372,12 +2372,23 @@ static void make_bevel_list_2D(BevList *bl)
|
|||
/* note: bevp->dir and bevp->quat are not needed for beveling but are
|
||||
* used when making a path from a 2D curve, therefor they need to be set - Campbell */
|
||||
|
||||
BevPoint *bevp2 = (BevPoint *)(bl + 1);
|
||||
BevPoint *bevp1 = bevp2 + (bl->nr - 1);
|
||||
BevPoint *bevp0 = bevp1 - 1;
|
||||
BevPoint *bevp0, *bevp1, *bevp2;
|
||||
int nr;
|
||||
|
||||
nr = bl->nr;
|
||||
if (bl->poly != -1) {
|
||||
bevp2 = (BevPoint *)(bl + 1);
|
||||
bevp1 = bevp2 + (bl->nr - 1);
|
||||
bevp0 = bevp1 - 1;
|
||||
nr = bl->nr;
|
||||
}
|
||||
else {
|
||||
bevp0 = (BevPoint *)(bl + 1);
|
||||
bevp1 = bevp0 + 1;
|
||||
bevp2 = bevp1 + 1;
|
||||
|
||||
nr = bl->nr - 2;
|
||||
}
|
||||
|
||||
while (nr--) {
|
||||
const float x1 = bevp1->vec[0] - bevp0->vec[0];
|
||||
const float x2 = bevp1->vec[0] - bevp2->vec[0];
|
||||
|
@ -2399,15 +2410,23 @@ static void make_bevel_list_2D(BevList *bl)
|
|||
|
||||
/* correct non-cyclic cases */
|
||||
if (bl->poly == -1) {
|
||||
BevPoint *bevp = (BevPoint *)(bl + 1);
|
||||
bevp1 = bevp + 1;
|
||||
bevp->sina = bevp1->sina;
|
||||
bevp->cosa = bevp1->cosa;
|
||||
BevPoint *bevp;
|
||||
float angle;
|
||||
|
||||
/* first */
|
||||
bevp = (BevPoint *)(bl + 1);
|
||||
angle = atan2(bevp->dir[0], bevp->dir[1]) - M_PI / 2.0;
|
||||
bevp->sina = sinf(angle);
|
||||
bevp->cosa = cosf(angle);
|
||||
vec_to_quat(bevp->quat, bevp->dir, 5, 1);
|
||||
|
||||
/* last */
|
||||
bevp = (BevPoint *)(bl + 1);
|
||||
bevp += (bl->nr - 1);
|
||||
bevp1 = bevp - 1;
|
||||
bevp->sina = bevp1->sina;
|
||||
bevp->cosa = bevp1->cosa;
|
||||
angle = atan2(bevp->dir[0], bevp->dir[1]) - M_PI / 2.0;
|
||||
bevp->sina = sinf(angle);
|
||||
bevp->cosa = cosf(angle);
|
||||
vec_to_quat(bevp->quat, bevp->dir, 5, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue