161 |
|
return(-1); /* at source!! */ |
162 |
|
if (source[sn].sflags & SPROX && d > source[sn].sl.prox) |
163 |
|
return(-1); /* too far away */ |
164 |
– |
ourspot.siz = 2.*PI*(1. - d/sqrt(d*d+maxrad2)); |
164 |
|
ourspot.flen = 0.; |
165 |
+ |
if (d*d > maxrad2) |
166 |
+ |
ourspot.siz = 2.*PI*(1. - sqrt(1.-maxrad2/(d*d))); |
167 |
+ |
else |
168 |
+ |
nsflags &= ~SSPOT; |
169 |
|
if (source[sn].sflags & SSPOT) { |
170 |
|
copystruct(&theirspot, source[sn].sl.s); |
171 |
|
multv3(theirspot.aim, source[sn].sl.s->aim, pm); |
172 |
< |
d = ourspot.siz; |
173 |
< |
if (!commonspot(&ourspot, &theirspot, nsloc)) |
174 |
< |
return(-1); /* no overlap */ |
172 |
> |
if (nsflags & SSPOT) { |
173 |
> |
ourspot.flen = theirspot.flen; |
174 |
> |
d = ourspot.siz; |
175 |
> |
if (!commonspot(&ourspot, &theirspot, nsloc)) |
176 |
> |
return(-1); /* no overlap */ |
177 |
> |
} else { |
178 |
> |
nsflags |= SSPOT; |
179 |
> |
copystruct(&ourspot, &theirspot); |
180 |
> |
d = 2.*ourspot.siz; |
181 |
> |
} |
182 |
|
if (ourspot.siz < d-FTINY) { /* it shrunk */ |
183 |
|
d = spotdisk(v, op, &ourspot, nsloc); |
184 |
|
if (d <= FTINY) |
188 |
|
VCOPY(ocent, v); |
189 |
|
} |
190 |
|
} |
181 |
– |
ourspot.flen = theirspot.flen; |
191 |
|
} |
192 |
|
if (source[sn].sflags & SFLAT) { /* behind source? */ |
193 |
|
multv3(nsnorm, source[sn].snorm, pm); |
207 |
|
if (nsflags & SFLAT) |
208 |
|
VCOPY(source[i].snorm, nsnorm); |
209 |
|
source[i].ss = source[sn].ss; source[i].ss2 = source[sn].ss2; |
210 |
< |
if ((source[i].sl.s = (SPOT *)malloc(sizeof(SPOT))) == NULL) |
211 |
< |
goto memerr; |
212 |
< |
copystruct(source[i].sl.s, &ourspot); |
210 |
> |
if (nsflags & SSPOT) { |
211 |
> |
if ((source[i].sl.s = (SPOT *)malloc(sizeof(SPOT))) == NULL) |
212 |
> |
goto memerr; |
213 |
> |
copystruct(source[i].sl.s, &ourspot); |
214 |
> |
} |
215 |
|
if (nsflags & SPROX) |
216 |
|
source[i].sl.prox = source[sn].sl.prox; |
217 |
|
source[i].sa.svnext = sn; |