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

Comparing ray/src/common/objtriangulate.c (file contents):
Revision 2.1 by greg, Fri Mar 12 03:59:25 2021 UTC vs.
Revision 2.3 by greg, Tue Feb 13 21:06:00 2024 UTC

# Line 16 | Line 16 | static const char RCSid[] = "$Id$";
16   typedef struct {
17          Scene   *sc;
18          Face    *f;
19 +        int     rev;
20   } SceneFace;
21  
22   /* Callback to create new triangle */
# Line 26 | Line 27 | addtriangle(const Vert2_list *tp, int a, int b, int c)
27          Face            *f = sf->f;
28          VNDX            triv[3];
29  
30 +        if (sf->rev) {                  /* need to reverse triangle? */
31 +                int     t = a;
32 +                a = c;
33 +                c = t;
34 +        }
35          triv[0][0] = f->v[a].vid;
36          triv[0][1] = f->v[a].tid;
37          triv[0][2] = f->v[a].nid;
# Line 79 | Line 85 | mktriangles(Scene *sc, Face *f, void *p)
85                  poly->v[i].mX = pt[ax];
86                  poly->v[i].mY = pt[ay];
87          }
88 +        mysf.rev = (polyArea(poly) < .0);
89          i = polyTriangulate(poly, addtriangle);
90          polyFree(poly);
91 <                                        /* flag face if replaced */
92 <        f->flags |= (i > 0)*FACE_DUPLICATE;
91 >        if (i > 0)                      /* flag face */
92 >                f->flags |= FACE_DUPLICATE;
93 >        else
94 >                f->flags |= FACE_DEGENERATE;
95          return(i);
96   }
97  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines