70 |
|
d = 1.0/(n*n); |
71 |
|
scalecolor(hp->acoef, d); |
72 |
|
/* make tangent plane axes */ |
73 |
< |
hp->uy[0] = hp->uy[1] = hp->uy[2] = 0.0; |
73 |
> |
hp->uy[0] = 0.5 - frandom(); |
74 |
> |
hp->uy[1] = 0.5 - frandom(); |
75 |
> |
hp->uy[2] = 0.5 - frandom(); |
76 |
|
for (i = 3; i--; ) |
77 |
|
if ((-0.6 < r->ron[i]) & (r->ron[i] < 0.6)) |
78 |
|
break; |
319 |
|
hess2[0][1] = DOT(uv[0], b); |
320 |
|
hess2[1][0] = DOT(uv[1], a); |
321 |
|
hess2[1][1] = DOT(uv[1], b); |
322 |
< |
/* compute eigenvalues */ |
323 |
< |
if ( quadratic(evalue, 1.0, -hess2[0][0]-hess2[1][1], |
324 |
< |
hess2[0][0]*hess2[1][1]-hess2[0][1]*hess2[1][0]) != 2 || |
325 |
< |
((evalue[0] = fabs(evalue[0])) <= FTINY*FTINY) | |
322 |
> |
/* compute eigenvalue(s) */ |
323 |
> |
i = quadratic(evalue, 1.0, -hess2[0][0]-hess2[1][1], |
324 |
> |
hess2[0][0]*hess2[1][1]-hess2[0][1]*hess2[1][0]); |
325 |
> |
if (i == 1) /* double-root (circle) */ |
326 |
> |
evalue[1] = evalue[0]; |
327 |
> |
if (!i || ((evalue[0] = fabs(evalue[0])) <= FTINY*FTINY) | |
328 |
|
((evalue[1] = fabs(evalue[1])) <= FTINY*FTINY) ) |
329 |
|
error(INTERNAL, "bad eigenvalue calculation"); |
330 |
|
|
501 |
|
AMBHEMI *hp = inithemi(rcol, r, wt); |
502 |
|
int cnt = 0; |
503 |
|
FVECT my_uv[2]; |
504 |
< |
double d, acol[3]; |
504 |
> |
double d, K, acol[3]; |
505 |
|
struct s_ambsamp *ap; |
506 |
|
int i, j; |
507 |
|
/* check/initialize */ |
534 |
|
free(hp); |
535 |
|
return(-1); /* no radius or gradient calc. */ |
536 |
|
} |
537 |
< |
if (bright(acol) > FTINY) /* normalize Y values */ |
538 |
< |
d = cnt/bright(acol); |
539 |
< |
else |
537 |
> |
if (bright(acol) > FTINY) { /* normalize Y values */ |
538 |
> |
d = 0.99*cnt/bright(acol); |
539 |
> |
K = 0.01; |
540 |
> |
} else { /* geometric Hessian fall-back */ |
541 |
|
d = 0.0; |
542 |
+ |
K = 1.0; |
543 |
+ |
pg = NULL; |
544 |
+ |
dg = NULL; |
545 |
+ |
} |
546 |
|
ap = hp->sa; /* relative Y channel from here on... */ |
547 |
|
for (i = hp->ns*hp->ns; i--; ap++) |
548 |
< |
colval(ap->v,CIEY) = bright(ap->v)*d + 0.01; |
548 |
> |
colval(ap->v,CIEY) = bright(ap->v)*d + K; |
549 |
|
|
550 |
|
if (uv == NULL) /* make sure we have axis pointers */ |
551 |
|
uv = my_uv; |