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

Comparing ray/src/common/triangulate.c (file contents):
Revision 2.1 by greg, Thu Jan 23 23:51:41 2014 UTC vs.
Revision 2.3 by greg, Fri Jan 24 02:22:49 2014 UTC

# Line 53 | Line 53 | polySnip(const Vert2_list *contour, int u, int v, int
53  
54    for (p=0;p<n;p++)
55    {
56 <    if( (p == u) || (p == v) || (p == w) ) continue;
56 >    if( (p == u) | (p == v) | (p == w) ) continue;
57      Px = contour->v[V[p]].mX;
58      Py = contour->v[V[p]].mY;
59      if (insideTriangle(Ax,Ay,Bx,By,Cx,Cy,Px,Py)) return false;
# Line 133 | Line 133 | polyTriangulate(const Vert2_list *contour, tri_out_t *
133  
134    /* we want a counter-clockwise polygon in V */
135  
136 <  if ( 0.0 < Area(contour) )
136 >  if ( 0.0 < polyArea(contour) )
137      for (v=0; v<contour->nv; v++) V[v] = v;
138    else
139      for(v=0; v<contour->nv; v++) V[v] = (contour->nv-1)-v;
# Line 146 | Line 146 | polyTriangulate(const Vert2_list *contour, tri_out_t *
146    for(m=0, v=nv-1; nv>2; )
147    {
148      /* if we loop, it is probably a non-simple polygon */
149 <    if (0 >= (count--))
149 >    if (0 >= count--)
150      {
151 <      /* Triangulate: ERROR - probable bad polygon! */
151 >      /* Triangulate: ERROR - probable bad polygon */
152        return false;
153      }
154  
# Line 165 | Line 165 | polyTriangulate(const Vert2_list *contour, tri_out_t *
165        a = V[u]; b = V[v]; c = V[w];
166  
167        /* output Triangle */
168 <      (*cb)(contour, a, b, c);
168 >      if (!(*cb)(contour, a, b, c)) return false;
169  
170        m++;
171  
172        /* remove v from remaining polygon */
173        for(s=v,t=v+1;t<nv;s++,t++) V[s] = V[t]; nv--;
174  
175 <      /* resest error detection counter */
175 >      /* reset error detection counter */
176        count = 2*nv;
177      }
178    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines