202 |
|
{ |
203 |
|
miga[0] = miga[1] = miga[2] = NULL; |
204 |
|
if (single_plane_incident) { /* isotropic BSDF? */ |
205 |
< |
RBFNODE *rbf; /* find edge we're on */ |
206 |
< |
for (rbf = dsf_list; rbf != NULL; rbf = rbf->next) { |
207 |
< |
if (input_orient*rbf->invec[2] < input_orient*invec[2]) |
208 |
< |
break; |
209 |
< |
if (rbf->next != NULL && |
210 |
< |
input_orient*rbf->next->invec[2] < |
205 |
> |
RBFNODE *rbf; /* find edge we're on */ |
206 |
> |
for (rbf = dsf_list; rbf != NULL; rbf = rbf->next) { |
207 |
> |
if (input_orient*rbf->invec[2] < input_orient*invec[2]) |
208 |
> |
break; |
209 |
> |
if (rbf->next != NULL && input_orient*rbf->next->invec[2] < |
210 |
|
input_orient*invec[2]) { |
211 |
< |
for (miga[0] = rbf->ejl; miga[0] != NULL; |
212 |
< |
miga[0] = nextedge(rbf,miga[0])) |
213 |
< |
if (opp_rbf(rbf,miga[0]) == rbf->next) { |
214 |
< |
double nf = 1.-rbf->invec[2]*rbf->invec[2]; |
215 |
< |
if (nf > FTINY) { |
216 |
< |
nf = sqrt((1.-invec[2]*invec[2])/nf); |
217 |
< |
invec[0] = nf*rbf->invec[0]; |
218 |
< |
invec[1] = nf*rbf->invec[1]; |
219 |
< |
} |
220 |
< |
return(0); |
222 |
< |
} |
223 |
< |
break; |
211 |
> |
for (miga[0] = rbf->ejl; miga[0] != NULL; |
212 |
> |
miga[0] = nextedge(rbf,miga[0])) |
213 |
> |
if (opp_rbf(rbf,miga[0]) == rbf->next) { |
214 |
> |
double nf = 1. - rbf->invec[2]*rbf->invec[2]; |
215 |
> |
if (nf > FTINY) { /* rotate to match */ |
216 |
> |
nf = sqrt((1.-invec[2]*invec[2])/nf); |
217 |
> |
invec[0] = nf*rbf->invec[0]; |
218 |
> |
invec[1] = nf*rbf->invec[1]; |
219 |
> |
} |
220 |
> |
return(0); |
221 |
|
} |
222 |
+ |
break; |
223 |
|
} |
224 |
< |
return(-1); /* outside range! */ |
224 |
> |
} |
225 |
> |
return(-1); /* outside range! */ |
226 |
|
} |
227 |
|
{ /* else use triangle mesh */ |
228 |
|
int sym = use_symmetry(invec); |