66 |
|
double coef; |
67 |
|
register int j; |
68 |
|
/* set up function */ |
69 |
< |
setfunc(m, r); |
69 |
> |
setmap(m, r, &((FULLXF *)m->os)->b); |
70 |
|
sa = m->oargs.sarg + 4*n; |
71 |
|
/* compute coefficient */ |
72 |
|
errno = 0; |
79 |
|
errno = 0; |
80 |
|
for (j = 0; j < 3; j++) |
81 |
|
nr.rdir[j] = varvalue(sa[j+1]); |
82 |
< |
if (errno || normalize(nr.rdir) == 0.0) |
82 |
> |
if (errno) |
83 |
|
goto computerr; |
84 |
+ |
multv3(nr.rdir, nr.rdir, ((FULLXF *)m->os)->f.xfm); |
85 |
+ |
if (r->rox != NULL) |
86 |
+ |
multv3(nr.rdir, nr.rdir, r->rox->f.xfm); |
87 |
+ |
if (normalize(nr.rdir) == 0.0) |
88 |
+ |
goto computerr; |
89 |
|
/* compute value */ |
90 |
|
if (r->rsrc >= 0) |
91 |
|
nr.rsrc = source[r->rsrc].sa.sv.sn; |
138 |
|
if (!(*ofun[o->otype].funp)(o, &tr)) |
139 |
|
return(0); /* no intersection! */ |
140 |
|
/* compute redirection */ |
141 |
< |
setfunc(m, &tr); |
141 |
> |
setmap(m, &tr, &((FULLXF *)m->os)->b); |
142 |
|
errno = 0; |
143 |
|
if (varvalue(sa[0]) <= FTINY) |
144 |
|
return(0); /* insignificant */ |
148 |
|
newdir[i] = varvalue(sa[i+1]); |
149 |
|
if (errno) |
150 |
|
goto computerr; |
151 |
+ |
multv3(newdir, newdir, ((FULLXF *)m->os)->f.xfm); |
152 |
+ |
/* normalization unnecessary */ |
153 |
|
newdot = DOT(newdir, nv); |
154 |
|
if (newdot <= FTINY && newdot >= -FTINY) |
155 |
|
return(0); /* new dir parallels plane */ |
156 |
|
/* everything OK -- compute shear */ |
157 |
|
for (i = 0; i < 3; i++) |
158 |
< |
h[i] = tr.rdir[i]/olddot + newdir[i]/newdot; |
158 |
> |
h[i] = newdir[i]/newdot - tr.rdir[i]/olddot; |
159 |
|
setident4(pm); |
160 |
|
for (j = 0; j < 3; j++) { |
161 |
|
for (i = 0; i < 3; i++) |
179 |
|
dir_check(m) /* check arguments and load function file */ |
180 |
|
register OBJREC *m; |
181 |
|
{ |
182 |
+ |
register FULLXF *mxf; |
183 |
|
register int ff; |
184 |
|
|
185 |
< |
ff = m->otype == MAT_DIRECT1 ? 4 : 8; |
186 |
< |
if (ff >= m->oargs.nsargs) |
185 |
> |
ff = m->otype == MAT_DIRECT1 ? 5 : 9; |
186 |
> |
if (ff > m->oargs.nsargs) |
187 |
|
objerror(m, USER, "too few arguments"); |
188 |
|
if (!vardefined(m->oargs.sarg[0])) |
189 |
< |
loadfunc(m->oargs.sarg[ff]); |
189 |
> |
loadfunc(m->oargs.sarg[ff-1]); |
190 |
> |
if (m->os == NULL) { |
191 |
> |
mxf = (FULLXF *)malloc(sizeof(FULLXF)); |
192 |
> |
if (mxf == NULL) |
193 |
> |
error(SYSTEM, "out of memory in dir_check"); |
194 |
> |
if (fullxf(mxf, m->oargs.nsargs-ff, m->oargs.sarg+ff) != |
195 |
> |
m->oargs.nsargs-ff) |
196 |
> |
objerror(m, USER, "bad transform"); |
197 |
> |
if (mxf->f.sca < 0.0) |
198 |
> |
mxf->f.sca = -mxf->f.sca; |
199 |
> |
if (mxf->b.sca < 0.0) |
200 |
> |
mxf->b.sca = -mxf->b.sca; |
201 |
> |
m->os = (char *)mxf; |
202 |
> |
} |
203 |
|
} |