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.15 by greg, Sun Oct 16 16:04:10 2005 UTC vs.
Revision 2.16 by greg, Mon Feb 26 21:16:02 2007 UTC

# 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 for source");
114 >                objerror(so, USER, "cannot hit source center");
115          src->sflags |= SFLAT;
116          VCOPY(src->snorm, f->norm);
117          src->ss2 = f->area;
# 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          VCOPY(src->sloc, so->oargs.farg);
178          src->srad = so->oargs.farg[3];
179          src->ss2 = PI * src->srad * src->srad;
# Line 193 | Line 195 | OBJREC  *so;
195          src->so = so;
196                                                  /* get the ring */
197          co = getcone(so, 0);
198 +        if (CO_R1(co) <= FTINY)
199 +                objerror(so, USER, "illegal source radius");
200          VCOPY(src->sloc, CO_P0(co));
201          if (CO_R0(co) > 0.0)
202 <                objerror(so, USER, "cannot hit center for source");
202 >                objerror(so, USER, "cannot hit source center");
203          src->sflags |= SFLAT;
204          VCOPY(src->snorm, co->ad);
205          src->srad = CO_R1(co);
# Line 216 | Line 220 | OBJREC  *so;
220          src->so = so;
221                                                  /* get the cylinder */
222          co = getcone(so, 0);
223 +        if (CO_R0(co) <= FTINY)
224 +                objerror(so, USER, "illegal source radius");
225          if (CO_R0(co) > .2*co->al)              /* heuristic constraint */
226                  objerror(so, WARNING, "source aspect too small");
227          src->sflags |= SCYL;
# Line 249 | Line 255 | register OBJREC  *m;
255                  return(ns);
256          if ((ns = (SPOT *)malloc(sizeof(SPOT))) == NULL)
257                  return(NULL);
258 +        if (m->oargs.farg[3] <= FTINY)
259 +                objerror(m, USER, "zero angle");
260          ns->siz = 2.0*PI * (1.0 - cos(PI/180.0/2.0 * m->oargs.farg[3]));
261          VCOPY(ns->aim, m->oargs.farg+4);
262          if ((ns->flen = normalize(ns->aim)) == 0.0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines