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

Comparing ray/src/ot/bbox.c (file contents):
Revision 2.5 by schorsch, Sat Mar 27 12:41:45 2004 UTC vs.
Revision 2.7 by greg, Fri Sep 16 15:09:21 2016 UTC

# Line 61 | Line 61 | add2bbox(              /* expand bounding box to fit object */
61          case OBJ_TUBE:
62          case OBJ_RING:
63                  co = getcone(o, 0);
64 +                if (co == NULL)
65 +                        break;
66                  if (o->otype != OBJ_RING)
67                          circle2bbox(CO_P0(co), co->ad, CO_R0(co), bbmin, bbmax);
68                  circle2bbox(CO_P1(co), co->ad, CO_R1(co), bbmin, bbmax);
# Line 120 | Line 122 | circle2bbox(   /* expand bbox to fit circle */
122          FVECT  bbmax
123   )
124   {
125 <        FVECT  v1, v2;
126 <        register int  i, j;
125 >        double  d, r;
126 >        register int  i;
127  
128          for (i = 0; i < 3; i++) {
129 <                v1[0] = v1[1] = v1[2] = 0;
130 <                v1[i] = 1.0;
131 <                fcross(v2, norm, v1);
132 <                if (normalize(v2) == 0.0)
133 <                        continue;
134 <                for (j = 0; j < 3; j++)
135 <                        v1[j] = cent[j] + rad*v2[j];
134 <                point2bbox(v1, bbmin, bbmax);
135 <                for (j = 0; j < 3; j++)
136 <                        v1[j] = cent[j] - rad*v2[j];
137 <                point2bbox(v1, bbmin, bbmax);
129 >                r = sqrt(1. - norm[i]*norm[i]);
130 >                d = cent[i] + r*rad;
131 >                if (d > bbmax[i])
132 >                        bbmax[i] = d;
133 >                d = cent[i] - r*rad;
134 >                if (d < bbmin[i])
135 >                        bbmin[i] = d;
136          }
137   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines