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

Comparing ray/src/rt/o_cone.c (file contents):
Revision 2.9 by greg, Thu Apr 21 00:40:35 2016 UTC vs.
Revision 2.12 by greg, Thu Mar 16 00:25:24 2023 UTC

# Line 70 | Line 70 | o_cone(                        /* intersect ray with cone */
70  
71          } else { /* OBJ_RING */
72  
73 <                if (rdx[2] <= FTINY && rdx[2] >= -FTINY)
73 >                if ((rdx[2] <= FTINY) & (rdx[2] >= -FTINY))
74                          return(0);                      /* parallel */
75                  root[0] = -rox[2]/rdx[2];
76 <                if (root[0] <= FTINY || root[0] >= r->rot)
77 <                        return(0);                      /* distance check */
76 >                if (rayreject(o, r, root[0], -rdx[2]))
77 >                        return(0);                      /* have better */
78                  b = root[0]*rdx[0] + rox[0];
79                  c = root[0]*rdx[1] + rox[1];
80                  a = b*b + c*c;
# Line 85 | Line 85 | o_cone(                        /* intersect ray with cone */
85                  VSUM(r->rop, r->rorg, r->rdir, r->rot);
86                  VCOPY(r->ron, co->ad);
87                  r->rod = -rdx[2];
88 +                r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
89 +                r->uv[0] = r->uv[1] = 0.0;
90                  r->rox = NULL;
91                  return(1);                              /* good */
92          }
# Line 94 | Line 96 | o_cone(                        /* intersect ray with cone */
96          for (rn = 0; rn < nroots; rn++) {       /* check real roots */
97                  if (root[rn] <= FTINY)
98                          continue;               /* too small */
99 <                if (root[rn] >= r->rot)
99 >                if (root[rn] > r->rot + FTINY)
100                          break;                  /* too big */
101                                                  /* check endpoints */
102                  VSUM(rox, r->rorg, r->rdir, root[rn]);
# Line 104 | Line 106 | o_cone(                        /* intersect ray with cone */
106                          continue;               /* before p0 */
107                  if (b > co->al)
108                          continue;               /* after p1 */
109 +                if (rayreject(o, r, root[rn], 0))
110 +                        break;                  /* previous hit better */
111                  r->ro = o;
112                  r->rot = root[rn];
113                  VCOPY(r->rop, rox);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines