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])) |
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; |
94 |
|
for (rn = 0; rn < nroots; rn++) { /* check real roots */ |
95 |
|
if (root[rn] <= FTINY) |
96 |
|
continue; /* too small */ |
97 |
< |
if (root[rn] >= r->rot) |
97 |
> |
if (root[rn] > r->rot + FTINY) |
98 |
|
break; /* too big */ |
99 |
|
/* check endpoints */ |
100 |
|
VSUM(rox, r->rorg, r->rdir, root[rn]); |
104 |
|
continue; /* before p0 */ |
105 |
|
if (b > co->al) |
106 |
|
continue; /* after p1 */ |
107 |
+ |
if (rayreject(o, r, root[rn])) |
108 |
+ |
break; /* previous hit better */ |
109 |
|
r->ro = o; |
110 |
|
r->rot = root[rn]; |
111 |
|
VCOPY(r->rop, rox); |