From 2ea75be20bbd2882b5b6b807fb173b7dd8cff73c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 18 Feb 2008 00:34:38 +0000 Subject: [PATCH] report on degenerate facets --- output.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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); + } } -- 2.30.2