1 |
– |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Source sampling routines |
6 |
+ |
* |
7 |
+ |
* External symbols declared in source.h |
8 |
|
*/ |
9 |
|
|
10 |
+ |
#include "copyright.h" |
11 |
+ |
|
12 |
|
#include "ray.h" |
13 |
|
|
14 |
|
#include "source.h" |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
+ |
int |
108 |
|
skipparts(ct, sz, pp, pt) /* skip to requested partition */ |
109 |
|
int ct[3], sz[3]; /* center and size of partition (returned) */ |
110 |
|
register int pp[2]; /* current index, number to skip (modified) */ |
114 |
|
/* check this partition */ |
115 |
|
p = spart(pt, pp[0]); |
116 |
|
pp[0]++; |
117 |
< |
if (p == S0) /* leaf partition */ |
117 |
> |
if (p == S0) { /* leaf partition */ |
118 |
|
if (pp[1]) { |
119 |
|
pp[1]--; |
120 |
|
return(0); /* not there yet */ |
121 |
|
} else |
122 |
|
return(1); /* we've arrived */ |
123 |
+ |
} |
124 |
|
/* else check lower */ |
125 |
|
sz[p] >>= 1; |
126 |
|
ct[p] -= sz[p]; |
137 |
|
} |
138 |
|
|
139 |
|
|
140 |
+ |
void |
141 |
|
nopart(si, r) /* single source partition */ |
142 |
|
register SRCINDEX *si; |
143 |
|
RAY *r; |
148 |
|
} |
149 |
|
|
150 |
|
|
151 |
+ |
void |
152 |
|
cylpart(si, r) /* partition a cylinder */ |
153 |
|
SRCINDEX *si; |
154 |
|
register RAY *r; |
225 |
|
} |
226 |
|
|
227 |
|
|
228 |
+ |
void |
229 |
|
flatpart(si, r) /* partition a flat source */ |
230 |
|
register SRCINDEX *si; |
231 |
|
register RAY *r; |
232 |
|
{ |
233 |
< |
register FLOAT *vp; |
233 |
> |
register RREAL *vp; |
234 |
|
FVECT v; |
235 |
|
double du2, dv2; |
236 |
|
int pi; |
314 |
|
int sn; |
315 |
|
register FVECT dir; /* assume normalized */ |
316 |
|
{ |
317 |
< |
register FLOAT *dv; |
317 |
> |
register RREAL *dv; |
318 |
|
double d; |
319 |
|
|
320 |
|
dv = source[sn].ss[SU]; |