ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/ot/wfconv.c
(Generate patch)

Comparing ray/src/ot/wfconv.c (file contents):
Revision 2.12 by greg, Fri Jan 24 02:22:49 2014 UTC vs.
Revision 2.17 by greg, Thu Mar 11 17:00:58 2021 UTC

# Line 32 | Line 32 | static char    group[256];     /* current group name */
32   static int      lineno;         /* current line number */
33   static int      faceno;         /* current face number */
34  
35 < static int getstmt(char *av[MAXARG], FILE       *fp);
36 < static int cvtndx(VNDX  vi, char        *vs);
37 < static int putface(int  ac, char        **av);
35 > static int getstmt(char *av[MAXARG], FILE *fp);
36 > static int cvtndx(VNDX vi, char *vs);
37 > static int putface(int ac, char **av);
38   static OBJECT getmod(void);
39 < static int puttri(char  *v1, char       *v2, char       *v3);
39 > static int puttri(char  *v1, char *v2, char *v3);
40   static void freeverts(void);
41 < static int newv(double  x, double       y, double       z);
42 < static int newvn(double x, double       y, double       z);
43 < static int newvt(double x, double       y);
41 > static int newv(double  x, double y, double z);
42 > static int newvn(double x, double y, double z);
43 > static int newvt(double x, double y);
44   static void syntax(char *er);
45  
46  
# Line 261 | Line 261 | dominant_axis(char *v1, char *v2, char *v3)
261          for (i = imax = 2; i--; )
262                  if (vn[i]*vn[i] > vn[imax]*vn[imax])
263                          imax = i;
264 <        return(vn[imax]*vn[imax] > FTINY ? imax : -1);
264 >        return(vn[imax]*vn[imax] > FTINY*FTINY*FTINY*FTINY ? imax : -1);
265   }
266  
267   /* callback for triangle output from polygon */
# Line 279 | Line 279 | putface(                               /* put out an N-sided polygon */
279          char    **av
280   )
281   {
282 <        Vert2_list      *poly = polyAlloc(ac);
282 >        Vert2_list      *poly;
283          int             i, ax, ay;
284  
285        if (poly == NULL)
286                return(0);
287        poly->p = (void *)av;
285          for (i = ac-3; i >= 0; i--)     /* identify dominant axis */
286                  if ((ax = dominant_axis(av[i], av[i+1], av[i+2])) >= 0)
287                          break;
288          if (ax < 0)
289                  return(1);              /* ignore degenerate face */
290 +        poly = polyAlloc(ac);
291 +        if (poly == NULL)
292 +                return(0);
293 +        poly->p = (void *)av;
294          if (++ax >= 3) ax = 0;
295          ay = ax;
296          if (++ay >= 3) ay = 0;
# Line 304 | Line 305 | putface(                               /* put out an N-sided polygon */
305                  poly->v[i].mY = vlist[vi[0]][ay];
306          }
307                                          /* break into triangles & output */
308 <        if (!polyTriangulate(poly, &tri_out))
309 <                error(WARNING, "self-intersecting face");
308 >        if (!polyTriangulate(poly, &tri_out)) {
309 >                sprintf(errmsg, "self-intersecting face with %d vertices", ac);
310 >                error(WARNING, errmsg);
311 >        }
312          polyFree(poly);
313          return(1);
314   }
# Line 466 | Line 469 | syntax(                        /* report syntax error and exit */
469          char    *er
470   )
471   {
472 <        sprintf(errmsg, "%s: Wavefront syntax error near line %d: %s\n",
472 >        sprintf(errmsg, "%s: Wavefront syntax error near line %d: %s",
473                          inpfile, lineno, er);
474          error(USER, errmsg);
475   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines