--- ray/src/ot/wfconv.c 2014/01/24 02:22:49 2.12 +++ ray/src/ot/wfconv.c 2019/05/03 18:00:50 2.15 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: wfconv.c,v 2.12 2014/01/24 02:22:49 greg Exp $"; +static const char RCSid[] = "$Id: wfconv.c,v 2.15 2019/05/03 18:00:50 greg Exp $"; #endif /* * Load Wavefront .OBJ file and convert to triangles with mesh info. @@ -32,15 +32,15 @@ static char group[256]; /* current group name */ static int lineno; /* current line number */ static int faceno; /* current face number */ -static int getstmt(char *av[MAXARG], FILE *fp); -static int cvtndx(VNDX vi, char *vs); -static int putface(int ac, char **av); +static int getstmt(char *av[MAXARG], FILE *fp); +static int cvtndx(VNDX vi, char *vs); +static int putface(int ac, char **av); static OBJECT getmod(void); -static int puttri(char *v1, char *v2, char *v3); +static int puttri(char *v1, char *v2, char *v3); static void freeverts(void); -static int newv(double x, double y, double z); -static int newvn(double x, double y, double z); -static int newvt(double x, double y); +static int newv(double x, double y, double z); +static int newvn(double x, double y, double z); +static int newvt(double x, double y); static void syntax(char *er); @@ -261,7 +261,7 @@ dominant_axis(char *v1, char *v2, char *v3) for (i = imax = 2; i--; ) if (vn[i]*vn[i] > vn[imax]*vn[imax]) imax = i; - return(vn[imax]*vn[imax] > FTINY ? imax : -1); + return(vn[imax]*vn[imax] > FTINY*FTINY ? imax : -1); } /* callback for triangle output from polygon */ @@ -304,8 +304,10 @@ putface( /* put out an N-sided polygon */ poly->v[i].mY = vlist[vi[0]][ay]; } /* break into triangles & output */ - if (!polyTriangulate(poly, &tri_out)) - error(WARNING, "self-intersecting face"); + if (!polyTriangulate(poly, &tri_out)) { + sprintf(errmsg, "self-intersecting face with %d vertices", ac); + error(WARNING, errmsg); + } polyFree(poly); return(1); } @@ -466,7 +468,7 @@ syntax( /* report syntax error and exit */ char *er ) { - sprintf(errmsg, "%s: Wavefront syntax error near line %d: %s\n", + sprintf(errmsg, "%s: Wavefront syntax error near line %d: %s", inpfile, lineno, er); error(USER, errmsg); }