More fixes to parallel tests to make them less sensitive, prevents assert failures.

Also made bl_debug_draw_edge_add better (don't draw edges in one continuous line).
This commit is contained in:
Howard Trickey
2012-11-25 13:52:13 +00:00
parent 14255ae39d
commit 3a7d4d661f
2 changed files with 33 additions and 13 deletions

View File

@@ -319,12 +319,7 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co);
sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, v)->co, v->co);
/* get normal to plane where meet point should be */
cross_v3_v3v3(norm_v, dir2, dir1);
normalize_v3(norm_v);
if (!on_right)
negate_v3(norm_v);
if (is_zero_v3(norm_v)) {
if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) {
/* special case: e1 and e2 are parallel; put offset point perp to both, from v.
* need to find a suitable plane.
* if offsets are different, we're out of luck: just use e1->offset */
@@ -339,6 +334,12 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
copy_v3_v3(meetco, off1a);
}
else {
/* get normal to plane where meet point should be */
cross_v3_v3v3(norm_v, dir2, dir1);
normalize_v3(norm_v);
if (!on_right)
negate_v3(norm_v);
/* get vectors perp to each edge, perp to norm_v, and pointing into face */
if (f) {
copy_v3_v3(norm_v, f->no);
@@ -612,7 +613,7 @@ static void get_point_on_round_edge(EdgeHalf *e, int k,
else
sub_v3_v3v3(dir, e->e->v2->co, e->e->v1->co);
normalize_v3(dir);
if (fabsf(angle_v3v3(vva, vvb) - (float)M_PI) > (float)BEVEL_EPSILON) {
if (fabsf(angle_v3v3(vva, vvb) - (float)M_PI) > 100.f *(float)BEVEL_EPSILON) {
copy_v3_v3(vaadj, va);
madd_v3_v3fl(vaadj, dir, -len_v3(vva) * cosf(angle_v3v3(vva, dir)));
copy_v3_v3(vbadj, vb);

View File

@@ -3237,12 +3237,16 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
#ifdef DEBUG_DRAW
/* debug drawing */
#define _DEBUG_DRAW_QUAD_TOT 1024
#define _DEBUG_DRAW_EDGE_TOT 1024
static float _bl_debug_draw_quads[_DEBUG_DRAW_QUAD_TOT][4][3];
static int _bl_debug_draw_quads_tot = 0;
static float _bl_debug_draw_edges[_DEBUG_DRAW_QUAD_TOT][2][3];
static int _bl_debug_draw_edges_tot = 0;
void bl_debug_draw_quad_clear(void)
{
_bl_debug_draw_quads_tot = 0;
_bl_debug_draw_edges_tot = 0;
}
void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2[3], const float v3[3])
{
@@ -3260,16 +3264,14 @@ void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2
}
void bl_debug_draw_edge_add(const float v0[3], const float v1[3])
{
if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_QUAD_TOT) {
printf("%s: max edge count hit %d!", __func__, _bl_debug_draw_quads_tot);
if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_EDGE_TOT) {
printf("%s: max edge count hit %d!", __func__, _bl_debug_draw_edges_tot);
}
else {
float *pt = &_bl_debug_draw_quads[_bl_debug_draw_quads_tot][0][0];
float *pt = &_bl_debug_draw_edges[_bl_debug_draw_edges_tot][0][0];
copy_v3_v3(pt, v0); pt += 3;
copy_v3_v3(pt, v1); pt += 3;
copy_v3_v3(pt, v0); pt += 3;
copy_v3_v3(pt, v1); pt += 3;
_bl_debug_draw_quads_tot++;
_bl_debug_draw_edges_tot++;
}
}
static void bl_debug_draw(void)
@@ -3286,5 +3288,22 @@ static void bl_debug_draw(void)
}
glEnd();
}
if (_bl_debug_draw_edges_tot) {
int i;
cpack(0x00FFFF00);
glBegin(GL_LINES);
for (i = 0; i < _bl_debug_draw_edges_tot; i ++) {
glVertex3fv(_bl_debug_draw_edges[i][0]);
glVertex3fv(_bl_debug_draw_edges[i][1]);
}
glEnd();
glPointSize(4.0);
glBegin(GL_POINTS);
for (i = 0; i < _bl_debug_draw_edges_tot; i ++) {
glVertex3fv(_bl_debug_draw_edges[i][0]);
glVertex3fv(_bl_debug_draw_edges[i][1]);
}
glEnd();
}
}
#endif