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

Comparing ray/src/rt/srcsupp.c (file contents):
Revision 2.13 by greg, Wed Dec 31 02:03:08 2003 UTC vs.
Revision 2.17 by greg, Sat Dec 6 01:08:53 2008 UTC

# Line 59 | Line 59 | newsource()                    /* allocate new source in our array */
59          if (source == NULL)
60                  return(-1);
61          source[nsources].sflags = 0;
62 <        source[nsources].nhits = 0;
63 <        source[nsources].ntests = 1;    /* initial hit probability = 0 */
62 >        source[nsources].nhits = 1;
63 >        source[nsources].ntests = 2;    /* initial hit probability = 50% */
64   #if SHADCACHE
65          source[nsources].obscache = NULL;
66   #endif
# Line 101 | Line 101 | OBJREC  *so;
101          src->so = so;
102                                                  /* get the face */
103          f = getface(so);
104 +        if (f->area == 0.0)
105 +                objerror(so, USER, "zero source area");
106                                                  /* find the center */
107          for (j = 0; j < 3; j++) {
108                  src->sloc[j] = 0.0;
# Line 109 | Line 111 | OBJREC  *so;
111                  src->sloc[j] /= (double)f->nv;
112          }
113          if (!inface(src->sloc, f))
114 <                objerror(so, USER, "cannot hit center");
114 >                objerror(so, USER, "cannot hit source center");
115          src->sflags |= SFLAT;
116          VCOPY(src->snorm, f->norm);
117          src->ss2 = f->area;
# Line 143 | Line 145 | register OBJREC  *so;
145          src->so = so;
146          if (so->oargs.nfargs != 4)
147                  objerror(so, USER, "bad arguments");
148 <        src->sflags |= SDISTANT;
148 >        src->sflags |= (SDISTANT|SCIR);
149          VCOPY(src->sloc, so->oargs.farg);
150          if (normalize(src->sloc) == 0.0)
151                  objerror(so, USER, "zero direction");
# Line 171 | Line 173 | register OBJREC  *so;
173          if (so->oargs.nfargs != 4)
174                  objerror(so, USER, "bad # arguments");
175          if (so->oargs.farg[3] <= FTINY)
176 <                objerror(so, USER, "illegal radius");
176 >                objerror(so, USER, "illegal source radius");
177 >        src->sflags |= SCIR;
178          VCOPY(src->sloc, so->oargs.farg);
179          src->srad = so->oargs.farg[3];
180          src->ss2 = PI * src->srad * src->srad;
181          for (i = 0; i < 3; i++)
182                  src->ss[SU][i] = src->ss[SV][i] = src->ss[SW][i] = 0.0;
183          for (i = 0; i < 3; i++)
184 <                src->ss[i][i] = .7236 * so->oargs.farg[3];
184 >                src->ss[i][i] = 0.7236 * so->oargs.farg[3];
185   }
186  
187  
# Line 193 | Line 196 | OBJREC  *so;
196          src->so = so;
197                                                  /* get the ring */
198          co = getcone(so, 0);
199 +        if (CO_R1(co) <= FTINY)
200 +                objerror(so, USER, "illegal source radius");
201          VCOPY(src->sloc, CO_P0(co));
202          if (CO_R0(co) > 0.0)
203 <                objerror(so, USER, "cannot hit center");
204 <        src->sflags |= SFLAT;
203 >                objerror(so, USER, "cannot hit source center");
204 >        src->sflags |= (SFLAT|SCIR);
205          VCOPY(src->snorm, co->ad);
206          src->srad = CO_R1(co);
207          src->ss2 = PI * src->srad * src->srad;
# Line 216 | Line 221 | OBJREC  *so;
221          src->so = so;
222                                                  /* get the cylinder */
223          co = getcone(so, 0);
224 +        if (CO_R0(co) <= FTINY)
225 +                objerror(so, USER, "illegal source radius");
226          if (CO_R0(co) > .2*co->al)              /* heuristic constraint */
227                  objerror(so, WARNING, "source aspect too small");
228          src->sflags |= SCYL;
# Line 249 | Line 256 | register OBJREC  *m;
256                  return(ns);
257          if ((ns = (SPOT *)malloc(sizeof(SPOT))) == NULL)
258                  return(NULL);
259 +        if (m->oargs.farg[3] <= FTINY)
260 +                objerror(m, USER, "zero angle");
261          ns->siz = 2.0*PI * (1.0 - cos(PI/180.0/2.0 * m->oargs.farg[3]));
262          VCOPY(ns->aim, m->oargs.farg+4);
263          if ((ns->flen = normalize(ns->aim)) == 0.0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines