Partial fix for T38871, Bevel could create a far-out spike.
There needed to be a check that when a newly created point is supposed to be on an edge, that it stays within the bounds of either end of the edge. This fixes the hole-in-cube example in the bug, but not the boolean modifier one, which still needs more work.
This commit is contained in:
parent
da5e6b98c9
commit
1582dd5e4d
Notes:
blender-bot
2023-02-14 07:31:34 +01:00
Referenced by commit b5213b2dea
, Fix T40007 Bevel tool resets after getting to 1.
|
@ -552,6 +552,15 @@ static void slide_dist(EdgeHalf *e, BMVert *v, float d, float slideco[3])
|
|||
madd_v3_v3fl(slideco, dir, -d);
|
||||
}
|
||||
|
||||
/* Is co not on the edge e? */
|
||||
static bool is_outside_edge(EdgeHalf *e, const float co[3])
|
||||
{
|
||||
float d_squared;
|
||||
|
||||
d_squared = dist_squared_to_line_segment_v3(co, e->e->v1->co, e->e->v2->co);
|
||||
return d_squared > BEVEL_EPSILON_SQ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the meeting point between the offset edges for e1 and e2, putting answer in meetco.
|
||||
* e1 and e2 share vertex v and face f (may be NULL) and viewed from the normal side of
|
||||
|
@ -633,6 +642,20 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, float
|
|||
if (fabsf(d - e2->offset_l) > BEVEL_EPSILON)
|
||||
e2->offset_l = d;
|
||||
}
|
||||
else {
|
||||
/* The lines intersect, but is it at a reasonable place?
|
||||
* One problem to check: if one of the offsets is 0, then don't
|
||||
* want an intersection that is outside that edge itself.
|
||||
* This can happen if angle between them is > 180 degrees. */
|
||||
if (e1->offset_r == 0.0f && is_outside_edge(e1, meetco)) {
|
||||
copy_v3_v3(meetco, v->co);
|
||||
e2->offset_l = 0.0f;
|
||||
}
|
||||
if (e2->offset_l == 0.0f && is_outside_edge(e2, meetco)) {
|
||||
copy_v3_v3(meetco, v->co);
|
||||
e1->offset_r = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue