66 |
|
{ |
67 |
|
MFUNC *mf; |
68 |
|
register EPNODE **va; |
69 |
+ |
FVECT nsdir; |
70 |
|
RAY nr; |
71 |
|
double coef; |
72 |
|
register int j; |
73 |
|
/* set up function */ |
74 |
|
mf = getdfunc(m); |
75 |
|
setfunc(m, r); |
76 |
+ |
/* assign direction variable */ |
77 |
+ |
if (r->rsrc >= 0) { |
78 |
+ |
register SRCREC *sp = source + source[r->rsrc].sa.sv.sn; |
79 |
+ |
|
80 |
+ |
if (sp->sflags & SDISTANT) |
81 |
+ |
VCOPY(nsdir, sp->sloc); |
82 |
+ |
else { |
83 |
+ |
for (j = 0; j < 3; j++) |
84 |
+ |
nsdir[j] = sp->sloc[j] - r->rop[j]; |
85 |
+ |
normalize(nsdir); |
86 |
+ |
} |
87 |
+ |
if (r->rox != NULL) |
88 |
+ |
multv3(nsdir, nsdir, r->rox->b.xfm); |
89 |
+ |
if (mf->b != &unitxf) |
90 |
+ |
multv3(nsdir, nsdir, mf->b->xfm); |
91 |
+ |
} else |
92 |
+ |
nsdir[0] = nsdir[1] = nsdir[2] = 0.0; |
93 |
+ |
varset("DxA", '=', nsdir[0]); |
94 |
+ |
varset("DyA", '=', nsdir[1]); |
95 |
+ |
varset("DzA", '=', nsdir[2]); |
96 |
|
/* compute coefficient */ |
97 |
|
errno = 0; |
98 |
|
va = mf->ep + 4*n; |
165 |
|
m = vsmaterial(o); |
166 |
|
mf = getdfunc(m); |
167 |
|
setfunc(m, &tr); |
168 |
+ |
varset("DxA", '=', 0.0); |
169 |
+ |
varset("DyA", '=', 0.0); |
170 |
+ |
varset("DzA", '=', 0.0); |
171 |
|
errno = 0; |
172 |
|
va = mf->ep + 4*n; |
173 |
|
coef = evalue(va[0]); |