| 97 |
|
if ((*vsmat->vproj)(proj, o, &source[sn], i)) |
| 98 |
|
if ((ns = makevsrc(o, sn, proj)) >= 0) { |
| 99 |
|
#ifdef DEBUG |
| 100 |
< |
virtverb(&source[sn], stderr); |
| 100 |
> |
virtverb(&source[ns], stderr); |
| 101 |
|
#endif |
| 102 |
|
addvirtuals(ns, n); |
| 103 |
|
} |
| 123 |
|
if (sfun[op->otype].of->getdisk != NULL) { |
| 124 |
|
maxrad2 = (*sfun[op->otype].of->getdisk)(ocent, op); |
| 125 |
|
if (maxrad2 <= FTINY) /* too small? */ |
| 126 |
< |
return(NULL); |
| 126 |
> |
return(-1); |
| 127 |
|
nsflags |= SSPOT; |
| 128 |
|
} |
| 129 |
|
/* get location and spot */ |
| 130 |
|
if (source[sn].sflags & SDISTANT) { /* distant source */ |
| 131 |
|
if (source[sn].sflags & SPROX) |
| 132 |
< |
return(NULL); /* should never get here! */ |
| 132 |
> |
return(-1); /* should never get here! */ |
| 133 |
|
multv3(nsloc, source[sn].sloc, pm); |
| 134 |
|
if (nsflags & SSPOT) { |
| 135 |
|
VCOPY(ourspot.aim, ocent); |
| 141 |
|
multp3(theirspot.aim, source[sn].sl.s->aim, pm); |
| 142 |
|
if (nsflags & SSPOT && |
| 143 |
|
!commonbeam(&ourspot, &theirspot, nsloc)) |
| 144 |
< |
return(NULL); /* no overlap */ |
| 144 |
> |
return(-1); /* no overlap */ |
| 145 |
|
} |
| 146 |
|
} else { /* local source */ |
| 147 |
|
multp3(nsloc, source[sn].sloc, pm); |
| 149 |
|
for (i = 0; i < 3; i++) |
| 150 |
|
ourspot.aim[i] = ocent[i] - nsloc[i]; |
| 151 |
|
if ((d1 = normalize(ourspot.aim)) == 0.) |
| 152 |
< |
return(NULL); /* at source!! */ |
| 152 |
> |
return(-1); /* at source!! */ |
| 153 |
|
if (source[sn].sflags & SPROX && |
| 154 |
|
d1 > source[sn].sl.prox) |
| 155 |
< |
return(NULL); /* too far away */ |
| 155 |
> |
return(-1); /* too far away */ |
| 156 |
|
ourspot.siz = 2.*PI*(1. - d1/sqrt(d1*d1+maxrad2)); |
| 157 |
|
ourspot.flen = 0.; |
| 158 |
|
} else if (source[sn].sflags & SPROX) { |
| 163 |
|
d1 = DOT(norm, nsloc) - offs; |
| 164 |
|
if (d1 < 0.) d1 = -d1; |
| 165 |
|
if (d1 > source[sn].sl.prox) |
| 166 |
< |
return(NULL); /* too far away */ |
| 166 |
> |
return(-1); /* too far away */ |
| 167 |
|
} |
| 168 |
|
if (source[sn].sflags & SSPOT) { |
| 169 |
|
copystruct(&theirspot, source[sn].sl.s); |
| 170 |
|
multv3(theirspot.aim, source[sn].sl.s->aim, pm); |
| 171 |
|
if (nsflags & SSPOT) { |
| 172 |
|
if (!commonspot(&ourspot, &theirspot, nsloc)) |
| 173 |
< |
return(NULL); /* no overlap */ |
| 173 |
> |
return(-1); /* no overlap */ |
| 174 |
|
ourspot.flen = theirspot.flen; |
| 175 |
|
} |
| 176 |
|
} |
| 177 |
|
if (source[sn].sflags & SFLAT) { /* behind source? */ |
| 178 |
|
multv3(nsnorm, source[sn].snorm, pm); |
| 179 |
|
if (nsflags & SSPOT && checkspot(&ourspot, nsnorm) < 0) |
| 180 |
< |
return(NULL); |
| 180 |
> |
return(-1); |
| 181 |
|
} |
| 182 |
|
} |
| 183 |
|
/* everything is OK, make source */ |