forked from bartvdbraak/blender
Fix T50906 and T49361, bevel didn't curve in plane sometimes.
This commit is contained in:
parent
f2d7356f16
commit
538fe7d48e
@ -205,6 +205,15 @@ static int bev_debug_flags = 0;
|
||||
#define DEBUG_OLD_PROJ_TO_PERP_PLANE (bev_debug_flags & 2)
|
||||
#define DEBUG_OLD_FLAT_MID (bev_debug_flags & 4)
|
||||
|
||||
/* Are d1 and d2 parallel or nearly so? */
|
||||
static bool nearly_parallel(const float d1[3], const float d2[3])
|
||||
{
|
||||
float ang;
|
||||
|
||||
ang = angle_v3v3(d1, d2);
|
||||
return (fabsf(ang) < BEVEL_EPSILON_ANG) || (fabsf(ang - M_PI) < BEVEL_EPSILON_ANG);
|
||||
}
|
||||
|
||||
/* Make a new BoundVert of the given kind, insert it at the end of the circular linked
|
||||
* list with entry point bv->boundstart, and return it. */
|
||||
static BoundVert *add_new_bound_vert(MemArena *mem_arena, VMesh *vm, const float co[3])
|
||||
@ -1059,7 +1068,7 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
|
||||
{
|
||||
EdgeHalf *e;
|
||||
Profile *pro;
|
||||
float co1[3], co2[3], co3[3], d1[3], d2[3], l;
|
||||
float co1[3], co2[3], co3[3], d1[3], d2[3];
|
||||
bool do_linear_interp;
|
||||
|
||||
copy_v3_v3(co1, bndv->nv.co);
|
||||
@ -1097,8 +1106,8 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
|
||||
normalize_v3(d1);
|
||||
normalize_v3(d2);
|
||||
cross_v3_v3v3(pro->plane_no, d1, d2);
|
||||
l = normalize_v3(pro->plane_no);
|
||||
if (l <= BEVEL_EPSILON_BIG) {
|
||||
normalize_v3(pro->plane_no);
|
||||
if (nearly_parallel(d1, d2)) {
|
||||
/* co1 - midco -co2 are collinear.
|
||||
* Should be case that beveled edge is coplanar with two boundary verts.
|
||||
* We want to move the profile to that common plane, if possible.
|
||||
@ -1130,8 +1139,7 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
|
||||
sub_v3_v3v3(d4, e->next->e->v1->co, e->next->e->v2->co);
|
||||
normalize_v3(d3);
|
||||
normalize_v3(d4);
|
||||
l = dot_v3v3(d3, d4);
|
||||
if (fabsf(1.0f - l) <= BEVEL_EPSILON_BIG || fabsf(-1.0f - l) <= BEVEL_EPSILON_BIG) {
|
||||
if (nearly_parallel(d3, d4)) {
|
||||
/* offset lines are collinear - want linear interpolation */
|
||||
mid_v3_v3v3(pro->midco, co1, co2);
|
||||
do_linear_interp = true;
|
||||
@ -1157,8 +1165,8 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
|
||||
sub_v3_v3v3(d2, pro->midco, co2);
|
||||
normalize_v3(d2);
|
||||
cross_v3_v3v3(pro->plane_no, d1, d2);
|
||||
l = normalize_v3(pro->plane_no);
|
||||
if (l <= BEVEL_EPSILON_BIG) {
|
||||
normalize_v3(pro->plane_no);
|
||||
if (nearly_parallel(d1, d2)) {
|
||||
/* whole profile is collinear with edge: just interpolate */
|
||||
do_linear_interp = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user