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

Comparing ray/src/gen/mkillum2.c (file contents):
Revision 2.2 by greg, Wed Mar 11 12:25:47 1992 UTC vs.
Revision 2.4 by greg, Thu Aug 13 10:03:19 1992 UTC

# Line 66 | Line 66 | char  *nm;
66          distarr = (float *)calloc(n, 3*sizeof(float));
67          if (distarr == NULL)
68                  error(SYSTEM, "out of memory in o_face");
69 <        mkaxes(u, v, fa->norm);
69 >                                /* take first edge longer than sqrt(area) */
70 >        for (j = fa->nv-1, i = 0; i < fa->nv; j = i++) {
71 >                u[0] = VERTEX(fa,i)[0] - VERTEX(fa,j)[0];
72 >                u[1] = VERTEX(fa,i)[1] - VERTEX(fa,j)[1];
73 >                u[2] = VERTEX(fa,i)[2] - VERTEX(fa,j)[2];
74 >                if (DOT(u,u) >= fa->area-FTINY)
75 >                        break;
76 >        }
77 >        if (i < fa->nv) {       /* got one! -- let's align our axes */
78 >                normalize(u);
79 >                fcross(v, fa->norm, u);
80 >        } else                  /* oh well, we'll just have to wing it */
81 >                mkaxes(u, v, fa->norm);
82 >                                /* now, find limits in (u,v) coordinates */
83          ur[0] = vr[0] = FHUGE;
84          ur[1] = vr[1] = -FHUGE;
85          for (i = 0; i < fa->nv; i++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines