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.3 by greg, Wed Aug 12 14:44:15 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 (i = 1; i < fa->nv; i++) {
71 >                for (j = 0; j < 3; j++)
72 >                        u[j] = VERTEX(fa,i)[j] - VERTEX(fa,i-1)[j];
73 >                if (DOT(u,u) >= fa->area-FTINY)
74 >                        break;
75 >        }
76 >        if (i < fa->nv) {       /* got one! -- let's align our axes */
77 >                normalize(u);
78 >                fcross(v, fa->norm, u);
79 >        } else                  /* oh well, we'll just have to wing it */
80 >                mkaxes(u, v, fa->norm);
81 >                                /* now, find limits in (u,v) coordinates */
82          ur[0] = vr[0] = FHUGE;
83          ur[1] = vr[1] = -FHUGE;
84          for (i = 0; i < fa->nv; i++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines