From: Ian Jackson Date: Mon, 18 Feb 2008 00:34:38 +0000 (+0000) Subject: report on degenerate facets X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=moebius2.git;a=commitdiff_plain;h=2ea75be20bbd2882b5b6b807fb173b7dd8cff73c report on degenerate facets --- diff --git a/output.c b/output.c index d6eb877..b9bad14 100644 --- a/output.c +++ b/output.c @@ -423,6 +423,7 @@ assert(d >= -1e3 && d <= 1e3); static uint32_t noutfacets; static uint32_t noutfacets_counted; +static long badfacets; static void outfacet(int rev, const OutVertex *a, const OutVertex *b, const OutVertex *c) { @@ -440,8 +441,10 @@ static void outfacet(int rev, const OutVertex *a, triangle_normal(normal, a->p, b->p, c->p); double multby= 1/magnD(normal); - if (multby > 1e6) + if (multby > 1e6) { + badfacets++; return; + } noutfacets++; if (!~noutfacets_counted) return; @@ -474,6 +477,11 @@ static void write_file(void) { assert(noutfacets == noutfacets_counted); if (fflush(stdout)) diee("fflush stdout"); + + if (badfacets) { + fprintf(stderr,"%ld degenerate facets!\n",badfacets); + exit(4); + } }