120 |
|
FVECT bbmax |
121 |
|
) |
122 |
|
{ |
123 |
< |
FVECT v1, v2; |
124 |
< |
register int i, j; |
123 |
> |
double d, r; |
124 |
> |
register int i; |
125 |
|
|
126 |
|
for (i = 0; i < 3; i++) { |
127 |
< |
v1[0] = v1[1] = v1[2] = 0; |
128 |
< |
v1[i] = 1.0; |
129 |
< |
fcross(v2, norm, v1); |
130 |
< |
if (normalize(v2) == 0.0) |
131 |
< |
continue; |
132 |
< |
for (j = 0; j < 3; j++) |
133 |
< |
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); |
127 |
> |
r = sqrt(1. - norm[i]*norm[i]); |
128 |
> |
d = cent[i] + r*rad; |
129 |
> |
if (d > bbmax[i]) |
130 |
> |
bbmax[i] = d; |
131 |
> |
d = cent[i] - r*rad; |
132 |
> |
if (d < bbmin[i]) |
133 |
> |
bbmin[i] = d; |
134 |
|
} |
135 |
|
} |